Add icons to the top bar on the job page
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useState, use } from 'react';
|
import { useState, use } from 'react';
|
||||||
import { FaChevronLeft } from 'react-icons/fa';
|
import { FaChevronLeft } from 'react-icons/fa';
|
||||||
|
import { MdDashboard, MdImage, MdShowChart, MdCode } from 'react-icons/md';
|
||||||
import { Button } from '@headlessui/react';
|
import { Button } from '@headlessui/react';
|
||||||
import { TopBar, MainContent } from '@/components/layout';
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
import useJob from '@/hooks/useJob';
|
import useJob from '@/hooks/useJob';
|
||||||
@@ -18,6 +19,7 @@ type PageKey = 'overview' | 'samples' | 'config' | 'loss_log';
|
|||||||
interface Page {
|
interface Page {
|
||||||
name: string;
|
name: string;
|
||||||
value: PageKey;
|
value: PageKey;
|
||||||
|
icon: React.ComponentType<{ className?: string }>;
|
||||||
component: React.ComponentType<{ job: Job }>;
|
component: React.ComponentType<{ job: Job }>;
|
||||||
menuItem?: React.ComponentType<{ job?: Job | null }> | null;
|
menuItem?: React.ComponentType<{ job?: Job | null }> | null;
|
||||||
mainCss?: string;
|
mainCss?: string;
|
||||||
@@ -27,12 +29,14 @@ const pages: Page[] = [
|
|||||||
{
|
{
|
||||||
name: 'Overview',
|
name: 'Overview',
|
||||||
value: 'overview',
|
value: 'overview',
|
||||||
|
icon: MdDashboard,
|
||||||
component: JobOverview,
|
component: JobOverview,
|
||||||
mainCss: 'pt-24',
|
mainCss: 'pt-24',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Samples',
|
name: 'Samples',
|
||||||
value: 'samples',
|
value: 'samples',
|
||||||
|
icon: MdImage,
|
||||||
component: SampleImages,
|
component: SampleImages,
|
||||||
menuItem: SampleImagesMenu,
|
menuItem: SampleImagesMenu,
|
||||||
mainCss: 'pt-24',
|
mainCss: 'pt-24',
|
||||||
@@ -40,12 +44,14 @@ const pages: Page[] = [
|
|||||||
{
|
{
|
||||||
name: 'Loss Graph',
|
name: 'Loss Graph',
|
||||||
value: 'loss_log',
|
value: 'loss_log',
|
||||||
|
icon: MdShowChart,
|
||||||
component: JobLossGraph,
|
component: JobLossGraph,
|
||||||
mainCss: 'pt-24',
|
mainCss: 'pt-24',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Config File',
|
name: 'Config File',
|
||||||
value: 'config',
|
value: 'config',
|
||||||
|
icon: MdCode,
|
||||||
component: JobConfigViewer,
|
component: JobConfigViewer,
|
||||||
mainCss: 'pt-[80px] px-0 pb-0',
|
mainCss: 'pt-[80px] px-0 pb-0',
|
||||||
},
|
},
|
||||||
@@ -101,8 +107,9 @@ export default function JobPage({ params }: { params: { jobID: string } }) {
|
|||||||
<Button
|
<Button
|
||||||
key={page.value}
|
key={page.value}
|
||||||
onClick={() => setPageKey(page.value)}
|
onClick={() => setPageKey(page.value)}
|
||||||
className={`px-4 py-1 h-8 ${page.value === pageKey ? 'bg-gray-300 dark:bg-gray-700' : ''}`}
|
className={`px-4 py-1 h-8 flex items-center gap-1.5 ${page.value === pageKey ? 'bg-gray-300 dark:bg-gray-700' : ''}`}
|
||||||
>
|
>
|
||||||
|
<page.icon className="text-sm" />
|
||||||
{page.name}
|
{page.name}
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user