Skip to content

Commit dbd4b43

Browse files
committed
style: reformat
1 parent 59f5242 commit dbd4b43

File tree

7 files changed

+282
-284
lines changed

7 files changed

+282
-284
lines changed

app/(admin)/(question-management)/database/_components/update.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,12 @@ function UpdateDatabaseDialogContent({
172172
});
173173

174174
return (
175-
<DialogContent className={`
176-
max-h-[85vh] overflow-y-auto
177-
sm:max-w-3xl
178-
`}>
175+
<DialogContent
176+
className={`
177+
max-h-[85vh] overflow-y-auto
178+
sm:max-w-3xl
179+
`}
180+
>
179181
<DialogHeader>
180182
<DialogTitle>編輯資料庫</DialogTitle>
181183
<DialogDescription>

app/(admin)/(question-management)/questions/_components/create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
DialogTitle,
1111
DialogTrigger,
1212
} from "@/components/ui/dialog";
13-
import { useDialogCloseConfirmation } from "@/hooks/use-dialog-close-confirmation";
1413
import { QuestionDifficulty } from "@/gql/graphql";
14+
import { useDialogCloseConfirmation } from "@/hooks/use-dialog-close-confirmation";
1515
import { useMutation, useSuspenseQuery } from "@apollo/client/react";
1616
import { useRouter } from "next/navigation";
1717
import { useState } from "react";

app/(admin)/(question-management)/questions/_components/update-form.tsx

Lines changed: 119 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface UpdateQuestionFormData {
2828
databaseID?: string; // Changed to single databaseID for 1-N relationship
2929
}
3030

