Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#252/bug-avatar-image
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns authored Dec 3, 2023
2 parents afd851c + f7dfa00 commit 52f5548
Show file tree
Hide file tree
Showing 38 changed files with 470 additions and 216 deletions.
5 changes: 5 additions & 0 deletions src/app/(routes)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import Login from '@/components/Login/Login'
import { Metadata } from 'next'

export const metadata: Metadata = {
title: '로그인',
}

const LoginPage = () => {
return (
Expand Down
27 changes: 6 additions & 21 deletions src/app/(routes)/notification/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
'use client'
import { NotificationController } from '@/components'
import { Metadata } from 'next'

import Tab from '@/components/common/Tab/Tab'
import TabItem from '@/components/common/Tab/TabItem'
import useTab from '@/components/common/Tab/hooks/useTab'
export const metadata: Metadata = {
title: '알림',
}

const NotificationLayout = ({ children }: { children: React.ReactNode }) => {
const { currentTab, tabList } = useTab({ type: 'notification' })

return (
<>
<Tab>
{tabList.map((tabItem) => (
<TabItem
active={currentTab === tabItem.content}
text={tabItem.text}
dest={tabItem.dest}
key={tabItem.content}
/>
))}
</Tab>
<div className="p-4">{children}</div>
</>
)
return <NotificationController>{children}</NotificationController>
}

export default NotificationLayout
3 changes: 2 additions & 1 deletion src/app/(routes)/notification/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { NONE_NOTIFICATION_RESULT } from '@/components/common/NotificationList/constants'
import { SEACH_MODAL_INFO } from '@/components/common/SearchModal/constants'

const NotificationPage = () => {
return (
Expand All @@ -19,7 +20,7 @@ const NotificationPage = () => {
/>
))} */}
<div className="py-5 text-center text-sm font-medium text-gray9">
{NONE_NOTIFICATION_RESULT}
{SEACH_MODAL_INFO}
</div>
</div>
)
Expand Down
5 changes: 5 additions & 0 deletions src/app/(routes)/register/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import UserInfoForm from '@/components/UserInfoForm/UserInfoForm'
import { Metadata } from 'next'

export const metadata: Metadata = {
title: '회원가입',
}

