jobs list rows are links to /jobs/:id instead of a navigate button
the row was a <button onClick={navigate(`/jobs/${id}`)}> with the id only in the
closure — no href, no cmd/middle-click. it's now a <Link>; the active-row highlight
already keys off useParams().id so nothing else changed. the stop/delete action stays
a button.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect, useCallback, type ReactNode, type MouseEvent } from 'react';
|
import { useState, useEffect, useCallback, type ReactNode, type MouseEvent } from 'react';
|
||||||
import { useParams, useNavigate } from 'react-router';
|
import { useParams, Link } from 'react-router';
|
||||||
import {
|
import {
|
||||||
Search,
|
Search,
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
@@ -97,7 +97,6 @@ const useJobsData = () => {
|
|||||||
|
|
||||||
type JobRowProps = { job: JobSummary; onAction: (ev: MouseEvent, job: JobSummary) => void };
|
type JobRowProps = { job: JobSummary; onAction: (ev: MouseEvent, job: JobSummary) => void };
|
||||||
const JobRow = ({ job, onAction }: JobRowProps) => {
|
const JobRow = ({ job, onAction }: JobRowProps) => {
|
||||||
const navigate = useNavigate();
|
|
||||||
const { id: activeId } = useParams<{ id: string }>();
|
const { id: activeId } = useParams<{ id: string }>();
|
||||||
const isRunning = job.status === 'running';
|
const isRunning = job.status === 'running';
|
||||||
const target = basename(job.target);
|
const target = basename(job.target);
|
||||||
@@ -105,8 +104,8 @@ const JobRow = ({ job, onAction }: JobRowProps) => {
|
|||||||
<div
|
<div
|
||||||
className={`group w-full border-b border-duck-dark/5 flex items-center transition-colors ${job.id === activeId ? 'bg-duck-teal/10' : 'hover:bg-duck-dark/5'}`}
|
className={`group w-full border-b border-duck-dark/5 flex items-center transition-colors ${job.id === activeId ? 'bg-duck-teal/10' : 'hover:bg-duck-dark/5'}`}
|
||||||
>
|
>
|
||||||
<button
|
<Link
|
||||||
onClick={() => navigate(`/jobs/${job.id}`)}
|
to={`/jobs/${job.id}`}
|
||||||
className="flex-1 min-w-0 text-left px-4 py-2.5 flex items-center gap-3 cursor-pointer"
|
className="flex-1 min-w-0 text-left px-4 py-2.5 flex items-center gap-3 cursor-pointer"
|
||||||
>
|
>
|
||||||
<StatusIcon status={job.status} />
|
<StatusIcon status={job.status} />
|
||||||
@@ -122,7 +121,7 @@ const JobRow = ({ job, onAction }: JobRowProps) => {
|
|||||||
{job.error && <span className="text-xs text-red-500 truncate max-w-[160px]">{job.error}</span>}
|
{job.error && <span className="text-xs text-red-500 truncate max-w-[160px]">{job.error}</span>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</Link>
|
||||||
<button
|
<button
|
||||||
onClick={(ev) => onAction(ev, job)}
|
onClick={(ev) => onAction(ev, job)}
|
||||||
title={isRunning ? 'Stop' : 'Delete'}
|
title={isRunning ? 'Stop' : 'Delete'}
|
||||||
|
|||||||
Reference in New Issue
Block a user