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';
|
||||
|
||||
import GpuMonitor from '@/components/GPUMonitor';
|
||||
import { TopBar, MainContent } from '@/components/layout';
|
||||
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<h1 className="text-xl font-bold mb-8">Dashboard</h1>
|
||||
<GpuMonitor />
|
||||
<>
|
||||
<TopBar>
|
||||
<div>
|
||||
<h1 className="text-lg">Dashboard</h1>
|
||||
</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 { Button } from '@headlessui/react';
|
||||
import AddImagesModal, { openImagesModal } from '@/components/AddImagesModal';
|
||||
import { TopBar, MainContent } from '@/components/layout';
|
||||
|
||||
export default function DatasetPage({ params }: { params: { datasetName: string } }) {
|
||||
const [imgList, setImgList] = useState<{ img_path: string }[]>([]);
|
||||
@@ -43,7 +44,7 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
||||
return (
|
||||
<>
|
||||
{/* 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>
|
||||
<Button className="text-gray-500 dark:text-gray-300 px-3 mt-1" onClick={() => history.back()}>
|
||||
<FaChevronLeft />
|
||||
@@ -61,8 +62,8 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
||||
Add Images
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pt-16 px-6 absolute top-0 left-0 w-full h-full overflow-auto">
|
||||
</TopBar>
|
||||
<MainContent>
|
||||
{status === 'loading' && <p>Loading...</p>}
|
||||
{status === 'error' && <p>Error fetching images</p>}
|
||||
{status === 'success' && (
|
||||
@@ -78,7 +79,7 @@ export default function DatasetPage({ params }: { params: { datasetName: string
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</MainContent>
|
||||
<AddImagesModal />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ import useDatasetList from '@/hooks/useDatasetList';
|
||||
import { Button } from '@headlessui/react';
|
||||
import { FaRegTrashAlt } from 'react-icons/fa';
|
||||
import { openConfirm } from '@/components/ConfirmModal';
|
||||
import { TopBar, MainContent } from '@/components/layout';
|
||||
|
||||
export default function Datasets() {
|
||||
const { datasets, status, refreshDatasets } = useDatasetList();
|
||||
@@ -15,7 +16,7 @@ export default function Datasets() {
|
||||
const [isNewDatasetModalOpen, setIsNewDatasetModalOpen] = useState(false);
|
||||
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>
|
||||
<h1 className="text-lg">Datasets</h1>
|
||||
</div>
|
||||
@@ -28,8 +29,8 @@ export default function Datasets() {
|
||||
New Dataset
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="pt-16 px-4 absolute top-0 left-0 w-full h-full overflow-auto">
|
||||
</TopBar>
|
||||
<MainContent>
|
||||
{status === 'loading' && <p>Loading...</p>}
|
||||
{status === 'error' && <p>Error fetching datasets</p>}
|
||||
{status === 'success' && (
|
||||
@@ -79,7 +80,7 @@ export default function Datasets() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</MainContent>
|
||||
<Modal
|
||||
isOpen={isNewDatasetModalOpen}
|
||||
onClose={() => setIsNewDatasetModalOpen(false)}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import useSettings from '@/hooks/useSettings';
|
||||
import { TopBar, MainContent } from '@/components/layout';
|
||||
|
||||
export default function Settings() {
|
||||
const { settings, setSettings } = useSettings();
|
||||
@@ -37,10 +38,17 @@ export default function Settings() {
|
||||
};
|
||||
|
||||
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">
|
||||
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2">
|
||||
<div>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<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">
|
||||
Training Folder Path
|
||||
<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
|
||||
output folder in the project root.
|
||||
We will store your training information here. Must be an absolute path. If blank, it will default
|
||||
to the output folder in the project root.
|
||||
</div>
|
||||
</label>
|
||||
<input
|
||||
@@ -90,8 +98,8 @@ export default function Settings() {
|
||||
<div className="text-gray-500 text-sm ml-1">
|
||||
Where we store and find your datasets.{' '}
|
||||
<span className="text-orange-800">
|
||||
Warning: This software may modify datasets so it is recommended you keep a backup somewhere else or
|
||||
have a dedicated folder for this software.
|
||||
Warning: This software may modify datasets so it is recommended you keep a backup somewhere else
|
||||
or have a dedicated folder for this software.
|
||||
</span>
|
||||
</div>
|
||||
</label>
|
||||
@@ -106,6 +114,8 @@ export default function Settings() {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
@@ -118,6 +128,7 @@ export default function Settings() {
|
||||
{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>}
|
||||
</form>
|
||||
</div>
|
||||
</MainContent>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
'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 { options } from './options';
|
||||
import { defaultJobConfig, defaultDatasetConfig } from './jobConfig';
|
||||
@@ -15,6 +14,7 @@ import useSettings from '@/hooks/useSettings';
|
||||
import useGPUInfo from '@/hooks/useGPUInfo';
|
||||
import useDatasetList from '@/hooks/useDatasetList';
|
||||
import path from 'path';
|
||||
import { TopBar, MainContent } from '@/components/layout';
|
||||
|
||||
export default function TrainingForm() {
|
||||
const router = useRouter();
|
||||
@@ -105,9 +105,14 @@ export default function TrainingForm() {
|
||||
};
|
||||
|
||||
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">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
<Card title="Job Settings">
|
||||
@@ -359,7 +364,9 @@ export default function TrainingForm() {
|
||||
label="Caption Dropout Rate"
|
||||
className="pt-2"
|
||||
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"
|
||||
min={0}
|
||||
required
|
||||
@@ -493,7 +500,10 @@ export default function TrainingForm() {
|
||||
/>
|
||||
</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) => (
|
||||
<div key={i} className="flex items-center space-x-2">
|
||||
<div className="flex-1">
|
||||
@@ -523,7 +533,10 @@ export default function TrainingForm() {
|
||||
<button
|
||||
type="button"
|
||||
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"
|
||||
>
|
||||
@@ -544,6 +557,7 @@ export default function TrainingForm() {
|
||||
{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>}
|
||||
</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