Files
Alejandro Gutiérrez b1296059a9 Add URL-based routing with sidebar navigation
Replace client-side state switching with proper Next.js routes:
- /new - New scrape form
- /jobs - Jobs list with table view
- /jobs/[id] - Individual job details and logs
- /analytics - Analytics overview (completed jobs)
- /analytics/[id] - Analytics for specific job

Add JobsContext for shared state across routes. Update Sidebar
to use next/link with pathname matching. Root page redirects to /new.

Also adds partial job status styling to JobsView.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 10:58:48 +00:00

31 lines
869 B
TypeScript

'use client';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import JobsView from '@/components/JobsView';
import { useJobs } from '@/contexts/JobsContext';
import { JobStatus } from '@/components/ScraperTest';
export default function JobsPage() {
const router = useRouter();
const { jobs, refreshJobs } = useJobs();
const [isLoadingJob, setIsLoadingJob] = useState<string | null>(null);
const handleSelectJob = async (job: JobStatus, previousJob?: JobStatus) => {
// Navigate to analytics page for this job
const url = previousJob
? `/analytics/${job.job_id}?compare=${previousJob.job_id}`
: `/analytics/${job.job_id}`;
router.push(url);
};
return (
<JobsView
jobs={jobs}
onSelectJob={handleSelectJob}
isLoadingJob={isLoadingJob}
onRefresh={refreshJobs}
/>
);
}