mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-16 18:25:17 +02:00
show last ran time stamp
This commit is contained in:
parent
e561616c75
commit
73c281aa33
2 changed files with 20 additions and 0 deletions
|
|
@ -3,22 +3,37 @@ import { ReactNodeViewRenderer, NodeViewWrapper } from '@tiptap/react'
|
||||||
import { CalendarClock, Loader2, X } from 'lucide-react'
|
import { CalendarClock, Loader2, X } from 'lucide-react'
|
||||||
import { inlineTask } from '@x/shared'
|
import { inlineTask } from '@x/shared'
|
||||||
|
|
||||||
|
function formatDateTime(iso: string): string {
|
||||||
|
const d = new Date(iso)
|
||||||
|
return d.toLocaleString('en-US', {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
hour: 'numeric',
|
||||||
|
minute: '2-digit',
|
||||||
|
hour12: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function TaskBlockView({ node, deleteNode }: { node: { attrs: Record<string, unknown> }; deleteNode: () => void }) {
|
function TaskBlockView({ node, deleteNode }: { node: { attrs: Record<string, unknown> }; deleteNode: () => void }) {
|
||||||
const raw = node.attrs.data as string
|
const raw = node.attrs.data as string
|
||||||
let instruction = ''
|
let instruction = ''
|
||||||
let scheduleLabel = ''
|
let scheduleLabel = ''
|
||||||
let processing = false
|
let processing = false
|
||||||
|
let lastRunAt = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const parsed = inlineTask.InlineTaskBlockSchema.parse(JSON.parse(raw))
|
const parsed = inlineTask.InlineTaskBlockSchema.parse(JSON.parse(raw))
|
||||||
instruction = parsed.instruction
|
instruction = parsed.instruction
|
||||||
scheduleLabel = parsed['schedule-label'] ?? ''
|
scheduleLabel = parsed['schedule-label'] ?? ''
|
||||||
processing = parsed.processing ?? false
|
processing = parsed.processing ?? false
|
||||||
|
lastRunAt = parsed.lastRunAt ?? ''
|
||||||
} catch {
|
} catch {
|
||||||
// Fallback: show raw data
|
// Fallback: show raw data
|
||||||
instruction = raw
|
instruction = raw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const lastRunLabel = lastRunAt ? formatDateTime(lastRunAt) : ''
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeViewWrapper className="task-block-wrapper" data-type="task-block">
|
<NodeViewWrapper className="task-block-wrapper" data-type="task-block">
|
||||||
<div className="task-block-card">
|
<div className="task-block-card">
|
||||||
|
|
@ -41,6 +56,7 @@ function TaskBlockView({ node, deleteNode }: { node: { attrs: Record<string, unk
|
||||||
<span className="task-block-schedule">
|
<span className="task-block-schedule">
|
||||||
<CalendarClock size={12} />
|
<CalendarClock size={12} />
|
||||||
{scheduleLabel}
|
{scheduleLabel}
|
||||||
|
{lastRunLabel && <span className="task-block-last-run"> · last ran {lastRunLabel}</span>}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -608,6 +608,10 @@
|
||||||
color: color-mix(in srgb, var(--foreground) 55%, transparent);
|
color: color-mix(in srgb, var(--foreground) 55%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tiptap-editor .ProseMirror .task-block-last-run {
|
||||||
|
color: color-mix(in srgb, var(--foreground) 38%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
/* Shared block styles (image, embed, chart, table) */
|
/* Shared block styles (image, embed, chart, table) */
|
||||||
.tiptap-editor .ProseMirror .image-block-wrapper,
|
.tiptap-editor .ProseMirror .image-block-wrapper,
|
||||||
.tiptap-editor .ProseMirror .embed-block-wrapper,
|
.tiptap-editor .ProseMirror .embed-block-wrapper,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue