Make ui more uniform
This commit is contained in:
1 parent
adcf884c0f
commit
d0214c0df9
6 files changed
+90
-28
No files matched your search
@@ -1,12 +1,20 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import GpuMonitor from '@/components/GPUMonitor';
|
import GpuMonitor from '@/components/GPUMonitor';
|
||||||
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
|
|
||||||
export default function Dashboard() {
|
export default function Dashboard() {
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<>
|
||||||
<h1 className="text-xl font-bold mb-8">Dashboard</h1>
|
<TopBar>
|
||||||
<GpuMonitor />
|
<div>
|
||||||
|
<h1 className="text-lg">Dashboard</h1>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex-1"></div>
|
||||||
|
</TopBar>
|
||||||
|
<MainContent>
|
||||||
|
<GpuMonitor />
|
||||||
|
</MainContent>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import { FaChevronLeft } from 'react-icons/fa';
|
|||||||
import DatasetImageCard from '@/components/DatasetImageCard';
|
import DatasetImageCard from '@/components/DatasetImageCard';
|
||||||
import { Button } from '@headlessui/react';
|
import { Button } from '@headlessui/react';
|
||||||
import AddImagesModal, { openImagesModal } from '@/components/AddImagesModal';
|
import AddImagesModal, { openImagesModal } from '@/components/AddImagesModal';
|
||||||
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
|
|
||||||
export default function DatasetPage({ params }: { params: { datasetName: string } }) {
|
export default function DatasetPage({ params }: { params: { datasetName: string } }) {
|
||||||
const [imgList, setImgList] = useState<{ img_path: string }[]>([]);
|
const [imgList, setImgList] = useState<{ img_path: string }[]>([]);
|
||||||
@@ -43,7 +44,7 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* Fixed top bar */}
|
{/* Fixed top bar */}
|
||||||
<div className="absolute top-0 left-0 w-full h-12 dark:bg-gray-900 shadow-sm z-10 flex items-center px-2">
|
<TopBar>
|
||||||
<div>
|
<div>
|
||||||
<Button className="text-gray-500 dark:text-gray-300 px-3 mt-1" onClick={() => history.back()}>
|
<Button className="text-gray-500 dark:text-gray-300 px-3 mt-1" onClick={() => history.back()}>
|
||||||
<FaChevronLeft />
|
<FaChevronLeft />
|
||||||
@@ -61,8 +62,8 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
|||||||
Add Images
|
Add Images
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</TopBar>
|
||||||
<div className="pt-16 px-6 absolute top-0 left-0 w-full h-full overflow-auto">
|
<MainContent>
|
||||||
{status === 'loading' && <p>Loading...</p>}
|
{status === 'loading' && <p>Loading...</p>}
|
||||||
{status === 'error' && <p>Error fetching images</p>}
|
{status === 'error' && <p>Error fetching images</p>}
|
||||||
{status === 'success' && (
|
{status === 'success' && (
|
||||||
@@ -78,7 +79,7 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</MainContent>
|
||||||
<AddImagesModal />
|
<AddImagesModal />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import useDatasetList from '@/hooks/useDatasetList';
|
|||||||
import { Button } from '@headlessui/react';
|
import { Button } from '@headlessui/react';
|
||||||
import { FaRegTrashAlt } from 'react-icons/fa';
|
import { FaRegTrashAlt } from 'react-icons/fa';
|
||||||
import { openConfirm } from '@/components/ConfirmModal';
|
import { openConfirm } from '@/components/ConfirmModal';
|
||||||
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
|
|
||||||
export default function Datasets() {
|
export default function Datasets() {
|
||||||
const { datasets, status, refreshDatasets } = useDatasetList();
|
const { datasets, status, refreshDatasets } = useDatasetList();
|
||||||
@@ -15,7 +16,7 @@ export default function Datasets() {
|
|||||||
const [isNewDatasetModalOpen, setIsNewDatasetModalOpen] = useState(false);
|
const [isNewDatasetModalOpen, setIsNewDatasetModalOpen] = useState(false);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="absolute top-0 left-0 w-full h-12 dark:bg-gray-900 shadow-sm z-10 flex items-center px-2">
|
<TopBar>
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-lg">Datasets</h1>
|
<h1 className="text-lg">Datasets</h1>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,8 +29,8 @@ export default function Datasets() {
|
|||||||
New Dataset
|
New Dataset
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</TopBar>
|
||||||
<div className="pt-16 px-4 absolute top-0 left-0 w-full h-full overflow-auto">
|
<MainContent>
|
||||||
{status === 'loading' && <p>Loading...</p>}
|
{status === 'loading' && <p>Loading...</p>}
|
||||||
{status === 'error' && <p>Error fetching datasets</p>}
|
{status === 'error' && <p>Error fetching datasets</p>}
|
||||||
{status === 'success' && (
|
{status === 'success' && (
|
||||||
@@ -79,7 +80,7 @@ export default function Datasets() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</MainContent>
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={isNewDatasetModalOpen}
|
isOpen={isNewDatasetModalOpen}
|
||||||
onClose={() => setIsNewDatasetModalOpen(false)}
|
onClose={() => setIsNewDatasetModalOpen(false)}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import useSettings from '@/hooks/useSettings';
|
import useSettings from '@/hooks/useSettings';
|
||||||
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
|
|
||||||
export default function Settings() {
|
export default function Settings() {
|
||||||
const { settings, setSettings } = useSettings();
|
const { settings, setSettings } = useSettings();
|
||||||
@@ -37,10 +38,17 @@ export default function Settings() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="max-w-2xl mx-auto space-y-6">
|
<>
|
||||||
<h1 className="text-3xl font-bold mb-8">Settings</h1>
|
<TopBar>
|
||||||
|
<div>
|
||||||
|
<h1 className="text-lg">Settings</h1>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1"></div>
|
||||||
|
</TopBar>
|
||||||
|
<MainContent>
|
||||||
<form onSubmit={handleSubmit} className="space-y-6">
|
<form onSubmit={handleSubmit} className="space-y-6">
|
||||||
|
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2">
|
||||||
|
<div>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="HF_TOKEN" className="block text-sm font-medium mb-2">
|
<label htmlFor="HF_TOKEN" className="block text-sm font-medium mb-2">
|
||||||
@@ -69,8 +77,8 @@ export default function Settings() {
|
|||||||
<label htmlFor="TRAINING_FOLDER" className="block text-sm font-medium mb-2">
|
<label htmlFor="TRAINING_FOLDER" className="block text-sm font-medium mb-2">
|
||||||
Training Folder Path
|
Training Folder Path
|
||||||
<div className="text-gray-500 text-sm ml-1">
|
<div className="text-gray-500 text-sm ml-1">
|
||||||
We will store your training information here. Must be an absolute path. If blank, it will default to the
|
We will store your training information here. Must be an absolute path. If blank, it will default
|
||||||
output folder in the project root.
|
to the output folder in the project root.
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
@@ -90,8 +98,8 @@ export default function Settings() {
|
|||||||
<div className="text-gray-500 text-sm ml-1">
|
<div className="text-gray-500 text-sm ml-1">
|
||||||
Where we store and find your datasets.{' '}
|
Where we store and find your datasets.{' '}
|
||||||
<span className="text-orange-800">
|
<span className="text-orange-800">
|
||||||
Warning: This software may modify datasets so it is recommended you keep a backup somewhere else or
|
Warning: This software may modify datasets so it is recommended you keep a backup somewhere else
|
||||||
have a dedicated folder for this software.
|
or have a dedicated folder for this software.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -106,6 +114,8 @@ export default function Settings() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
@@ -118,6 +128,7 @@ export default function Settings() {
|
|||||||
{status === 'success' && <p className="text-green-500 text-center">Settings saved successfully!</p>}
|
{status === 'success' && <p className="text-green-500 text-center">Settings saved successfully!</p>}
|
||||||
{status === 'error' && <p className="text-red-500 text-center">Error saving settings. Please try again.</p>}
|
{status === 'error' && <p className="text-red-500 text-center">Error saving settings. Please try again.</p>}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</MainContent>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
// todo update training folder from settings
|
|
||||||
|
|
||||||
import { use, useEffect, useMemo, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useSearchParams, useRouter } from 'next/navigation';
|
import { useSearchParams, useRouter } from 'next/navigation';
|
||||||
import { options } from './options';
|
import { options } from './options';
|
||||||
import { defaultJobConfig, defaultDatasetConfig } from './jobConfig';
|
import { defaultJobConfig, defaultDatasetConfig } from './jobConfig';
|
||||||
@@ -15,6 +14,7 @@ import useSettings from '@/hooks/useSettings';
|
|||||||
import useGPUInfo from '@/hooks/useGPUInfo';
|
import useGPUInfo from '@/hooks/useGPUInfo';
|
||||||
import useDatasetList from '@/hooks/useDatasetList';
|
import useDatasetList from '@/hooks/useDatasetList';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { TopBar, MainContent } from '@/components/layout';
|
||||||
|
|
||||||
export default function TrainingForm() {
|
export default function TrainingForm() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -105,9 +105,14 @@ export default function TrainingForm() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<>
|
||||||
<h1 className="text-xl font-bold mb-8">{runId ? 'Edit Training Run' : 'New Training Run'}</h1>
|
<TopBar>
|
||||||
|
<div>
|
||||||
|
<h1 className="text-lg">{runId ? 'Edit Training Run' : 'New Training Run'}</h1>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1"></div>
|
||||||
|
</TopBar>
|
||||||
|
<MainContent>
|
||||||
<form onSubmit={handleSubmit} className="space-y-8">
|
<form onSubmit={handleSubmit} className="space-y-8">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
<Card title="Job Settings">
|
<Card title="Job Settings">
|
||||||
@@ -359,7 +364,9 @@ export default function TrainingForm() {
|
|||||||
label="Caption Dropout Rate"
|
label="Caption Dropout Rate"
|
||||||
className="pt-2"
|
className="pt-2"
|
||||||
value={dataset.caption_dropout_rate}
|
value={dataset.caption_dropout_rate}
|
||||||
onChange={value => setJobConfig(value, `config.process[0].datasets[${i}].caption_dropout_rate`)}
|
onChange={value =>
|
||||||
|
setJobConfig(value, `config.process[0].datasets[${i}].caption_dropout_rate`)
|
||||||
|
}
|
||||||
placeholder="eg. 0.05"
|
placeholder="eg. 0.05"
|
||||||
min={0}
|
min={0}
|
||||||
required
|
required
|
||||||
@@ -493,7 +500,10 @@ export default function TrainingForm() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FormGroup label={`Sample Prompts (${jobConfig.config.process[0].sample.prompts.length})`} className="pt-2">
|
<FormGroup
|
||||||
|
label={`Sample Prompts (${jobConfig.config.process[0].sample.prompts.length})`}
|
||||||
|
className="pt-2"
|
||||||
|
>
|
||||||
{jobConfig.config.process[0].sample.prompts.map((prompt, i) => (
|
{jobConfig.config.process[0].sample.prompts.map((prompt, i) => (
|
||||||
<div key={i} className="flex items-center space-x-2">
|
<div key={i} className="flex items-center space-x-2">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
@@ -523,7 +533,10 @@ export default function TrainingForm() {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setJobConfig([...jobConfig.config.process[0].sample.prompts, ''], 'config.process[0].sample.prompts')
|
setJobConfig(
|
||||||
|
[...jobConfig.config.process[0].sample.prompts, ''],
|
||||||
|
'config.process[0].sample.prompts',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
className="w-full px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors"
|
className="w-full px-4 py-2 bg-gray-700 hover:bg-gray-600 rounded-lg transition-colors"
|
||||||
>
|
>
|
||||||
@@ -544,6 +557,7 @@ export default function TrainingForm() {
|
|||||||
{status === 'success' && <p className="text-green-500 text-center">Training saved successfully!</p>}
|
{status === 'success' && <p className="text-green-500 text-center">Training saved successfully!</p>}
|
||||||
{status === 'error' && <p className="text-red-500 text-center">Error saving training. Please try again.</p>}
|
{status === 'error' && <p className="text-red-500 text-center">Error saving training. Please try again.</p>}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</MainContent>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
className?: string;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TopBar: React.FC<Props> = ({ children, className }) => {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'absolute top-0 left-0 w-full h-12 dark:bg-gray-900 shadow-sm z-10 flex items-center px-2',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{children ? children : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MainContent: React.FC<Props> = ({ children, className }) => {
|
||||||
|
return (
|
||||||
|
<div className={classNames('pt-16 px-4 absolute top-0 left-0 w-full h-full overflow-auto', className)}>
|
||||||
|
{children ? children : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in new issue
Block a user