Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿšš merge develop #144

Merged
merged 19 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
77e7a5b
:bug: ํ† ํฐ ๊ด€๋ฆฌ ์žฌ์ •์˜
oaoong Nov 28, 2023
8967c71
Merge pull request #133 from team-nabi/NABI-355
oaoong Nov 28, 2023
bbe0278
:sparkles: ๋งˆ์ด๋„ˆํ•œ css ์ˆ˜์ •์‚ฌํ•ญ ๋ฐ˜์˜
oaoong Nov 28, 2023
4438059
Merge pull request #136 from team-nabi/NABI-357
oaoong Nov 29, 2023
be291ba
:sparkles: ๋ผ์šฐํŒ… ๋ฐ ์ปดํฌ๋„ŒํŠธ ์œ„์น˜ ์กฐ์ •
oaoong Nov 29, 2023
456a92f
:bug: viewport ์„ค์ • ์ ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฌธ์ œ
oaoong Nov 29, 2023
8fe3b38
:sparkles: ๋ Œ๋”๋ง ๋ฐ ํŒจ์น˜ ๋ฐฉ์‹ ๋ณ€๊ฒฝ
oaoong Nov 29, 2023
eb54c5e
:sparkles: expire ์‹œ๊ฐ„ ์ฝ”๋“œ ์ •๋ฆฌ
oaoong Nov 29, 2023
fc21bd9
:fire: ๋‚ด ๊ฑฐ๋ž˜๋‚ด์—ญ ์นธ ์‚ญ์ œ
oaoong Nov 29, 2023
b4203ec
Merge pull request #141 from team-nabi/NABI-366
oaoong Nov 29, 2023
f705d6f
:sparkles: ๋ถˆํ•„์š”ํ•œ ๋ฆฌํ„ด ์ •๋ฆฌ
oaoong Nov 29, 2023
ee3a078
Merge pull request #143 from team-nabi/NABI-356
oaoong Nov 29, 2023
421019b
:tada: ๊ฒ€์ƒ‰ ํ•„ํ„ฐ ๋ชจ๋‹ฌ UI ๋ฐ ๊ธฐ๋Šฅ ๋ณ€๊ฒฝ(์ผ๊ด„์ ์šฉ, ์ผ๊ด„ ์ดˆ๊ธฐํ™” ๋ฒ„ํŠผ ์ƒ์„ฑ) (#135)
doggopawer Nov 29, 2023
a582093
:tada: ๊ฐœ๋ณ„ ์•Œ๋ฆผ ์ฒ˜๋ฆฌ ๊ธฐ๋Šฅ ๊ตฌํ˜„ (#137)
doggopawer Nov 29, 2023
52b540e
:tada: ๋‚ด ์นด๋“œ ์ด๋ฏธ์ง€ ๋ˆ„๋ฅผ์‹œ, ๋ฌผ๊ฑด ์ƒ์„ธ ์ •๋ณด ํŽ˜์ด์ง€๋กœ ์ด๋™ ๊ธฐ๋Šฅ (#139)
doggopawer Nov 29, 2023
9286e7f
:bug: ๋ฆฌ์•กํŠธ ์ฟผ๋ฆฌ ์—…๋ฐ์ดํŠธ ์˜ค๋ฅ˜ ์ด์Šˆ (#140)
doggopawer Nov 29, 2023
c923a09
:tada: ๊ฐ ๋ฆฌ์ŠคํŠธ ์ปดํฌ๋„ŒํŠธ ์—๋Ÿฌ๋ฐ”์šด๋”๋ฆฌ ์ ์šฉ (#142)
doggopawer Nov 29, 2023
2d67526
:tada: 2์ฐจ QA ์Šคํƒ€์ผ ์ˆ˜์ • ์™„๋ฃŒ (#134)
juyeon-park Nov 29, 2023
c93af22
:tada: ๋ฆฌ๋‹ค์ด๋ž™ํŠธ ๋ฐ ๋ผ์šฐํŒ… ์ถ”๊ฐ€ + ๋ฒ„๊ทธ ์ˆ˜์ • (#138)
juyeon-park Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.11",
"react-hook-form": "^7.47.0",
"react-lottie-player": "^1.5.5",
"sharp": "^0.32.6",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions public/images/chevron-left-gray.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ const RouteCallback = ({ tokenResponse }: RouteCallbackProps) => {

useEffect(() => {
if (tokenResponse?.data) {
let inHour = new Date()
inHour.setHours(inHour.getHours() + 1)
Cookies.set(
Environment.tokenName(),
tokenResponse?.data?.token?.accessToken,
{
expires: 60 * 60 * 24 * 7,
expires: inHour,
},
)
window.location.href = AppPath.home()
Expand Down
30 changes: 10 additions & 20 deletions src/app/(root)/(routes)/(home)/components/CategorySection.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
'use client'

import Image from 'next/image'
import { useRouter } from 'next/navigation'
import Button from '@/components/ui/button'
import Link from 'next/link'
import AppPath from '@/config/appPath'
import { CATEGORY_BUTTON_LIST } from '@/constants/card'
import { TYPOGRAPHY } from '@/styles/sizes'

const CategorySection = () => {
const router = useRouter()

const handleClick = (name: string) => {
if (name === 'ALL_CARD') {
router.push(`${AppPath.cards()}`)
} else {
router.push(`${AppPath.cards()}?category=${name}`)
}
}
return (
<div className="grid items-center w-full grid-cols-5 gap-y-4">
{CATEGORY_BUTTON_LIST.map((v) => (
<Button
<Link
key={v.key}
variant={null}
size={'icon_md'}
className="flex flex-col gap-2 h-[61px] w-auto"
onClick={() => handleClick(v.key)}
className="flex flex-col gap-2 h-[61px] w-auto justify-center items-center"
href={
v.key === 'ALL_CARD'
? `${AppPath.cards()}`
: `${AppPath.cards()}?category=${v.key}`
}
>
<Image className="w-8 h-8" alt={'category-image'} src={v.image} />
<Image className="w-8 h-8" alt={`category-${v.key}`} src={v.image} />
<p className={` w-max ${TYPOGRAPHY.description}`}>{v.value}</p>
</Button>
</Link>
))}
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/app/(root)/(routes)/(home)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import PopularCardSection from './components/PopularCardSection'

function HomePage() {
return (
<main className="flex flex-col items-center min-h-screen gap-12 bg-background-color">
<main className="flex flex-col items-center min-h-screen gap-12 bg-background-color pb-8">
<BannerSection />
<CategorySection />
<PopularCardSection />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ProfileSection = ({ profileImg, userName }: ProfileSectionProps) => {
<Avatar size="md">
<AvatarImage imgUrl={profileImg} />
</Avatar>
<div className={`ml-9 ${TYPOGRAPHY.profile}`}>{userName}</div>
<div className={`ml-4 ${TYPOGRAPHY.profile}`}>{userName}</div>
</section>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
import koLocale from 'date-fns/locale/ko'
import { useRouter } from 'next/navigation'
import Badge from '@/components/ui/badge'
import AppPath from '@/config/appPath'
import { CATEGORY_OBJS, TRADE_STATUS_OBJS } from '@/constants/card'
import { useAuth } from '@/contexts/AuthProvider'
import { TYPOGRAPHY } from '@/styles/sizes'
import { CardDetail } from '@/types/card'
import { cn } from '@/utils'
import { getQueryParams } from '@/utils/getQueryParams'
import { getValueByKey } from '@/utils/getValueByKey'
import Dibs from './Dibs'
import MoreButton from './MoreButton'
Expand Down Expand Up @@ -36,6 +39,7 @@ const DescriptionSection = ({
}: DescriptionSectionProps) => {
const { isLoggedIn } = useAuth()
const { currentUser } = useAuth()
const router = useRouter()

const isMyItem = currentUser?.userId === authorId

Expand Down Expand Up @@ -68,7 +72,14 @@ const DescriptionSection = ({
TYPOGRAPHY.description,
)}
>
<u>{getValueByKey(CATEGORY_OBJS, category)}</u>
<u
className="cursor-pointer"
onClick={() =>
router.push(`${AppPath.cards()}?${getQueryParams({ category })}`)
}
>
{getValueByKey(CATEGORY_OBJS, category)}
</u>
</p>
<p className={cn('text-text-secondary-color', TYPOGRAPHY.description)}>
{formatDistanceToNow(new Date(createdAt), {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Suspense } from 'react'
import { useRouter } from 'next/navigation'
import Loading from '@/app/loading'
import SuggestCard from '@/components/domain/card/suggest-card'
import NoData from '@/components/domain/no-data'
import { Tabs, TabsTrigger, TabsList, TabsContent } from '@/components/ui/tabs'
Expand Down Expand Up @@ -51,19 +53,21 @@ const SuggestList = ({ pokeAvailable, toCardId }: SuggestListProps) => {
<TabsTrigger value="OFFER">์˜คํผํ•˜๊ธฐ</TabsTrigger>
<TabsTrigger value="POKE">์ฐ”๋Ÿฌ๋ณด๊ธฐ</TabsTrigger>
</TabsList>
{['OFFER', 'POKE'].map((type) => (
<TabsContent
key={type}
value={type}
className="flex flex-col data-[state=inactive]:hidden h-[402px] overflow-y-auto pr-2"
>
{!pokeAvailable && type === 'POKE' ? (
<PokeUnavailableInfo />
) : (
filterData(type)
)}
</TabsContent>
))}
<Suspense fallback={<Loading />}>
{['OFFER', 'POKE'].map((type) => (
<TabsContent
key={type}
value={type}
className="flex flex-col data-[state=inactive]:hidden h-[402px] overflow-y-auto pr-2"
>
{!pokeAvailable && type === 'POKE' ? (
<PokeUnavailableInfo />
) : (
filterData(type)
)}
</TabsContent>
))}
</Suspense>
</Tabs>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const TradeInfo = ({ title, content, variant, icon }: TradeInfoProps) => {
<Image src={icon} alt="infoImg" />
<div className="text-sm ml-2 font-normal">{title}</div>
<Badge size={'lg'} variant={variant} className="ml-auto">
{content}
{content === '' ? '๋ฏธ์ž…๋ ฅ' : content}
</Badge>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const CardModifyTemplate = ({ cardInfo, cardId }: CardModifyTemplateProps) => {
variant={'gradation'}
disabled={isSubmitting}
>
๋“ฑ๋กํ•˜๊ธฐ
์ˆ˜์ •ํ•˜๊ธฐ
</Button>
</div>
</section>
Expand Down
17 changes: 17 additions & 0 deletions src/app/(root)/(routes)/cards/[cardId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use client'

import Image from 'next/image'
import { useRouter } from 'next/navigation'
import Slider from '@/components/domain/slider'
import Button from '@/components/ui/button'
import Assets from '@/config/assets'
import { useAuth } from '@/contexts/AuthProvider'
import useCardInfoQuery from '@/hooks/api/queries/useCardInfoQuery'
import ProfileSection from './components/ProfileSection'
Expand All @@ -15,13 +19,26 @@ type CardPageProps = {

const CardPage = ({ params }: CardPageProps) => {
const { isLoggedIn } = useAuth()
const router = useRouter()
const { data } = useCardInfoQuery(Number(params.cardId), isLoggedIn)
const cardData = data?.data

return (
<main className="flex-col min-h-screen bg-background-color">
{cardData && (
<>
<Button
className="absolute top-[66px] z-10"
variant={null}
size={'icon'}
onClick={() => router.back()}
>
<Image
className="w-10 h-10"
alt={'arrow-button'}
src={Assets.chevronLeftGray}
/>
</Button>
<Slider
imageData={cardData.cardInfo.images}
imageAspectRatio="square"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client'

import { useEffect, useRef } from 'react'
import { ErrorBoundary } from 'react-error-boundary'
import { useSearchParams } from 'next/navigation'
import ExceptionBoundary from '@/components/domain/exception-boundary'
import { useCardsQuery } from '@/hooks/api/queries/useCardsQuery'
Expand All @@ -13,27 +14,33 @@ const CardListContent = () => {
const searchParams = useSearchParams()

// TODO: ํ˜„์žฌ API ๋ช…์„ธ์— status์— ์–ด๋–ค ๊ฐ’์„ ์ค˜์•ผํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ์ •์˜๊ฐ€ ๋˜์–ด ์žˆ์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ์ž„์‹œ๋กœ ์ƒ์ˆ˜ ๊ฐ’์„ ์ „๋‹ฌํ•จ => ์ถ”ํ›„์— ์‹ค์ œ ๋™์ž‘ ๊ฐ’์œผ๋กœ ๊ณ ์น˜๊ธฐ
const { data, fetchNextPage, isError, isFetchingNextPage, isLoading } =
useCardsQuery({
category:
(searchParams.get('category') as CategoryObjs['key']) || undefined,
priceRange:
(searchParams.get('priceRange') as PriceRangeObjs['key']) || undefined,
cardTitle: searchParams.get('cardTitle' as string) || '',
})
const {
data,
fetchNextPage,
isError,
isFetchingNextPage,
isLoading,
hasNextPage,
} = useCardsQuery({
category:
(searchParams.get('category') as CategoryObjs['key']) || undefined,
priceRange:
(searchParams.get('priceRange') as PriceRangeObjs['key']) || undefined,
cardTitle: searchParams.get('cardTitle' as string) || '',
})

const lastElementRef = useRef<HTMLDivElement | null>(null)
const entry = useIntersectionObserver(lastElementRef, { threshold: 1.0 })

useEffect(() => {
if (isFetchingNextPage) {
if (isFetchingNextPage || !hasNextPage) {
return
}

if (entry?.isIntersecting) {
fetchNextPage()
}
}, [entry?.isIntersecting, fetchNextPage, isFetchingNextPage])
}, [entry?.isIntersecting, fetchNextPage, isFetchingNextPage, hasNextPage])

// TODO: ์•„์ดํ…œ์ด ์—†์„์‹œ ์–ด๋–ค UI๋ฅผ ๋ณด์—ฌ์ค„์ง€ ์ฐจํ›„์— ๊ฒฐ์ •

Expand All @@ -48,7 +55,9 @@ const CardListContent = () => {
isEmpty={isEmpty}
isFetchingNextPage={isFetchingNextPage}
>
<CardList />
<ErrorBoundary fallback={<div>๋ Œ๋”๋ง ์ค‘ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.</div>}>
<CardList />
</ErrorBoundary>
</ExceptionBoundary>
<div ref={lastElementRef} />
</>
Expand Down
Loading