const RegisterPage = () => {
return (
Expand Down
84 changes: 18 additions & 66 deletions src/app/(routes)/search/page.tsx
Original file line number Diff line number Diff line change
@@ -1,72 +1,24 @@
'use client'
import { SearchController } from '@/components'
import { Metadata } from 'next'

import { CategoryList, Dropdown, SpaceList } from '@/components'
import UserList from '@/components/UserList/UserList'
import { useCategoryParam, useSortParam } from '@/hooks'
import { fetchSearchSpaces } from '@/services/space/spaces'
import { fetchSearchUsers } from '@/services/user/search/search'
import { cls } from '@/utils'
import { useSearchParams } from 'next/navigation'
type SearchPageProps = {
searchParams: { [key: string]: string | string[] | undefined }
}

const SearchPage = () => {
const searchParams = useSearchParams()
const keyword = searchParams.get('keyword')
const target = searchParams.get('target')
const { sort, sortIndex, handleSortChange } = useSortParam('space')
const { category, categoryIndex, handleCategoryChange } =
useCategoryParam('all')
export async function generateMetadata({
searchParams,
}: SearchPageProps): Promise<Metadata> {
const { target, keyword } = searchParams

return (
<>
<div className="sticky top-[53px] z-40 bg-bgColor">
<div
className={cls(
'flex items-center px-4',
target === 'space' ? 'pt-4' : 'py-4',
)}>
<h2 className="grow overflow-hidden text-ellipsis whitespace-nowrap pr-2 font-bold text-gray9">
&apos;{keyword}&apos; 에 대한{' '}
{target === 'space' ? '스페이스' : target === 'user' ? '유저' : ''}{' '}
검색 결과
</h2>
{target === 'space' && (
<div className="shrink-0">
<Dropdown
type="space"
placement="right"
defaultIndex={sortIndex}
onChange={handleSortChange}
/>
</div>
)}
</div>
{target === 'space' && (
<CategoryList
type="all"
defaultIndex={categoryIndex}
onChange={handleCategoryChange}
/>
)}
</div>
<section className="flex flex-col gap-y-2 px-4">
{target === 'space' && (
<SpaceList
queryKey="search"
sort={sort ?? ''}
category={category ?? ''}
keyword={keyword ?? ''}
fetchFn={fetchSearchSpaces}
/>
)}
{target === 'user' && (
<UserList
keyword={keyword ?? ''}
fetchFn={fetchSearchUsers}
/>
)}
</section>
</>
)
return {
title: `'${keyword ?? ''}' ${
target === 'space' ? '스페이스' : target === 'user' ? '유저' : ''
} 검색 결과`,
}
}

const SearchPage = () => {
return <SearchController />
}

export default SearchPage
29 changes: 29 additions & 0 deletions src/app/(routes)/space/[spaceId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { fetchGetSpace } from '@/services/space/space'
import { Metadata } from 'next'

type SpaceLayoutProps = {
params: { spaceId: number }
}

export async function generateMetadata({
params,
}: SpaceLayoutProps): Promise<Metadata> {
const spaceId = params.spaceId
const space = await fetchGetSpace({ spaceId })

return {
title: space.spaceName,
description: space.description,
openGraph: {
title: `${space.spaceName} • LinkHub`,
description: space.description,
images: space.spaceImagePath,
},
}
}

const layout = ({ children }: { children: React.ReactNode }) => {
return children
}

export default layout
5 changes: 5 additions & 0 deletions src/app/(routes)/space/create/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import SpaceForm from '@/components/Space/SpaceForm'
import { Metadata } from 'next'

export const metadata: Metadata = {
title: '스페이스 생성',
}

const SpaceCreatePage = () => {
return (
Expand Down
50 changes: 19 additions & 31 deletions src/app/(routes)/user/[userId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
'use client'
import { UserController } from '@/components'
import { fetchGetUserProfile } from '@/services/user/profile/profile'
import { Metadata } from 'next'

import React from 'react'
import { Spinner } from '@/components'
import Tab from '@/components/common/Tab/Tab'
import TabItem from '@/components/common/Tab/TabItem'
import useTab from '@/components/common/Tab/hooks/useTab'
import useGetProfile from '@/hooks/useGetProfile'
type Props = {
params: { userId: number }
}

const UserLayout = ({ children }: { children: React.ReactNode }) => {
const { user, myId, isProfileLoading } = useGetProfile()
const { currentTab, tabList } = useTab({
type: 'user',
userId: user?.memberId,
myId,
})
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const userId = params.userId
const user = await fetchGetUserProfile({ memberId: userId })

return (
<>
{!isProfileLoading && (
<Tab>
{tabList.map((tabItem) => (
<TabItem
active={currentTab === tabItem.content}
text={tabItem.text}
dest={tabItem.dest}
key={tabItem.content}
/>
))}
</Tab>
)}
{children}
</>
)
return {
title: user.nickname,
openGraph: {
title: `${user.nickname} • LinkHub`,
},
}
}

const UserLayout = ({ children }: { children: React.ReactNode }) => {
return <UserController>{children}</UserController>
}

export default UserLayout
21 changes: 6 additions & 15 deletions src/app/(routes)/user/setting/page.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
'use client'
import { SettingController } from '@/components'
import { Metadata } from 'next'

import UserInfoForm from '@/components/UserInfoForm/UserInfoForm'
import { useCurrentUser } from '@/hooks/useCurrentUser'
export const metadata: Metadata = {
title: '프로필 수정',
}

const UserSettingPage = () => {
const { currentUser } = useCurrentUser()

return (
<div>
{currentUser && (
<UserInfoForm
userData={currentUser}
formType="Setting"
/>
)}
</div>
)
return <SettingController />
}

export default UserSettingPage
Binary file modified src/app/favicon.ico
Binary file not shown.
8 changes: 8 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,11 @@
max-width: 436px;
max-height: 25%;
}

.category-swiper {
padding: 16px !important;
}

.category-swiper .swiper-slide {
width: auto;
}
19 changes: 15 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ import type { Metadata } from 'next'
import './globals.css'

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
title: {
template: '%s • LinkHub',
default: 'LinkHub',
},
description: '링크 아카이빙 및 공유 플랫폼',
openGraph: {
title: 'LinkHub',
description: '링크 아카이빙 및 공유 플랫폼',
url: 'https://link-hub.site',
siteName: 'LinkHub',
locale: 'ko_KR',
type: 'website',
},
}

export default function RootLayout({
Expand All @@ -21,7 +32,7 @@ export default function RootLayout({
<head>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, user-scalable=no"
content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1.0"
/>
</head>
<TanstackQueryContext>
Expand All @@ -34,8 +45,8 @@ export default function RootLayout({
<Header />
<main className="pt-[53px]">{children}</main>
</div>
<ToastContainer />
</Providers>
<ToastContainer />
</body>
</AuthProvider>
</TanstackQueryContext>
Expand Down
Binary file added src/app/opengraph-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/app/twitter-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ const Login = () => {
router.replace('/')
} else if (searchParams.get('socialId')) {
Cookies.set('Social-Id', searchParams.get('socialId') || '', {
expires: 1 / 144,
expires: 1 / 288,
})
Cookies.set('Provider', searchParams.get('provider') || '', {
expires: 1 / 144,
expires: 1 / 288,
})
router.replace('/register')
}
Expand Down
27 changes: 27 additions & 0 deletions src/components/NotificationController/NotificationController.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use client'

import Tab from '@/components/common/Tab/Tab'
import TabItem from '@/components/common/Tab/TabItem'
import useTab from '@/components/common/Tab/hooks/useTab'

const NotificationLayout = ({ children }: { children: React.ReactNode }) => {
const { currentTab, tabList } = useTab({ type: 'notification' })

return (
<>
<Tab>
{tabList.map((tabItem) => (
<TabItem
active={currentTab === tabItem.content}
text={tabItem.text}
dest={tabItem.dest}
key={tabItem.content}
/>
))}
</Tab>
<div className="p-4">{children}</div>
</>
)
}

export default NotificationLayout
Loading

0 comments on commit 52f5548

Please sign in to comment.