Skip to content

Commit 5b3ce97

Browse files
committed
style: reformat
1 parent d4e3c22 commit 5b3ce97

1 file changed

Lines changed: 43 additions & 62 deletions

File tree

app/global-error.tsx

Lines changed: 43 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,10 @@
33
import { Logo } from "@/components/logo";
44
import { Badge } from "@/components/ui/badge";
55
import { Button } from "@/components/ui/button";
6-
import {
7-
Card,
8-
CardContent,
9-
CardDescription,
10-
CardFooter,
11-
CardHeader,
12-
CardTitle,
13-
} from "@/components/ui/card";
14-
import {
15-
ERROR_NOT_FOUND,
16-
ERROR_NOT_IMPLEMENTED,
17-
ERROR_UNAUTHORIZED,
18-
ERROR_USER_VERIFIED,
19-
} from "@/lib/apollo";
6+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
7+
import { ERROR_NOT_FOUND, ERROR_NOT_IMPLEMENTED, ERROR_UNAUTHORIZED, ERROR_USER_VERIFIED } from "@/lib/apollo";
208
import { CombinedGraphQLErrors, CombinedProtocolErrors } from "@apollo/client";
21-
import {
22-
AlertCircle,
23-
Code,
24-
Home,
25-
Lock,
26-
RefreshCw,
27-
Search,
28-
Shield,
29-
WifiOff,
30-
} from "lucide-react";
9+
import { AlertCircle, Code, Home, Lock, RefreshCw, Search, Shield, WifiOff } from "lucide-react";
3110
import Link from "next/link";
3211
import { useEffect } from "react";
3312

@@ -213,25 +192,25 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
213192
</div>
214193
)}
215194

216-
{error.errors &&
217-
error.errors.length > 0 && (
218-
<div>
219-
<Badge
220-
variant="destructive"
221-
className={`mb-1 text-xs`}
222-
>
223-
GraphQL Errors ({error.errors.length})
224-
</Badge>
225-
<pre
226-
className={`
195+
{error.errors
196+
&& error.errors.length > 0 && (
197+
<div>
198+
<Badge
199+
variant="destructive"
200+
className={`mb-1 text-xs`}
201+
>
202+
GraphQL Errors ({error.errors.length})
203+
</Badge>
204+
<pre
205+
className={`
227206
rounded bg-red-100 p-2 text-xs
228207
whitespace-pre-wrap
229208
`}
230-
>
209+
>
231210
{JSON.stringify(error.errors, null, 2)}
232-
</pre>
233-
</div>
234-
)}
211+
</pre>
212+
</div>
213+
)}
235214
</div>
236215
)}
237216
</div>
@@ -253,26 +232,28 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
253232
重試
254233
</Button>
255234

256-
{errorInfo.actionHref ? (
257-
<Button
258-
asChild
259-
variant="outline"
260-
className={`flex items-center gap-2`}
261-
>
262-
<Link href={errorInfo.actionHref}>前往處理</Link>
263-
</Button>
264-
) : (
265-
<Button
266-
asChild
267-
variant="outline"
268-
className={`flex items-center gap-2`}
269-
>
270-
<Link href="/">
271-
<Home className="size-4" />
272-
回到首頁
273-
</Link>
274-
</Button>
275-
)}
235+
{errorInfo.actionHref
236+
? (
237+
<Button
238+
asChild
239+
variant="outline"
240+
className={`flex items-center gap-2`}
241+
>
242+
<Link href={errorInfo.actionHref}>前往處理</Link>
243+
</Button>
244+
)
245+
: (
246+
<Button
247+
asChild
248+
variant="outline"
249+
className={`flex items-center gap-2`}
250+
>
251+
<Link href="/">
252+
<Home className="size-4" />
253+
回到首頁
254+
</Link>
255+
</Button>
256+
)}
276257
</div>
277258
</CardContent>
278259

@@ -289,9 +270,9 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
289270
timeZone: "Asia/Taipei",
290271
})}
291272
</p>
292-
{"digest" in error && error.digest && (
293-
<p className={`text-red-600`}>錯誤 ID:{error.digest}</p>
294-
)}
273+
{"digest" in error && error.digest && <p className={`
274+
text-red-600
275+
`}>錯誤 ID:{error.digest}</p>}
295276
</section>
296277
</CardFooter>
297278
</Card>

0 commit comments

Comments
 (0)