mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
change design and queries to api
This commit is contained in:
@@ -21,13 +21,6 @@ export function buildRowActions({ navigate, onArchive, onBan, onUnban }) {
|
||||
icon: <Eye className="h-3.5 w-3.5" />,
|
||||
onClick: (row) => navigate(`view/${row.user_id}`),
|
||||
},
|
||||
{
|
||||
key: "edit",
|
||||
label: "Edit Info",
|
||||
icon: <Pencil className="h-3.5 w-3.5" />,
|
||||
onClick: (row) => navigate(`edit/${row.user_id}`),
|
||||
disabled: (row) => row.role === "super_admin",
|
||||
},
|
||||
{
|
||||
key: "ban",
|
||||
label: "Ban User",
|
||||
|
||||
@@ -15,7 +15,6 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { ArrowLeft, ChevronRight, ChevronLeft, Check, FileText, ListChecks, ClipboardList, Link as LinkIcon, Clock } from 'lucide-react';
|
||||
import DeadlinePicker from '@/components/generic/DeadlinePicker';
|
||||
|
||||
@@ -47,7 +46,6 @@ export default function CreateTask() {
|
||||
name: '',
|
||||
description: '',
|
||||
deadline: '',
|
||||
is_required: true,
|
||||
requirements: [],
|
||||
prerequisite_task_ids: [],
|
||||
});
|
||||
@@ -109,7 +107,6 @@ export default function CreateTask() {
|
||||
name: form.name.trim(),
|
||||
description: form.description.trim() || null,
|
||||
deadline: form.deadline || null,
|
||||
is_required: form.is_required,
|
||||
// use result.data — it carries the schema's transforms (e.g. link_url scheme defaulting)
|
||||
// strip duration_seconds — it's only used for local validation
|
||||
requirements: result.data.requirements.map((r) => {
|
||||
@@ -214,19 +211,6 @@ export default function CreateTask() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-md border px-3 py-2.5">
|
||||
<div>
|
||||
<Label>Required</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Later tasks in this list stay locked until this one is complete. Turn off for optional tasks.
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={form.is_required}
|
||||
onCheckedChange={(v) => setForm({ ...form, is_required: v })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<Label>
|
||||
Prerequisite Tasks
|
||||
@@ -242,7 +226,7 @@ export default function CreateTask() {
|
||||
placeholder="Select tasks that must be completed first…"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
This task stays locked until every selected task is complete. Leave empty to use the default order-based lock instead.
|
||||
This task stays locked until every selected task is complete. Leave empty for no lock — the task is available immediately.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
@@ -13,7 +13,6 @@ import { Textarea } from '@/components/ui/textarea';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Switch } from '@/components/ui/switch';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import DeadlinePicker from '@/components/generic/DeadlinePicker';
|
||||
import {
|
||||
@@ -56,7 +55,6 @@ export default function EditTask() {
|
||||
description: data.description ?? '',
|
||||
deadline: data.deadline ?? '',
|
||||
status: data.status ?? 'pending',
|
||||
is_required: data.is_required ?? true,
|
||||
requirements: reqs,
|
||||
prerequisite_task_ids: (data.prerequisites ?? []).map((p) => p.task_id),
|
||||
});
|
||||
@@ -102,7 +100,6 @@ export default function EditTask() {
|
||||
description: form.description.trim() || null,
|
||||
deadline: form.deadline || null,
|
||||
status: form.status,
|
||||
is_required: form.is_required,
|
||||
requirements,
|
||||
prerequisite_task_ids: form.prerequisite_task_ids ?? [],
|
||||
});
|
||||
@@ -215,19 +212,6 @@ export default function EditTask() {
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-md border px-3 py-2.5">
|
||||
<div>
|
||||
<Label>Required</Label>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Later tasks in this list stay locked until this one is complete. Turn off for optional tasks.
|
||||
</p>
|
||||
</div>
|
||||
<Switch
|
||||
checked={!!form.is_required}
|
||||
onCheckedChange={(v) => setForm({ ...form, is_required: v })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<Label>
|
||||
Prerequisite Tasks
|
||||
@@ -243,7 +227,7 @@ export default function EditTask() {
|
||||
placeholder="Select tasks that must be completed first…"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
This task stays locked until every selected task is complete. Leave empty to use the default order-based lock instead.
|
||||
This task stays locked until every selected task is complete. Leave empty for no lock — the task is available immediately.
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
|
||||
Reference in New Issue
Block a user