-
Notifications
You must be signed in to change notification settings - Fork 1
πAPI & β¨Feat : μ΄λ²€νΈ νμ΄μ§ api μ°κ²° #123
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
Changes from 20 commits
b001f51
dc661e4
aa595f2
2ad0b18
ac01835
b1fe18a
cc14c8e
a1badcd
118f98c
0ae7073
921aa3f
99bab3f
e97ecf6
2119aa6
0969058
13eed95
7359e55
389e160
e730c25
b2de4d1
5c8cf5d
bc38265
2a5017a
0d34fb2
c46fc31
6098283
1b116df
7a954e9
27e232b
dc6070d
fcbaee2
cdc4f5c
a28d795
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,37 @@ | ||
| 'use client'; | ||
|
|
||
| import { useEffect } from 'react'; | ||
| import { Header, EventCard } from '@/shared/components'; | ||
| import DateTag from '@/pages/events/components/DateTag'; | ||
| import { cn } from '@/shared/lib'; | ||
| import { eventData } from '@/shared/constants/events/eventsData'; | ||
| import Image from 'next/image'; | ||
| import { useRouter } from 'next/router'; | ||
| import { useEventDetail } from '@/shared/hooks/events/useEventDetail'; | ||
| import { buildNextEventList } from '@/shared/utils/buildNextEventList'; | ||
|
|
||
| const EventDetailPage = () => { | ||
| const router = useRouter(); | ||
| const { id } = router.query; | ||
|
|
||
| const event = eventData.find((e) => e.id === Number(id)); | ||
| if (!event) return null; | ||
| const eventId = Number(id); | ||
| const { data: eventDetail, isLoading, isError } = useEventDetail(eventId); | ||
|
|
||
| useEffect(() => { | ||
| if (!isLoading && (isError || !eventDetail)) { | ||
| router.replace('/events'); | ||
| } | ||
| }, [isLoading, isError, eventDetail, router]); | ||
|
|
||
| if (!eventId) return null; | ||
| if (isError || !eventDetail) return null; | ||
|
|
||
| const { title, body, address, startDate, endDate, imageUrl, nextEvents } = | ||
| eventDetail; | ||
|
|
||
| const { name, address, description, startDate, endDate, imageSrc } = event; | ||
| const nextList = buildNextEventList(nextEvents); | ||
|
|
||
| return ( | ||
| <div | ||
| className={cn( | ||
| 'relative w-full min-h-[100vh] overflow-auto', | ||
| )} | ||
| > | ||
| return ( | ||
| <div className={cn('relative w-full min-h-[100vh] overflow-auto')}> | ||
| <Header | ||
| title='νμ¬λͺ ' | ||
| onClick={() => router.back()} | ||
|
|
@@ -29,85 +41,89 @@ const EventDetailPage = () => { | |
| <main | ||
| className={cn( | ||
| 'flex flex-col items-center justify-start', | ||
| 'px-[2.4rem] pt-[calc(10rem+1.4rem)]' | ||
| 'px-[2.4rem] pt-[calc(10rem+1.4rem)]', | ||
| )} | ||
| > | ||
| {/* νμ¬ κΈ°κ° */} | ||
| <div aria-label="νμ¬ κΈ°κ°" className={cn('flex justify-center w-[18.4rem] mt-[1.3rem]')}> | ||
| <DateTag startDate={startDate} endDate={endDate} /> | ||
| <div | ||
| aria-label='νμ¬ κΈ°κ°' | ||
| className={cn('flex justify-center w-[18.4rem] mt-[1.3rem]')} | ||
| > | ||
| <DateTag startDate={startDate!} endDate={endDate!} /> | ||
KongMezu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </div> | ||
|
|
||
| {/* λν μ΄λ―Έμ§ */} | ||
| <section | ||
| aria-label="νμ¬ λν μ΄λ―Έμ§" | ||
| aria-label='νμ¬ λν μ΄λ―Έμ§' | ||
| className={cn( | ||
| 'relative w-full flex justify-center max-w-[35.4rem]', | ||
| 'mt-[1rem]' | ||
| 'relative w-full flex justify-center max-w-[35.4rem] h-[43rem]', | ||
| 'mt-[1rem]', | ||
| )} | ||
| > | ||
| {imageSrc ? ( | ||
| {imageUrl ? ( | ||
| <Image | ||
| src={imageSrc} | ||
| alt={`${name} μ΄λ―Έμ§`} | ||
| width={354} | ||
| height={430} | ||
| className={cn('w-full h-auto object-cover rounded-[2rem]')} | ||
| src={imageUrl} | ||
| alt={`${title} μ΄λ―Έμ§`} | ||
| fill | ||
| className={cn('object-cover rounded-[2rem]')} | ||
| /> | ||
| ) : ( | ||
| <div | ||
| className={cn('w-full h-[43.6rem] bg-gray-200 rounded-[2rem]')} | ||
| role="img" | ||
| className={cn('w-full h-full bg-gray-200 rounded-[2rem]')} | ||
| role='img' | ||
| aria-label={`${name} μ΄λ―Έμ§κ° μ 곡λμ§ μμ΅λλ€.`} | ||
| /> | ||
| )} | ||
| </section> | ||
|
|
||
| {/* νμ¬ μΉ΄λ */} | ||
| <div | ||
| aria-label="νμ¬ μ 보" | ||
| aria-label='νμ¬ μ 보' | ||
| className={cn( | ||
| 'flex flex-col items-center w-full gap-[0.8rem]', | ||
| 'mt-[0.8rem]' | ||
| 'mt-[0.8rem]', | ||
| )} | ||
| > | ||
| <EventCard | ||
| name={name} | ||
| address={address} | ||
| description={description} | ||
| eventId={eventId} | ||
| name={title} | ||
| address={address ?? ''} | ||
| description={body ?? ''} | ||
| variant='gray' | ||
| size='large' | ||
| imageSrc={imageUrl ?? ''} | ||
| liked={eventDetail.isBookmarked ?? false} | ||
| /> | ||
|
|
||
| {/* κ΄λ ¨ νμ¬ */} | ||
| <div | ||
| aria-label="κ΄λ ¨ νμ¬ λͺ©λ‘" | ||
| aria-label='κ΄λ ¨ νμ¬ λͺ©λ‘' | ||
| className={cn( | ||
| 'grid grid-cols-2 gap-[1.2rem] justify-items-center w-full max-w-[35.4rem]' | ||
| 'grid grid-cols-2 gap-[1.2rem] justify-items-center w-full max-w-[35.4rem]', | ||
| )} | ||
| > | ||
| <div className={cn('w-[17rem]')}> | ||
| <EventCard | ||
| name='κ΄λ ¨ νμ¬' | ||
| address='' | ||
| description='' | ||
| variant='gray' | ||
| size='small' | ||
| /> | ||
| </div> | ||
| <div className={cn('w-[17rem]')}> | ||
| <EventCard | ||
| name='κ΄λ ¨ νμ¬' | ||
| address='' | ||
| description='' | ||
| variant='gray' | ||
| size='small' | ||
| /> | ||
| </div> | ||
| {nextList.map((item, idx) => ( | ||
| <div key={idx} className={cn('w-[17rem]')}> | ||
| {item.isEmpty ? ( | ||
| <div className='w-[17rem] h-[8rem] bg-gray-200 rounded-[1rem]' /> | ||
| ) : ( | ||
| <EventCard | ||
| eventId={item.eventId} | ||
| name={item.title} | ||
| address='' | ||
| description='' | ||
| imageSrc={item.imageUrl} | ||
| variant='gray' | ||
| size='small' | ||
| liked={false} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π§© Analysis chainκ΄λ ¨ νμ¬μ λΆλ§ν¬ μν νμΈμ΄ νμν©λλ€. κ΄λ ¨ νμ¬μ νμ¬ π Script executed: #!/bin/bash
# RelatedEvent νμ
μ μ νμΈ
ast-grep --pattern $'interface RelatedEvent {
$$$
}'Length of output: 259 π Script executed: #!/bin/bash
# Check the actual code context around line 123 in [id].tsx
sed -n '115,130p' src/pages/events/[id].tsxLength of output: 445 π Script executed: #!/bin/bash
# Search for RelatedEvent component usage and bookmark-related props
rg -n "liked\s*=" src/pages/events/[id].tsx -A 2 -B 2Length of output: 313 π Script executed: #!/bin/bash
# Check if there's an Event type with bookmark state that should be mapped to RelatedEvent
rg -n "interface Event|type Event" src/shared/types/ -A 10Length of output: 1937
κ²μ¦ κ²°κ³Ό:
νμν μμ :
μ΄λ PR λͺ©νμΈ "λΆλ§ν¬ UI λκΈ°ν νμΈ (todo)"λ₯Ό μλ£νλ λ° νμμ λλ€. π€ Prompt for AI Agents |
||
| /> | ||
| )} | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| </main> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default EventDetailPage; | ||
| export default EventDetailPage; | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,18 +1,28 @@ | ||||||||||
| import { useEffect } from 'react'; | ||||||||||
| import { Header, EventCard, AddressCopy } from '@/shared/components'; | ||||||||||
| import DateTag from '@/pages/events/components/DateTag'; | ||||||||||
| import { cn } from '@/shared/lib'; | ||||||||||
| import { eventData } from '@/shared/constants/events/eventsData'; | ||||||||||
| import Image from 'next/image'; | ||||||||||
| import { useRouter } from 'next/router'; | ||||||||||
| import { useEventDetail } from '@/shared/hooks/events/useEventDetail'; | ||||||||||
|
|
||||||||||
| const EventSavePage = () => { | ||||||||||
| const router = useRouter(); | ||||||||||
| const { id } = router.query; | ||||||||||
|
|
||||||||||
| const event = eventData.find((e) => e.id === Number(id)); | ||||||||||
| if (!event) return null; | ||||||||||
| const eventId = Number(id); | ||||||||||
| const { data: eventDetail, isLoading, isError } = useEventDetail(eventId); | ||||||||||
|
|
||||||||||
| const { name, address, description, startDate, endDate, imageSrc } = event; | ||||||||||
| useEffect(() => { | ||||||||||
| if (!isLoading && (isError || !eventDetail)) { | ||||||||||
| router.replace('/mypage'); | ||||||||||
| } | ||||||||||
| }, [isLoading, isError, eventDetail, router]); | ||||||||||
KongMezu marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
|
|
||||||||||
| if (!eventId) return null; | ||||||||||
| if (isError || !eventDetail) return null; | ||||||||||
|
|
||||||||||
| const { title, body, address, startDate, endDate, imageUrl } = eventDetail; | ||||||||||
|
|
||||||||||
| return ( | ||||||||||
| <div className={cn('relative w-full min-h-[100vh] overflow-auto')}> | ||||||||||
|
|
@@ -23,8 +33,8 @@ const EventSavePage = () => { | |||||||||
| /> | ||||||||||
|
|
||||||||||
| <main | ||||||||||
| role="main" | ||||||||||
| aria-label="μ μ₯ν νμ¬ μμΈ νμ΄μ§" | ||||||||||
| role='main' | ||||||||||
| aria-label='μ μ₯ν νμ¬ μμΈ νμ΄μ§' | ||||||||||
| className={cn( | ||||||||||
| 'flex flex-col items-center justify-start', | ||||||||||
| 'px-[2.4rem] pt-[calc(10rem+1.4rem)]', | ||||||||||
|
|
@@ -42,17 +52,18 @@ const EventSavePage = () => { | |||||||||
| 'mt-[1rem]', | ||||||||||
| )} | ||||||||||
| > | ||||||||||
| {imageSrc ? ( | ||||||||||
| {imageUrl ? ( | ||||||||||
| <Image | ||||||||||
| src={imageSrc} | ||||||||||
| alt={`${name} μ΄λ―Έμ§`} | ||||||||||
| width={354} | ||||||||||
| height={430} | ||||||||||
| className={cn('w-full h-auto object-cover rounded-[2rem]')} | ||||||||||
| src={imageUrl} | ||||||||||
| alt={`${title} μ΄λ―Έμ§`} | ||||||||||
| fill | ||||||||||
| className={cn('object-cover rounded-[2rem]')} | ||||||||||
| /> | ||||||||||
| ) : ( | ||||||||||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
| <div | ||||||||||
| className={cn('w-full h-[43.6rem] bg-gray-200 rounded-[2rem]')} | ||||||||||
| className={cn('w-full h-full bg-gray-200 rounded-[2rem]')} | ||||||||||
| role='img' | ||||||||||
| aria-label={`${name} μ΄λ―Έμ§κ° μ 곡λμ§ μμ΅λλ€.`} | ||||||||||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| /> | ||||||||||
| )} | ||||||||||
| </section> | ||||||||||
|
|
@@ -64,16 +75,18 @@ const EventSavePage = () => { | |||||||||
| 'mt-[0.8rem]', | ||||||||||
| )} | ||||||||||
| > | ||||||||||
| <EventCard | ||||||||||
| name={name} | ||||||||||
| address={address} | ||||||||||
| description={description} | ||||||||||
| variant='gray' | ||||||||||
| size='large' | ||||||||||
| <EventCard | ||||||||||
| eventId={eventId} | ||||||||||
| name={title} | ||||||||||
| address={address ?? ''} | ||||||||||
| description={body ?? ''} | ||||||||||
| variant="gray" | ||||||||||
| size="large" | ||||||||||
| imageSrc={imageUrl ?? ''} | ||||||||||
| liked={eventDetail.isBookmarked ?? true} | ||||||||||
|
||||||||||
| liked={eventDetail.isBookmarked ?? true} | |
| liked={true} // μ μ₯ν νμ¬ νμ΄μ§μ΄λ―λ‘ νμ λΆλ§ν¬λ¨ |
| liked={eventDetail.isBookmarked ?? true} | |
| liked={eventDetail.isBookmarked ?? false} |
π€ Prompt for AI Agents
In src/pages/mypage/events/[id].tsx around line 86, the expression
`liked={eventDetail.isBookmarked ?? true}` uses a nullish fallback of true which
will incorrectly mark items as bookmarked when `isBookmarked` is undefined;
change this to either a fixed true if this page should always show bookmarked
items, or use a safe fallback of false (`eventDetail.isBookmarked ?? false`) if
you want unconfirmed values to be treated as not bookmarked, or simply pass the
raw API value (`liked={eventDetail.isBookmarked}`) if you trust the response.
Uh oh!
There was an error while loading. Please reload this page.