Skip to content

Commit 6f5d0d3

Browse files
authored
Merge pull request #173 from kwnt-dev/refactor/#172_loading-ui
refactor: ローディング表示の統一
2 parents 3a72fc9 + d3ae609 commit 6f5d0d3

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

app/admin/pdf-preview/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from "@/lib/pinSession";
1414
import { PinResponse } from "@/types/api";
1515
import { toast } from "sonner";
16+
import { Loading } from "@/components/ui/Loading";
1617

1718
const CARD_SIZE = 240;
1819

@@ -307,7 +308,7 @@ function PDFPreviewContent() {
307308

308309
export default function PDFPreviewPage() {
309310
return (
310-
<Suspense fallback={<div className="p-8">読み込み中...</div>}>
311+
<Suspense fallback={<Loading />}>
311312
<PDFPreviewContent />
312313
</Suspense>
313314
);

components/greens/GreenCanvas.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
ydToPx,
3333
} from "@/lib/greenCanvas.convert";
3434
import { useHoleData } from "@/hooks/useHoleData";
35+
import { Loading } from "@/components/ui/Loading";
3536

3637
interface Props {
3738
hole: string;
@@ -201,7 +202,7 @@ export default function GreenCanvas({
201202
}, []);
202203

203204
if (!holeData) {
204-
return <div>読み込み中...</div>;
205+
return <Loading />;
205206
}
206207

207208
const config = HOLE_CONFIGS[hole.padStart(2, "0")];

components/greens/GreenCardPDF.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ydToPx,
1515
} from "@/lib/greenCanvas.convert";
1616
import { useHoleData } from "@/hooks/useHoleData";
17+
import { Loading } from "@/components/ui/Loading";
1718

1819
interface Props {
1920
hole: string;
@@ -29,7 +30,7 @@ export default function GreenCardPDF({ hole, currentPin }: Props) {
2930
const holeData = useHoleData(hole);
3031

3132
if (!holeData) {
32-
return <div>読み込み中...</div>;
33+
return <Loading />;
3334
}
3435

3536
const scale = CARD_SIZE / CANVAS_SIZE;

components/greens/GreenCardPDFExport.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ydToPx,
1414
} from "@/lib/greenCanvas.convert";
1515
import { useHoleData } from "@/hooks/useHoleData";
16+
import { Loading } from "@/components/ui/Loading";
1617

1718
interface Props {
1819
hole: string;
@@ -52,7 +53,7 @@ export default function GreenCardPDFExport({
5253
const holeData = useHoleData(hole);
5354

5455
if (!holeData) {
55-
return <div>読み込み中...</div>;
56+
return <Loading />;
5657
}
5758

5859
const scale = width / CANVAS_SIZE;

components/ui/Loading.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function Loading() {
2+
return (
3+
<div className="flex items-center justify-center p-8 text-sm text-muted-foreground">
4+
読み込み中...
5+
</div>
6+
);
7+
}

0 commit comments

Comments
 (0)