mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(schedules): improve mobile table layout and extract tabbar padding utility
This commit is contained in:
1 parent
4ee3e50af1
commit
d046bccaf6
6 files changed
+47
-35
No files matched your search
@@ -148,7 +148,7 @@ export function PromptsTab({ promptDialog, templateId, onNew, onEdit, onDelete,
|
||||
onClick={() => onEdit(template.id)}
|
||||
className="cursor-pointer transition-colors hover:bg-accent/40"
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<td className="w-full max-w-0 px-3 py-2.5 sm:w-auto sm:max-w-none">
|
||||
<div className="flex min-w-0 flex-col">
|
||||
<button
|
||||
type="button"
|
||||
@@ -157,12 +157,12 @@ export function PromptsTab({ promptDialog, templateId, onNew, onEdit, onDelete,
|
||||
onEdit(template.id)
|
||||
}}
|
||||
aria-label={`Edit ${template.title}`}
|
||||
className="max-w-[32rem] truncate font-medium rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
||||
className="truncate font-medium sm:max-w-[32rem] rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
||||
>
|
||||
{template.title}
|
||||
</button>
|
||||
{template.description && (
|
||||
<span className="max-w-[32rem] truncate text-xs text-muted-foreground">{template.description}</span>
|
||||
<span className="truncate text-xs sm:max-w-[32rem] text-muted-foreground">{template.description}</span>
|
||||
)}
|
||||
<span className="truncate text-xs text-muted-foreground sm:hidden">
|
||||
{template.category} · {template.cadenceHint}
|
||||
|
||||
@@ -101,7 +101,7 @@ export function ScheduleJobsTable({
|
||||
<table className="w-full text-sm">
|
||||
<thead className="sticky top-0 z-10 whitespace-nowrap bg-background text-xs uppercase text-muted-foreground">
|
||||
<tr className="border-b border-border/60">
|
||||
<th scope="col" className="px-3 py-2.5 text-left font-medium">Status</th>
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Status</th>
|
||||
<th scope="col" className="px-3 py-2.5 text-left font-medium">Job</th>
|
||||
{showRepo && <th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Repo</th>}
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Schedule</th>
|
||||
@@ -161,27 +161,32 @@ export function ScheduleJobsTable({
|
||||
isSelected && 'bg-accent/30',
|
||||
)}
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<td className="hidden px-3 py-2.5 sm:table-cell">
|
||||
<span className="flex items-center gap-2">
|
||||
<ScheduleJobStatusIndicator job={job} />
|
||||
<span className="hidden text-xs text-muted-foreground sm:inline">{statusLabel}</span>
|
||||
<span className="text-xs text-muted-foreground">{statusLabel}</span>
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-3 py-2.5">
|
||||
<td className="w-full max-w-0 px-3 py-2.5 sm:w-auto sm:max-w-none">
|
||||
<div className="flex min-w-0 flex-col">
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
onOpen(job)
|
||||
}}
|
||||
aria-label={`Open ${job.name}`}
|
||||
className="max-w-[11rem] truncate font-medium sm:max-w-[20rem] rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
||||
>
|
||||
{job.name}
|
||||
</button>
|
||||
{job.description && <span className="max-w-[11rem] truncate text-xs text-muted-foreground sm:max-w-[20rem]">{job.description}</span>}
|
||||
<span className="max-w-[11rem] truncate text-xs text-muted-foreground sm:hidden" title={scheduleTitle}>{mobileDetail}</span>
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<span className="flex shrink-0 items-center sm:hidden">
|
||||
<ScheduleJobStatusIndicator job={job} />
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
event.stopPropagation()
|
||||
onOpen(job)
|
||||
}}
|
||||
aria-label={`Open ${job.name}`}
|
||||
className="min-w-0 truncate rounded-sm text-left font-medium outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:max-w-[20rem]"
|
||||
>
|
||||
{job.name}
|
||||
</button>
|
||||
</span>
|
||||
{job.description && <span className="truncate text-xs text-muted-foreground sm:max-w-[20rem]">{job.description}</span>}
|
||||
<span className="truncate text-xs text-muted-foreground sm:hidden" title={scheduleTitle}>{mobileDetail}</span>
|
||||
<span className="mt-0.5 text-xs sm:hidden">
|
||||
<ScheduleJobLastResult lastRun={lastRun} />
|
||||
</span>
|
||||
|
||||
@@ -51,11 +51,11 @@ export function ScheduleRunsTable({
|
||||
<table className="w-full text-sm">
|
||||
<thead className="sticky top-0 z-10 whitespace-nowrap bg-background text-xs uppercase text-muted-foreground">
|
||||
<tr className="border-b border-border/60">
|
||||
<th scope="col" className="px-3 py-2.5 text-left font-medium">Status</th>
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Status</th>
|
||||
<th scope="col" className="px-3 py-2.5 text-left font-medium">Run</th>
|
||||
{showRepo && <th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Repo</th>}
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Trigger</th>
|
||||
<th scope="col" className="px-3 py-2.5 text-left font-medium">Started</th>
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Started</th>
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Duration</th>
|
||||
<th scope="col" className="hidden px-3 py-2.5 text-left font-medium sm:table-cell">Branch</th>
|
||||
<th scope="col" className="w-px px-3 py-2.5 text-right font-medium">Actions</th>
|
||||
@@ -66,6 +66,9 @@ export function ScheduleRunsTable({
|
||||
const isUnread = run.viewedAt === null && (run.status === 'completed' || run.status === 'failed')
|
||||
const isSelected = selectedRunId === run.id
|
||||
const repoName = getRunRepoName(run)
|
||||
const startedLabel = run.status === 'running' ? 'Running' : formatDistanceToNow(run.startedAt, { addSuffix: true })
|
||||
const startedTitle = new Date(run.startedAt).toLocaleString()
|
||||
const mobileDetail = repoName ? `${startedLabel} · ${repoName}` : startedLabel
|
||||
|
||||
return (
|
||||
<tr
|
||||
@@ -73,15 +76,16 @@ export function ScheduleRunsTable({
|
||||
onClick={() => onSelectRun(run.id)}
|
||||
className={cn('cursor-pointer transition-colors hover:bg-accent/40', isSelected && 'bg-accent/30')}
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<td className="hidden px-3 py-2.5 sm:table-cell">
|
||||
<span className="flex items-center gap-2">
|
||||
{getRunStatusIcon(run.status)}
|
||||
<span className="hidden text-xs text-muted-foreground sm:inline">{getRunStatusLabel(run.status)}</span>
|
||||
<span className="text-xs text-muted-foreground">{getRunStatusLabel(run.status)}</span>
|
||||
</span>
|
||||
</td>
|
||||
<td className="px-3 py-2.5">
|
||||
<td className="w-full max-w-0 px-3 py-2.5 sm:w-auto sm:max-w-none">
|
||||
<div className="flex min-w-0 flex-col">
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<span className="flex shrink-0 items-center sm:hidden">{getRunStatusIcon(run.status)}</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={(event) => {
|
||||
@@ -89,7 +93,7 @@ export function ScheduleRunsTable({
|
||||
onSelectRun(run.id)
|
||||
}}
|
||||
aria-label={`Open run ${getRunTitle(run)}`}
|
||||
className={cn('truncate rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50', isUnread ? 'font-semibold' : 'font-medium')}
|
||||
className={cn('min-w-0 truncate rounded-sm text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50', isUnread ? 'font-semibold' : 'font-medium')}
|
||||
>
|
||||
{getRunTitle(run)}
|
||||
</button>
|
||||
@@ -98,10 +102,11 @@ export function ScheduleRunsTable({
|
||||
)}
|
||||
</span>
|
||||
{run.errorText && (
|
||||
<span className={cn('truncate text-xs', run.status === 'cancelled' ? 'text-muted-foreground' : 'text-destructive/80')}>
|
||||
<span className={cn('truncate text-xs sm:max-w-[24rem]', run.status === 'cancelled' ? 'text-muted-foreground' : 'text-destructive/80')}>
|
||||
{run.errorText}
|
||||
</span>
|
||||
)}
|
||||
<span className="truncate text-xs text-muted-foreground sm:hidden" title={startedTitle}>{mobileDetail}</span>
|
||||
</div>
|
||||
</td>
|
||||
{showRepo && (
|
||||
@@ -110,10 +115,8 @@ export function ScheduleRunsTable({
|
||||
</td>
|
||||
)}
|
||||
<td className="hidden px-3 py-2.5 capitalize text-muted-foreground sm:table-cell">{run.triggerSource}</td>
|
||||
<td className="px-3 py-2.5">
|
||||
<span className="text-muted-foreground" title={new Date(run.startedAt).toLocaleString()}>
|
||||
{run.status === 'running' ? 'Running' : formatDistanceToNow(run.startedAt, { addSuffix: true })}
|
||||
</span>
|
||||
<td className="hidden whitespace-nowrap px-3 py-2.5 sm:table-cell">
|
||||
<span className="text-muted-foreground" title={startedTitle}>{startedLabel}</span>
|
||||
</td>
|
||||
<td className="hidden px-3 py-2.5 tabular-nums text-muted-foreground sm:table-cell">{formatRunDuration(run)}</td>
|
||||
<td className="hidden px-3 py-2.5 font-mono text-xs text-muted-foreground sm:table-cell">{formatRunBranch(run) ?? '—'}</td>
|
||||
|
||||
@@ -353,6 +353,10 @@ body {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
@utility pb-mobile-tabbar {
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 5rem);
|
||||
}
|
||||
|
||||
/* Prevent iOS zoom on all input elements */
|
||||
@media (max-width: 768px) {
|
||||
input[type="text"],
|
||||
|
||||
@@ -541,7 +541,7 @@ export function GlobalSchedules() {
|
||||
</ScheduleListToolbar>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 min-h-0 flex flex-col overflow-y-auto px-2 sm:px-4 pt-2 pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-4">
|
||||
<div className="flex-1 min-h-0 flex flex-col overflow-y-auto px-2 sm:px-4 pt-2 pb-mobile-tabbar sm:pb-4">
|
||||
{!hasJobs ? (
|
||||
<div className="flex min-h-full items-center justify-center">
|
||||
<Card className="max-w-md border-dashed border-border/70">
|
||||
@@ -715,7 +715,7 @@ export function GlobalSchedules() {
|
||||
</ScheduleListToolbar>
|
||||
</div>
|
||||
|
||||
<div className="flex-1 min-h-0 flex flex-col overflow-y-auto px-2 sm:px-4 pt-2 pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-4">
|
||||
<div className="flex-1 min-h-0 flex flex-col overflow-y-auto px-2 sm:px-4 pt-2 pb-mobile-tabbar sm:pb-4">
|
||||
<div className="min-h-0 overflow-auto rounded-lg border border-border/70">
|
||||
<ScheduleRunsTable
|
||||
runs={sortedRuns}
|
||||
@@ -728,7 +728,7 @@ export function GlobalSchedules() {
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="prompts" className="mt-0 flex-1 min-h-0 flex flex-col overflow-hidden">
|
||||
<div className="flex-1 min-h-0 overflow-y-auto px-2 sm:px-4 pt-2 pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-4">
|
||||
<div className="flex-1 min-h-0 overflow-y-auto px-2 sm:px-4 pt-2 pb-mobile-tabbar sm:pb-4">
|
||||
<PromptsTab
|
||||
promptDialog={promptDialog}
|
||||
templateId={templateId}
|
||||
|
||||
@@ -249,7 +249,7 @@ export function Schedules() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-dvh max-h-dvh overflow-hidden bg-background flex flex-col pb-[calc(env(safe-area-inset-bottom)+56px)] sm:pb-0">
|
||||
<div className="h-dvh max-h-dvh overflow-hidden bg-background flex flex-col pb-mobile-tabbar sm:pb-0">
|
||||
<Header>
|
||||
<Header.BackButton to={backHref} />
|
||||
<div className="min-w-0 flex-1 px-3">
|
||||
|
||||
Reference in new issue
Block a user