31-
export interface UpdateQuestionFormProps extends Omit<UpdateFormBaseProps<z.infer<typeof formSchema>>, 'onSubmit'> {
31+
export interface UpdateQuestionFormProps extends Omit<UpdateFormBaseProps<z.infer<typeof formSchema>>, "onSubmit"> {
3232
onSubmit: (newValues: UpdateQuestionFormData) => void;
3333
databaseList: { id: string; slug: string; description?: string | null }[];
3434
}
@@ -76,130 +76,129 @@ export function UpdateQuestionForm({
7676
action={action}
7777
onFormStateChange={onFormStateChange}
7878
>
79-
<FormField
80-
control={form.control}
81-
name="title"
82-
render={({ field }) => (
83-
<FormItem>
84-
<FormLabel>題目標題</FormLabel>
85-
<FormControl>
86-
<Input {...field} placeholder="請輸入題目標題" />
87-
</FormControl>
88-
<FormMessage />
89-
</FormItem>
90-
)}
91-
/>
79+
<FormField
80+
control={form.control}
81+
name="title"
82+
render={({ field }) => (
83+
<FormItem>
84+
<FormLabel>題目標題</FormLabel>
85+
<FormControl>
86+
<Input {...field} placeholder="請輸入題目標題" />
87+
</FormControl>
88+
<FormMessage />
89+
</FormItem>
90+
)}
91+
/>
9292

93-
<FormField
94-
control={form.control}
95-
name="description"
96-
render={({ field }) => (
97-
<FormItem>
98-
<FormLabel>題目描述</FormLabel>
99-
<FormControl>
100-
<Textarea
101-
{...field}
102-
placeholder="請輸入詳細的題目描述"
103-
className="min-h-[100px]"
104-
/>
105-
</FormControl>
106-
<FormDescription>詳細說明題目要求和背景。</FormDescription>
107-
<FormMessage />
108-
</FormItem>
109-
)}
110-
/>
93+
<FormField
94+
control={form.control}
95+
name="description"
96+
render={({ field }) => (
97+
<FormItem>
98+
<FormLabel>題目描述</FormLabel>
99+
<FormControl>
100+
<Textarea
101+
{...field}
102+
placeholder="請輸入詳細的題目描述"
103+
className="min-h-[100px]"
104+
/>
105+
</FormControl>
106+
<FormDescription>詳細說明題目要求和背景。</FormDescription>
107+
<FormMessage />
108+
</FormItem>
109+
)}
110+
/>
111111

112-
<FormField
113-
control={form.control}
114-
name="category"
115-
render={({ field }) => (
116-
<FormItem>
117-
<FormLabel>分類</FormLabel>
118-
<FormControl>
119-
<Input {...field} placeholder="例如:query, join, aggregation" />
120-
</FormControl>
121-
<FormDescription>題目的分類標籤。</FormDescription>
122-
<FormMessage />
123-
</FormItem>
124-
)}
125-
/>
112+
<FormField
113+
control={form.control}
114+
name="category"
115+
render={({ field }) => (
116+
<FormItem>
117+
<FormLabel>分類</FormLabel>
118+
<FormControl>
119+
<Input {...field} placeholder="例如:query, join, aggregation" />
120+
</FormControl>
121+
<FormDescription>題目的分類標籤。</FormDescription>
122+
<FormMessage />
123+
</FormItem>
124+
)}
125+
/>
126126

127-
<FormField
128-
control={form.control}
129-
name="difficulty"
130-
render={({ field }) => (
131-
<FormItem>
132-
<FormLabel>難度</FormLabel>
133-
<FormControl>
134-
<Select
135-
onValueChange={field.onChange}
136-
defaultValue={field.value}
137-
>
138-
<SelectTrigger>
139-
<SelectValue placeholder="選擇難度" />
140-
</SelectTrigger>
141-
<SelectContent>
142-
{difficultyOptions.map((option) => (
143-
<SelectItem key={option.value} value={option.value}>
144-
{option.label}
145-
</SelectItem>
146-
))}
147-
</SelectContent>
148-
</Select>
149-
</FormControl>
150-
<FormMessage />
151-
</FormItem>
152-
)}
153-
/>
127+
<FormField
128+
control={form.control}
129+
name="difficulty"
130+
render={({ field }) => (
131+
<FormItem>
132+
<FormLabel>難度</FormLabel>
133+
<FormControl>
134+
<Select
135+
onValueChange={field.onChange}
136+
defaultValue={field.value}
137+
>
138+
<SelectTrigger>
139+
<SelectValue placeholder="選擇難度" />
140+
</SelectTrigger>
141+
<SelectContent>
142+
{difficultyOptions.map((option) => (
143+
<SelectItem key={option.value} value={option.value}>
144+
{option.label}
145+
</SelectItem>
146+
))}
147+
</SelectContent>
148+
</Select>
149+
</FormControl>
150+
<FormMessage />
151+
</FormItem>
152+
)}
153+
/>
154154

155-
<FormField
156-
control={form.control}
157-
name="referenceAnswer"
158-
render={({ field }) => (
159-
<FormItem>
160-
<FormLabel>參考答案</FormLabel>
161-
<FormControl>
162-
<Textarea
163-
{...field}
164-
placeholder="請輸入 SQL 參考答案"
165-
className="min-h-[120px] font-mono"
166-
/>
167-
</FormControl>
168-
<FormDescription>提供標準的 SQL 解答。</FormDescription>
169-
<FormMessage />
170-
</FormItem>
171-
)}
172-
/>
173-
174-
<FormField
175-
control={form.control}
176-
name="databaseID"
177-
render={({ field }) => (
178-
<FormItem>
179-
<FormLabel>資料庫</FormLabel>
180-
<FormControl>
181-
<Select
182-
onValueChange={field.onChange}
183-
defaultValue={field.value}
184-
>
185-
<SelectTrigger>
186-
<SelectValue placeholder="選擇資料庫" />
187-
</SelectTrigger>
188-
<SelectContent>
189-
{databaseList.map((database) => (
190-
<SelectItem key={database.id} value={database.id}>
191-
{database.slug}
192-
</SelectItem>
193-
))}
194-
</SelectContent>
195-
</Select>
196-
</FormControl>
197-
<FormDescription>選擇此題目所屬的資料庫(一個題目只能屬於一個資料庫)。</FormDescription>
198-
<FormMessage />
199-
</FormItem>
200-
)}
201-
/>
155+
<FormField
156+
control={form.control}
157+
name="referenceAnswer"
158+
render={({ field }) => (
159+
<FormItem>
160+
<FormLabel>參考答案</FormLabel>
161+
<FormControl>
162+
<Textarea
163+
{...field}
164+
placeholder="請輸入 SQL 參考答案"
165+
className="min-h-[120px] font-mono"
166+
/>
167+
</FormControl>
168+
<FormDescription>提供標準的 SQL 解答。</FormDescription>
169+
<FormMessage />
170+
</FormItem>
171+
)}
172+
/>
202173

174+
<FormField
175+
control={form.control}
176+
name="databaseID"
177+
render={({ field }) => (
178+
<FormItem>
179+
<FormLabel>資料庫</FormLabel>
180+
<FormControl>
181+
<Select
182+
onValueChange={field.onChange}
183+
defaultValue={field.value}
184+
>
185+
<SelectTrigger>
186+
<SelectValue placeholder="選擇資料庫" />
187+
</SelectTrigger>
188+
<SelectContent>
189+
{databaseList.map((database) => (
190+
<SelectItem key={database.id} value={database.id}>
191+
{database.slug}
192+
</SelectItem>
193+
))}
194+
</SelectContent>
195+
</Select>
196+
</FormControl>
197+
<FormDescription>選擇此題目所屬的資料庫(一個題目只能屬於一個資料庫)。</FormDescription>
198+
<FormMessage />
199+
</FormItem>
200+
)}
201+
/>
203202
</UpdateFormBody>
204203
);
205204
}

app/(admin)/(question-management)/questions/_components/update.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
DialogTrigger,
1212
} from "@/components/ui/dialog";
1313
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
14-
import { useDialogCloseConfirmation } from "@/hooks/use-dialog-close-confirmation";
1514
import { QuestionDifficulty } from "@/gql/graphql";
15+
import { useDialogCloseConfirmation } from "@/hooks/use-dialog-close-confirmation";
1616
import { skipToken, useMutation, useSuspenseQuery } from "@apollo/client/react";
1717
import { Pencil } from "lucide-react";
1818
import { useRouter } from "next/navigation";

0 commit comments

Comments
 (0)