Skip to content
This repository was archived by the owner on May 4, 2024. It is now read-only.

Commit 9718ec5

Browse files
authored
auth 모킹 및 스타일 수정 (#14)
* feat: add top loader * chore: add auth mocking * fix: main page styles
1 parent 7ad06d9 commit 9718ec5

File tree

8 files changed

+52
-8
lines changed

8 files changed

+52
-8
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"scripts": {
66
"dev": "next dev",
7-
"dev:mock": "concurrently --kill-others \"NEXT_PUBLIC_API_MOCKING=enable next dev\" \"pnpx tsx watch ./src/mocks/http.ts\"",
7+
"dev:mock": "NEXT_PUBLIC_API_MOCKING=enable next dev",
88
"build": "next build",
99
"start": "next start",
1010
"lint": "next lint",
@@ -26,6 +26,7 @@
2626
"clsx": "^2.1.0",
2727
"next": "14.1.0",
2828
"next-auth": "^4.24.6",
29+
"nextjs-toploader": "^1.6.6",
2930
"pg": "^8.11.3",
3031
"react": "^18.2.0",
3132
"react-dom": "^18.2.0",

pnpm-lock.yaml

+26-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/activities/features/AddButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function AddButton({
4242
<AddIcon />
4343
</Button>
4444
</PopoverTrigger>
45-
<PopoverContent>
45+
<PopoverContent avoidCollisions={false}>
4646
<Form {...form}>
4747
<form
4848
action={async (formData) => {

src/app/activities/features/DateController.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Button } from "~/components/ui/button";
55
import { Input } from "~/components/ui/input";
66
import Link from "next/link";
77
import { useRouter } from "next/navigation";
8+
import { cn } from "~/lib/utils";
9+
import { isAndroid } from "~/constants/ua";
810

911
export default function DateController({ date }: { date: Date }) {
1012
const router = useRouter();
@@ -30,6 +32,7 @@ export default function DateController({ date }: { date: Date }) {
3032
type="date"
3133
value={time(date)}
3234
onChange={(e) => router.push(`?date=${e.currentTarget.value}`)}
35+
className={cn(isAndroid() && "appearance-none")}
3336
/>
3437
</div>
3538
<Link href={`/?date=${tomorrow}`}>

src/app/layout.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { Metadata } from "next";
2+
import NextTopLoader from "nextjs-toploader";
23
import "./globals.css";
34
import QueryClientProvider from "~/lib/QueryClientProvider";
45

@@ -16,6 +17,7 @@ export default function RootLayout({
1617
<html lang="kr">
1718
<body>
1819
<main>
20+
<NextTopLoader showSpinner={false} />
1921
<QueryClientProvider>{children}</QueryClientProvider>
2022
</main>
2123
</body>

src/app/loading.tsx

-3
This file was deleted.

src/constants/ua.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const isAndroid = () => {
2+
if (typeof window !== "undefined") {
3+
return /android/i.test(window.navigator.userAgent);
4+
}
5+
};

src/lib/auth.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import PostgresAdapter from "@auth/pg-adapter";
1010
import { Pool } from "pg";
1111
import { Adapter } from "next-auth/adapters";
1212

13-
import { DB, GOOGLE } from "~/constants/env";
13+
import { DB, GOOGLE, IS_API_MOCKING } from "~/constants/env";
1414
import { redirect } from "next/navigation";
1515
import { SIGNIN } from "~/constants/route";
1616

@@ -63,6 +63,18 @@ export async function auth(
6363
) {
6464
const session = await getServerSession(...args, config);
6565

66+
if (IS_API_MOCKING) {
67+
return {
68+
user: {
69+
name: "Byonghun Lee",
70+
email: "dlqud19@gmail.com",
71+
image:
72+
"https://lh3.googleusercontent.com/a/ACg8ocK2wO1MZUvKiFPQFO_f99Ryekp_w4I1BPqO8Ardj8Fl=s96-c",
73+
id: "3",
74+
},
75+
};
76+
}
77+
6678
if (!session) {
6779
redirect(SIGNIN);
6880
}

0 commit comments

Comments
 (0)