Skip to content

Commit 30e6aae

Browse files
committed
prettier
1 parent 85f3b7e commit 30e6aae

File tree

2 files changed

+75
-49
lines changed

2 files changed

+75
-49
lines changed

src/renderer/components/TaskLibrary/NewTaskModal.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ interface NewTaskModalProps {
2727
onSuccess?: () => void;
2828
}
2929

30-
export default function NewTaskModal({ open, onClose, onSuccess }: NewTaskModalProps) {
30+
export default function NewTaskModal({
31+
open,
32+
onClose,
33+
onSuccess,
34+
}: NewTaskModalProps) {
3135
const [taskName, setTaskName] = useState('');
3236
const [description, setDescription] = useState('');
3337
const [selectedTaskId, setSelectedTaskId] = useState('');
@@ -168,11 +172,7 @@ export default function NewTaskModal({ open, onClose, onSuccess }: NewTaskModalP
168172
</Select>
169173
</FormControl>
170174

171-
{error && (
172-
<Alert color="danger">
173-
{error}
174-
</Alert>
175-
)}
175+
{error && <Alert color="danger">{error}</Alert>}
176176
</Box>
177177
</DialogContent>
178178

@@ -183,7 +183,12 @@ export default function NewTaskModal({ open, onClose, onSuccess }: NewTaskModalP
183183
<Button
184184
onClick={handleSubmit}
185185
loading={isSubmitting}
186-
disabled={!taskName.trim() || !description.trim() || !selectedTaskId || remoteTasks.length === 0}
186+
disabled={
187+
!taskName.trim() ||
188+
!description.trim() ||
189+
!selectedTaskId ||
190+
remoteTasks.length === 0
191+
}
187192
>
188193
Create Task
189194
</Button>

src/renderer/components/TaskLibrary/TaskLibrary.tsx

Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,30 +38,32 @@ export default function TaskLibrary() {
3838
const [overlayTasks, setOverlayTasks] = useState<any[]>([]);
3939

4040
// Filtering state
41-
const [sourceFilter, setSourceFilter] = useState<'all' | 'gallery' | 'local'>('all');
41+
const [sourceFilter, setSourceFilter] = useState<'all' | 'gallery' | 'local'>(
42+
'all',
43+
);
4244
const [tagFilter, setTagFilter] = useState<string>('all');
4345

4446
const tasks = useMemo(() => {
4547
const localGallery: any[] = localGalleryResp?.data ?? [];
4648
const remoteGallery: any[] = remoteGalleryResp?.data ?? [];
4749

48-
const localGalleryMapped = localGallery.map((g: any) => ({
49-
id: `local:${g.subdir || g.id || g.name}`,
50-
title: g.name || g.title || g.task_name || 'Task',
51-
description: g.description || '',
52-
_isLocal: true,
53-
_subdir: g.subdir,
54-
_tag: g.tag || 'OTHER',
55-
}));
56-
57-
const remoteGalleryMapped = remoteGallery.map((g: any) => ({
58-
id: `gallery:${g.subdir || g.id || g.name}`,
59-
title: g.name || g.title || g.task_name || 'Task',
60-
description: g.description || '',
61-
_isGallery: true,
62-
_subdir: g.subdir,
63-
_tag: g.tag || 'OTHER',
64-
}));
50+
const localGalleryMapped = localGallery.map((g: any) => ({
51+
id: `local:${g.subdir || g.id || g.name}`,
52+
title: g.name || g.title || g.task_name || 'Task',
53+
description: g.description || '',
54+
_isLocal: true,
55+
_subdir: g.subdir,
56+
_tag: g.tag || 'OTHER',
57+
}));
58+
59+
const remoteGalleryMapped = remoteGallery.map((g: any) => ({
60+
id: `gallery:${g.subdir || g.id || g.name}`,
61+
title: g.name || g.title || g.task_name || 'Task',
62+
description: g.description || '',
63+
_isGallery: true,
64+
_subdir: g.subdir,
65+
_tag: g.tag || 'OTHER',
66+
}));
6567

6668
return [...localGalleryMapped, ...remoteGalleryMapped, ...overlayTasks];
6769
}, [localGalleryResp, remoteGalleryResp, overlayTasks]);
@@ -132,7 +134,11 @@ export default function TaskLibrary() {
132134

133135
const handleImportFromLocal = async (subdir: string) => {
134136
try {
135-
const url = chatAPI.getAPIFullPath('tasks', ['importFromLocalGallery'], {});
137+
const url = chatAPI.getAPIFullPath(
138+
'tasks',
139+
['importFromLocalGallery'],
140+
{},
141+
);
136142
const form = new URLSearchParams();
137143
form.set('subdir', subdir);
138144
// experimentId optional; if available in context add it
@@ -191,7 +197,8 @@ export default function TaskLibrary() {
191197
const handleSave = (savedTask: any) => {
192198
setOverlayTasks((prev) => {
193199
const exists = prev.some((t) => t.id === savedTask.id);
194-
if (exists) return prev.map((t) => (t.id === savedTask.id ? savedTask : t));
200+
if (exists)
201+
return prev.map((t) => (t.id === savedTask.id ? savedTask : t));
195202
return [savedTask, ...prev];
196203
});
197204
setModalOpen(false);
@@ -293,7 +300,9 @@ export default function TaskLibrary() {
293300
<Typography level="body-sm" textColor="text.tertiary">
294301
{task.description}
295302
</Typography>
296-
<Box sx={{ mt: 0.5, display: 'flex', gap: 0.5, flexWrap: 'wrap' }}>
303+
<Box
304+
sx={{ mt: 0.5, display: 'flex', gap: 0.5, flexWrap: 'wrap' }}
305+
>
297306
{task._isLocal && (
298307
<Chip size="sm" color="success" variant="soft">
299308
Local
@@ -307,7 +316,13 @@ export default function TaskLibrary() {
307316
{task._tag && (
308317
<Chip
309318
size="sm"
310-
color={task._tag === 'TRAIN' ? 'warning' : task._tag === 'EVAL' ? 'info' : 'neutral'}
319+
color={
320+
task._tag === 'TRAIN'
321+
? 'warning'
322+
: task._tag === 'EVAL'
323+
? 'info'
324+
: 'neutral'
325+
}
311326
variant="soft"
312327
>
313328
{task._tag}
@@ -326,34 +341,38 @@ export default function TaskLibrary() {
326341
}}
327342
>
328343
{!task._isGallery && !task._isLocal && (
329-
<IconButton
330-
size="sm"
331-
variant="plain"
332-
color="neutral"
333-
aria-label={`Edit ${task.title}`}
334-
onClick={() => handleEdit(task.id)}
335-
>
336-
<Edit2 size={16} />
337-
</IconButton>
344+
<IconButton
345+
size="sm"
346+
variant="plain"
347+
color="neutral"
348+
aria-label={`Edit ${task.title}`}
349+
onClick={() => handleEdit(task.id)}
350+
>
351+
<Edit2 size={16} />
352+
</IconButton>
338353
)}
339354

340355
{!task._isGallery && !task._isLocal && (
341-
<IconButton
342-
size="sm"
343-
variant="plain"
344-
color="danger"
345-
aria-label={`Delete ${task.title}`}
346-
onClick={() => handleDelete(task.id)}
347-
>
348-
<Trash2 size={16} />
349-
</IconButton>
356+
<IconButton
357+
size="sm"
358+
variant="plain"
359+
color="danger"
360+
aria-label={`Delete ${task.title}`}
361+
onClick={() => handleDelete(task.id)}
362+
>
363+
<Trash2 size={16} />
364+
</IconButton>
350365
)}
351366

352367
{task._isGallery && (
353368
<Button
354369
size="sm"
355370
variant="outlined"
356-
onClick={() => handleImportFromGallery(task._subdir || task.id.split(':')[1])}
371+
onClick={() =>
372+
handleImportFromGallery(
373+
task._subdir || task.id.split(':')[1],
374+
)
375+
}
357376
startDecorator={<FilePlus size={12} />}
358377
>
359378
Import
@@ -364,7 +383,9 @@ export default function TaskLibrary() {
364383
<Button
365384
size="sm"
366385
variant="outlined"
367-
onClick={() => handleImportFromLocal(task._subdir || task.id.split(':')[1])}
386+
onClick={() =>
387+
handleImportFromLocal(task._subdir || task.id.split(':')[1])
388+
}
368389
startDecorator={<FilePlus size={12} />}
369390
>
370391
Import

0 commit comments

Comments
 (0)