= {
- SIX_MONTHS_ELEMENTARY_SCHOOL: ,
- SIX_MONTHS_MIDDLE_AND_HIGH_SCHOOL: ,
- SIX_MONTHS_UNIVERSITY: ,
- SIX_MONTHS_WORK: ,
- SIX_MONTHS_SOCIAL: ,
- SIX_MONTHS_ETC: ,
- ONE_YEAR_ELEMENTARY_SCHOOL: ,
- ONE_YEAR_MIDDLE_AND_HIGH_SCHOOL: ,
- ONE_YEAR_UNIVERSITY: ,
- ONE_YEAR_WORK: ,
- ONE_YEAR_SOCIAL: ,
- ONE_YEAR_ETC: ,
- FOUR_YEARS_ELEMENTARY_SCHOOL: ,
- FOUR_YEARS_MIDDLE_AND_HIGH_SCHOOL: ,
- FOUR_YEARS_UNIVERSITY: ,
- FOUR_YEARS_WORK: ,
- FOUR_YEARS_SOCIAL: ,
- FOUR_YEARS_ETC: ,
- INFINITE_ELEMENTARY_SCHOOL: ,
- INFINITE_WORK: ,
- INFINITE_SOCIAL: ,
- INFINITE_ETC: ,
- INFINITE_MIDDLE_AND_HIGH_SCHOOL: ,
- INFINITE_UNIVERSITY: ,
-}
diff --git a/page.d.ts b/page.d.ts
index 0695f54..7d6a3d6 100644
--- a/page.d.ts
+++ b/page.d.ts
@@ -1,5 +1,5 @@
-import { NextPage } from 'next'
import { ComponentType, ReactElement, ReactNode } from 'react'
+import { NextPage } from 'next'
export type Page = NextPage
& {
getLayout?: (page: ReactElement) => ReactNode
diff --git a/pages/404.tsx b/pages/404.tsx
index 04101ff..957ce9d 100644
--- a/pages/404.tsx
+++ b/pages/404.tsx
@@ -1,8 +1,8 @@
-import { Button } from '@/components/ui'
-import BaseLayout from '@/layout/base-layout'
-import { cn } from '@/lib/client/utils'
import React, { ReactNode } from 'react'
import { useRouter } from 'next/router'
+import { cn } from '@/lib/client/utils'
+import BaseLayout from '@/layout/base-layout'
+import { Button } from '@/components/ui'
const Pages = () => {
const router = useRouter()
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 57c5c8a..eea513e 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,33 +1,38 @@
-import { AUTH } from '@/constants'
-import { UnauthorizedError } from '@/error'
-import CalcMobileHeight from '@/contexts/calc-mobile-height'
-import BaseLayout from '@/layout/base-layout'
-import { Session, Token } from '@/lib/auth'
-import { NamuiApi } from '@/lib/namui-api'
+import { useRef, ReactElement, ReactNode, useEffect, useState } from 'react'
+import { NextPage } from 'next'
+import type { AppContext, AppInitialProps, AppProps } from 'next/app'
+import App from 'next/app'
+import Image from 'next/image'
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+import { useSearchParams } from 'next/navigation'
+import '@/styles/global.css'
import {
SessionProvider,
SessionContextType,
} from '@/provider/session-provider'
-import '@/styles/global.css'
+
+import { HydrationBoundary } from '@tanstack/react-query'
import { parse, serialize } from 'cookie'
-import { NextPage } from 'next'
-import type { AppContext, AppInitialProps, AppProps } from 'next/app'
-import App from 'next/app'
-import { useRef, ReactElement, ReactNode, useEffect, useState } from 'react'
import { Toaster } from 'react-hot-toast'
-import { useRouter } from 'next/router'
-import { useSearchParams } from 'next/navigation'
-import { useBrowserLayoutEffect } from '@/lib/client/utils'
+
+import { UnauthorizedError } from '@/error'
import QueryProvider from '@/contexts/query-provider'
-import { HydrationBoundary } from '@tanstack/react-query'
-import MetaHead from '@/components/meta-head'
+import { WikiProvider } from '@/contexts/wiki-provider'
+import CalcMobileHeight from '@/contexts/calc-mobile-height'
+
+import BaseLayout from '@/layout/base-layout'
+import { Session, Token } from '@/lib/auth'
+import { NamuiApi } from '@/lib/namui-api'
import { toastError } from '@/lib/client/alert'
+import { useBrowserLayoutEffect } from '@/lib/client/utils'
+
+import { AUTH } from '@/constants'
+
+import MetaHead from '@/components/meta-head'
import ErrorBoundary from '@/components/error-boundary'
import { Logo } from '@/components/ui'
-
import icons from '@/assets/icons'
-import Image from 'next/image'
-import Link from 'next/link'
export type NextPageWithLayout
= NextPage
& {
getLayout?: (page: ReactElement) => ReactNode
@@ -103,131 +108,133 @@ export default function NamuiWikiApp({
NamuiApi.setToken(newSession?.token?.accessToken)
}}
>
-
-
-
-
-
-
-
- 남이 쓰는 나의 소개서
-
-
-
+
+
+
+
+
+
+
+
+ 남이 쓰는 나의 소개서
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+ Copyright {new Date().getFullYear()}. GRRREW. All rights
+ reserved.
+
-
-
-
-
-
-
-
-
-
-
- Copyright {new Date().getFullYear()}. GRRREW. All rights
- reserved.
-
+
+ {getLayout()}
-
-
- {getLayout()}
-
-
-
-
-
- {mounted && (
-
+
+
- error: {
+ {mounted && (
+
- )}
-
+ }}
+ />
+ )}
+
+
)
}
diff --git a/pages/answers/index.tsx b/pages/answers/index.tsx
index 46cde0d..c28d205 100644
--- a/pages/answers/index.tsx
+++ b/pages/answers/index.tsx
@@ -1,16 +1,17 @@
import { ReactNode, useContext, useMemo, useRef } from 'react'
+import { GetServerSideProps } from 'next'
+import { useRouter } from 'next/router'
+import { useQuery } from '@tanstack/react-query'
+import { AnimatePresence, motion } from 'framer-motion'
import withAuth from '@/layout/HOC/with-auth'
import FormLayout from '@/layout/form-layout'
-import AnswerDetail from '@/components/compositions/answers/answer-detail'
-import { useRouter } from 'next/router'
import { useSession } from '@/provider/session-provider'
-import { AnimatePresence, motion } from 'framer-motion'
-import { RelationBadge, PeriodBadge } from '@/components/badge'
-import { useQuery } from '@tanstack/react-query'
+
import { Survey, getSurveyByIdQuery } from '@/queries/surveys'
-import { GetServerSideProps } from 'next'
import { fadeInProps } from '@/variants'
-import { TreeType, treeCardAsset } from '@/model/tree.entity'
+import { CardType, treeCardAsset } from '@/model/card.entity'
+import AnswerDetail from '@/components/compositions/answers/answer-detail'
+import { RelationBadge, PeriodBadge } from '@/components/badge'
import {
QS_NAMES,
ShareImageContext,
@@ -18,6 +19,7 @@ import {
ShareImageProvider,
} from '@/components/share-image'
import { parseShareCardItems } from '@/components/share-image/constants'
+
const Pages = ({ surveyId }: { surveyId: string }) => {
const { data: { data: survey } = {}, isLoading } = useQuery(
getSurveyByIdQuery(surveyId),
@@ -30,7 +32,7 @@ const Pages = ({ surveyId }: { surveyId: string }) => {
return `${parsedCreatedAt.getFullYear()}.${parsedCreatedAt.getMonth() + 1}.${parsedCreatedAt.getDate()}`
}, [survey])
- const treeType = useRef(new TreeType(treeCardAsset)).current
+ const treeType = useRef(new CardType(treeCardAsset)).current
const bgColor = (survey: Survey) => {
switch (survey.relation) {
diff --git a/pages/api/auth/[provider].ts b/pages/api/auth/[provider].ts
index 61b6829..6fc53d5 100644
--- a/pages/api/auth/[provider].ts
+++ b/pages/api/auth/[provider].ts
@@ -1,4 +1,5 @@
-import { AUTH } from '@/constants'
+import type { NextApiRequest, NextApiResponse } from 'next'
+import { parse, serialize } from 'cookie'
import {
BadRequestError,
InternalServerError,
@@ -7,8 +8,8 @@ import {
} from '@/error'
import { Provider } from '@/lib/auth'
import withHandler from '@/lib/server/with-handler'
-import { parse, serialize } from 'cookie'
-import type { NextApiRequest, NextApiResponse } from 'next'
+
+import { AUTH } from '@/constants'
async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
diff --git a/pages/api/auth/access.ts b/pages/api/auth/access.ts
index 58dafa0..7768804 100644
--- a/pages/api/auth/access.ts
+++ b/pages/api/auth/access.ts
@@ -1,7 +1,8 @@
-import { UnauthorizedError, isNamuiError } from '@/error'
-import withHandler from '@/lib/server/with-handler'
import type { NextApiRequest, NextApiResponse } from 'next'
import * as z from 'zod'
+import { UnauthorizedError, isNamuiError } from '@/error'
+import withHandler from '@/lib/server/with-handler'
+
const token = z.object({
accessToken: z.string().min(1),
refreshToken: z.string().min(1),
diff --git a/pages/api/auth/refresh.ts b/pages/api/auth/refresh.ts
index db20abc..644bc51 100644
--- a/pages/api/auth/refresh.ts
+++ b/pages/api/auth/refresh.ts
@@ -1,10 +1,12 @@
+import type { NextApiRequest, NextApiResponse } from 'next'
+import { serialize } from 'cookie'
+import * as z from 'zod'
+
import { AUTH } from '@/constants'
import { UnauthorizedError, isNamuiError } from '@/error'
import { serverURL } from '@/lib/server/utils'
import withHandler from '@/lib/server/with-handler'
-import { serialize } from 'cookie'
-import type { NextApiRequest, NextApiResponse } from 'next'
-import * as z from 'zod'
+
const token = z.object({
accessToken: z.string().min(1),
refreshToken: z.string().min(1),
diff --git a/pages/api/auth/signout.ts b/pages/api/auth/signout.ts
index 8117b67..0bf4f3e 100644
--- a/pages/api/auth/signout.ts
+++ b/pages/api/auth/signout.ts
@@ -1,7 +1,8 @@
+import { NextApiRequest, NextApiResponse } from 'next'
+import { serialize } from 'cookie'
import { AUTH } from '@/constants'
import withHandler from '@/lib/server/with-handler'
-import { serialize } from 'cookie'
-import { NextApiRequest, NextApiResponse } from 'next'
+
const EXPIRED_TOKEN_KEY_LIST = [
AUTH.OAUTH_TOKEN,
AUTH.OAUTH_PROVIDER,
diff --git a/pages/api/auth/signup.ts b/pages/api/auth/signup.ts
index 1b2a53b..b501d4a 100644
--- a/pages/api/auth/signup.ts
+++ b/pages/api/auth/signup.ts
@@ -1,10 +1,11 @@
-import { AUTH } from '@/constants'
+import type { NextApiRequest, NextApiResponse } from 'next'
+import { serialize } from 'cookie'
+
import { BadRequestError } from '@/error'
import { withError } from '@/lib/server/utils'
-
import withHandler from '@/lib/server/with-handler'
-import { serialize } from 'cookie'
-import type { NextApiRequest, NextApiResponse } from 'next'
+
+import { AUTH } from '@/constants'
async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
diff --git a/pages/api/init.ts b/pages/api/init.ts
index f1e3162..26db345 100644
--- a/pages/api/init.ts
+++ b/pages/api/init.ts
@@ -1,7 +1,7 @@
+import type { NextApiRequest, NextApiResponse } from 'next'
+import { serialize } from 'cookie'
import { withError } from '@/lib/server/utils'
import withHandler from '@/lib/server/with-handler'
-import { serialize } from 'cookie'
-import type { NextApiRequest, NextApiResponse } from 'next'
async function handler(_: NextApiRequest, res: NextApiResponse) {
try {
diff --git a/pages/csrf/index.tsx b/pages/csrf/index.tsx
index 3e6d0ce..1e9cf09 100644
--- a/pages/csrf/index.tsx
+++ b/pages/csrf/index.tsx
@@ -1,10 +1,10 @@
-import Loading from '@/components/situations/loading'
-import { AUTH } from '@/constants'
-import BaseLayout from '@/layout/base-layout'
-import { useBrowserLayoutEffect } from '@/lib/client/utils'
+import React, { ReactNode } from 'react'
import { GetServerSideProps } from 'next'
import { useRouter } from 'next/router'
-import React, { ReactNode } from 'react'
+import BaseLayout from '@/layout/base-layout'
+import { useBrowserLayoutEffect } from '@/lib/client/utils'
+import { AUTH } from '@/constants'
+import Loading from '@/components/situations/loading'
/**
*
* @param {csrfCallbackUrl} 요청 화면으로 되돌아 가기 전 선행되어야 하는 화면 주소
diff --git a/pages/dashboard-2/index.tsx b/pages/dashboard-2/index.tsx
index ecaaec4..35cdfa1 100644
--- a/pages/dashboard-2/index.tsx
+++ b/pages/dashboard-2/index.tsx
@@ -1,13 +1,12 @@
import { ReactNode, createContext, useRef, useState } from 'react'
-import { cn } from '@/lib/client/utils'
+import { useRouter } from 'next/router'
import { GetServerSideProps } from 'next'
-
+import { cn } from '@/lib/client/utils'
import BaseLayout from '@/layout/base-layout'
-
-import { FilterProvider } from '@/hooks/use-filter'
import withAuth from '@/layout/HOC/with-auth'
+import { FilterProvider } from '@/hooks/use-filter'
+
import DetailDrawer from '@/components/dashboard-container/detail-drawer'
-import { useRouter } from 'next/router'
import { ShareImageDrawer, ShareImageProvider } from '@/components/share-image'
export const DetailQsContext = createContext<{
diff --git a/pages/dashboard/index.tsx b/pages/dashboard/index.tsx
index 8b47c3b..adc1473 100644
--- a/pages/dashboard/index.tsx
+++ b/pages/dashboard/index.tsx
@@ -1,28 +1,28 @@
-import { ReactNode, createContext, useRef, useState } from 'react'
-import { cn, useBrowserLayoutEffect } from '@/lib/client/utils'
-import useScrollDirection from '@/hooks/use-scroll-direction'
-import { useSettingStore } from '@/stores/setting.store'
+import { ReactNode, createContext, useMemo, useRef, useState } from 'react'
import { GetServerSideProps } from 'next'
+import { StaticImageData } from 'next/image'
+import { useSearchParams } from 'next/navigation'
+import { useRouter } from 'next/router'
+import { useSettingStore } from '@/stores/setting.store'
+import { cn, useBrowserLayoutEffect } from '@/lib/client/utils'
+import { useSession } from '@/provider/session-provider'
import BaseLayout from '@/layout/base-layout'
-
-import { FilterProvider } from '@/hooks/use-filter'
import withAuth from '@/layout/HOC/with-auth'
+import { FilterProvider } from '@/hooks/use-filter'
+import useScrollDirection from '@/hooks/use-scroll-direction'
+
import DashboardContainer from '@/components/dashboard-container'
import DetailDrawer from '@/components/dashboard-container/detail-drawer'
-import { useRouter } from 'next/router'
+import ShareModal from '@/components/share-modal'
import { ShareImageDrawer, ShareImageProvider } from '@/components/share-image'
-import { useSearchParams } from 'next/navigation'
import { Button } from '@/components/ui'
-import { useSession } from '@/provider/session-provider'
import { SafeSvgTextInner } from '@/components/safe-svg-text-inner'
-import ShareModal from '@/components/share-modal'
import BarChart from '@/pages/assets/images/icons/barchart.png'
import PieChart from '@/pages/assets/images/icons/piechart.png'
import Gift from '@/pages/assets/images/icons/gift.png'
import Message from '@/pages/assets/images/icons/message.png'
-import { StaticImageData } from 'next/image'
interface Colors {
GRADIENT_FROM: string
@@ -31,9 +31,10 @@ interface Colors {
LETTER_COUNT_BOX: string
IMAGE_WIKI_DECO: StaticImageData
IMAGE_COUNT_DECO: StaticImageData
+ MAIN_COLOR: string
}
-const WIKI_COLORS: { [key in WikiType]: Colors } = {
+export const WIKI_COLORS: { [key in WikiType]: Colors } = {
NAMUI: {
GRADIENT_FROM: '#BFF1CF',
NAME_BOX: '#199EF0',
@@ -41,6 +42,7 @@ const WIKI_COLORS: { [key in WikiType]: Colors } = {
LETTER_COUNT_BOX: '#FFEB34',
IMAGE_COUNT_DECO: PieChart,
IMAGE_WIKI_DECO: BarChart,
+ MAIN_COLOR: '#00BE4F',
},
ROMANCE: {
GRADIENT_FROM: '#FFD4DA',
@@ -49,25 +51,22 @@ const WIKI_COLORS: { [key in WikiType]: Colors } = {
LETTER_COUNT_BOX: '#FFEB34',
IMAGE_WIKI_DECO: Gift,
IMAGE_COUNT_DECO: Message,
+ MAIN_COLOR: '#FF6460',
},
}
import { motion, useInView } from 'framer-motion'
import { PropswithWikiType, WikiType } from '@/types'
import { NamuiApi } from '@/lib/namui-api'
-import { useToggleTheme } from '@/hooks/use-toggle-theme'
+import { useToggletheme } from '@/contexts/wiki-provider'
+import { useQuery } from '@tanstack/react-query'
export const DetailQsContext = createContext<{
id: string
handle: (id: string) => void
}>({ id: '', handle: () => {} })
-const Page = ({
- wikiType,
- wikiCount,
-}: PropswithWikiType<{
- wikiCount: number
-}>) => {
+const Page = ({ wikiType }: PropswithWikiType) => {
const searchParams = useSearchParams()
const wiki = wikiType || (searchParams.get('wikiType') as WikiType)
const headerHeight = useSettingStore((state) => state.headerHeight)
@@ -78,7 +77,19 @@ const Page = ({
const { direction, scrollTop } = useScrollDirection({ ref })
const shouldShowHeader = scrollTop > headerHeight && direction === 'UP'
- useToggleTheme(wikiType)
+ const { data: wikis } = useQuery({
+ queryKey: ['wikis'],
+ queryFn: NamuiApi.getWikis,
+ })
+
+ const wikiCount = useMemo(
+ () =>
+ wikis?.data.wikiList.find((wiki) => wiki.wikiType === wikiType)
+ ?.answerCount || 0,
+ [wikiType, wikis],
+ )
+
+ useToggletheme(wikiType)
const handleQsId = (id: string) => {
setSelectedQsId(id)
@@ -145,12 +156,18 @@ export const getServerSideProps = (async (context) => {
}
//FIX: change to SSR && set auth in server runtime
- NamuiApi.setToken(context.req.cookies['accessToken'])
- const { data: wikis } = await NamuiApi.getWikis()
- const wikiCount =
- wikis.wikiList.find((wiki) => wiki.wikiType === wikiType)?.answerCount || 0
+ // NamuiApi.setToken(context.req.cookies['accessToken'])
+ // try {
+ // const { data: wikis } = await NamuiApi.getWikis()
+ // const wikiCount =
+ // wikis.wikiList.find((wiki) => wiki.wikiType === wikiType)?.answerCount ||
+ // 0
- return { props: { wikiType: wikiType.toUpperCase(), wikiCount } }
+ // return { props: { wikiType: wikiType.toUpperCase(), wikiCount } }
+ // } catch {
+ // return { props: { wikiType: wikiType.toUpperCase(), wikiCount: 0 } }
+ // }
+ return { props: { wikiType: wikiType.toUpperCase() } }
}) satisfies GetServerSideProps
function DashboardTitle({
diff --git a/pages/garden/index.tsx b/pages/garden/index.tsx
index 9b4223f..4f20693 100644
--- a/pages/garden/index.tsx
+++ b/pages/garden/index.tsx
@@ -1,22 +1,26 @@
import { ReactNode, useEffect, useMemo, useState } from 'react'
-import BaseLayout from '@/layout/base-layout'
-import withAuth from '@/layout/HOC/with-auth'
-import { Button } from '@/components/ui'
-import TreeCard from '@/components/compositions/tree-card'
+import { useRouter } from 'next/router'
+import { useSearchParams } from 'next/navigation'
+import Image from 'next/image'
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
-import { useIntersectionObserver } from '@/hooks/use-observer'
import { AnimatePresence } from 'framer-motion'
import { motion } from 'framer-motion'
+
+import BaseLayout from '@/layout/base-layout'
+import withAuth from '@/layout/HOC/with-auth'
+import { NamuiApi } from '@/lib/namui-api'
+import { cn } from '@/lib/client/utils'
+import { useToggletheme } from '@/contexts/wiki-provider'
+
+import { useIntersectionObserver } from '@/hooks/use-observer'
import { fadeInProps } from '@/variants'
+import { WikiType } from '@/types'
+
+import TreeCard from '@/components/compositions/tree-card'
import ShareModal from '@/components/share-modal'
import InfoIcon from '@/components/svgs/info-icon'
-import { useSearchParams } from 'next/navigation'
-import { useRouter } from 'next/router'
+import { Button } from '@/components/ui'
import backIcon from '@/assets/icons/back.svg'
-import Image from 'next/image'
-import { cn } from '@/lib/client/utils'
-import { WikiType } from '@/types'
-import { NamuiApi } from '@/lib/namui-api'
const Pages = () => {
const router = useRouter()
@@ -57,6 +61,8 @@ const Pages = () => {
fetchNextPage,
})
+ useToggletheme(wikiType)
+
const [showScrollButton, setShowScrollButton] = useState(false)
useEffect(() => {
diff --git a/pages/index.tsx b/pages/index.tsx
index ec827c5..c2cd343 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,13 +1,15 @@
+import { ReactNode, useEffect, useRef, useState } from 'react'
import { GetServerSideProps } from 'next'
-import { Button } from '@/components/ui'
-import { Logo } from '@/components/ui'
-import { useSession } from '@/provider/session-provider'
import { useRouter } from 'next/router'
+
+import { useSession } from '@/provider/session-provider'
+import { useBrowserLayoutEffect } from '@/lib/client/utils'
import BaseLayout from '@/layout/base-layout'
-import { ReactNode, useEffect, useRef, useState } from 'react'
import { useMount } from '@/hooks/use-mount'
-import { useBrowserLayoutEffect } from '@/lib/client/utils'
+
import MetaHead from '@/components/meta-head'
+import { Button } from '@/components/ui'
+import { Logo } from '@/components/ui'
const Page = () => {
const { signin, data } = useSession()
@@ -152,7 +154,7 @@ const Page = () => {
router.push('/main')
}}
>
- 내 정원가기
+ 시작하기
) : (