-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,337 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,24 @@ | ||
'use client' | ||
|
||
import { QueryClientProvider } from '@tanstack/react-query' | ||
import React, { ReactNode } from 'react' | ||
|
||
import { queryClient } from '@/lib/HTTP/http' | ||
|
||
interface CommunityLayoutProps { | ||
children: React.ReactNode | ||
modal: React.ReactNode | ||
} | ||
|
||
const CommunityLayout = ({ children }: CommunityLayoutProps): ReactNode => { | ||
return <div className='mt-24'>{children}</div> | ||
const CommunityLayout = ({ children, modal }: CommunityLayoutProps): ReactNode => { | ||
return ( | ||
<div className='mt-24'> | ||
<QueryClientProvider client={queryClient}> | ||
{children} | ||
{modal} | ||
</QueryClientProvider> | ||
</div> | ||
) | ||
} | ||
|
||
export default CommunityLayout |
15 changes: 15 additions & 0 deletions
15
app/(route)/(header)/community/place/@modal/(.)detail/[placeId]/loading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import Loading from '@/components/common/Loading' | ||
|
||
interface LoadingPageProps {} | ||
|
||
const LoadingPage = ({}: LoadingPageProps): ReactNode => { | ||
return ( | ||
<div className='fixed inset-0 z-10 flex items-center justify-center bg-black bg-opacity-40'> | ||
<Loading size={40} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default LoadingPage |
41 changes: 41 additions & 0 deletions
41
app/(route)/(header)/community/place/@modal/(.)detail/[placeId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import PlaceDetail from '@/components/community/place/PlaceDetail' | ||
import { DetailPlace } from '@/components/community/place/placeType' | ||
|
||
interface CommunityPlaceDetailProps { | ||
params: { | ||
placeId: string | ||
} | ||
} | ||
|
||
const getPlace = async (placeId: string) => { | ||
try { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/place?placeId=${placeId}`) | ||
|
||
if (!res.ok) { | ||
const error = new Error('An error occurred while fetching places') | ||
error.message = await res.json() | ||
throw error | ||
} | ||
|
||
const data = await res.json() | ||
return data | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
const CommunityPlaceDetail = async ({ params }: CommunityPlaceDetailProps): Promise<ReactNode> => { | ||
const detailPlace: DetailPlace = await getPlace(params.placeId) | ||
|
||
return ( | ||
<div className='fixed inset-0 z-10 flex items-center justify-center bg-black bg-opacity-40'> | ||
<div className='relative flex h-4/5 w-3/5 min-w-[600px] flex-col rounded-[30px] border-[1px] border-black bg-white'> | ||
<PlaceDetail place={detailPlace} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CommunityPlaceDetail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Default() { | ||
return null | ||
} |
15 changes: 15 additions & 0 deletions
15
app/(route)/(header)/community/place/detail/[placeId]/loading.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import Loading from '@/components/common/Loading' | ||
|
||
interface LoadingPageProps {} | ||
|
||
const LoadingPage = ({}: LoadingPageProps): ReactNode => { | ||
return ( | ||
<div className='fixed inset-0 z-10 flex items-center justify-center bg-black bg-opacity-40'> | ||
<Loading size={40} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default LoadingPage |
41 changes: 41 additions & 0 deletions
41
app/(route)/(header)/community/place/detail/[placeId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import PlaceDetail from '@/components/community/place/PlaceDetail' | ||
import { DetailPlace } from '@/components/community/place/placeType' | ||
|
||
interface CommunityPlaceDetailProps { | ||
params: { | ||
placeId: string | ||
} | ||
} | ||
|
||
const getPlace = async (placeId: string) => { | ||
try { | ||
const res = await fetch(`${process.env.NEXT_PUBLIC_BACKEND_URL}/place?placeId=${placeId}`) | ||
|
||
if (!res.ok) { | ||
const error = new Error('An error occurred while fetching places') | ||
error.message = await res.json() | ||
throw error | ||
} | ||
|
||
const data = await res.json() | ||
return data | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
} | ||
|
||
const CommunityPlaceDetail = async ({ params }: CommunityPlaceDetailProps): Promise<ReactNode> => { | ||
const detailPlace: DetailPlace = await getPlace(params.placeId) | ||
|
||
return ( | ||
<div className='fixed inset-0 z-10 flex items-center justify-center bg-black bg-opacity-40'> | ||
<div className='relative flex h-4/5 w-3/5 min-w-[600px] flex-col rounded-[30px] border-[1px] border-black bg-white'> | ||
<PlaceDetail place={detailPlace} /> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CommunityPlaceDetail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
interface CommunityPlaceLayoutProps { | ||
children: React.ReactNode | ||
modal: React.ReactNode | ||
} | ||
|
||
const CommunityPlaceLayout = ({ children, modal }: CommunityPlaceLayoutProps): ReactNode => { | ||
return ( | ||
<div> | ||
{children} | ||
{modal} | ||
</div> | ||
) | ||
} | ||
|
||
export default CommunityPlaceLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import React, { ReactNode } from 'react' | ||
|
||
import LucideIcon from '@/lib/icons/LucideIcon' | ||
interface LoadingProps {} | ||
const Loading = ({}: LoadingProps): ReactNode => { | ||
return <LucideIcon name='LoaderCircle' className='animate-spin' size={16} /> | ||
interface LoadingProps { | ||
size?: number | ||
} | ||
const Loading = ({ size }: LoadingProps): ReactNode => { | ||
return <LucideIcon name='LoaderCircle' className='animate-spin' size={size || 16} /> | ||
} | ||
|
||
export default Loading |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import Image from 'next/image' | ||
import Link from 'next/link' | ||
import React, { ReactNode } from 'react' | ||
|
||
import { PLACE_DEFAULT_IMAGE } from '@/lib/constants/dummy_data' | ||
import LucideIcon from '@/lib/icons/LucideIcon' | ||
import { removeTagsAndParentheses } from '@/lib/utils/stringUtils' | ||
import BusanImg from '@/public/images/busan.jpg' | ||
|
||
import { CommunityPlace } from './placeType' | ||
|
||
interface PlaceCardProps { | ||
place: CommunityPlace | ||
commentsNum: number | ||
} | ||
|
||
const PlaceCard = ({ place, commentsNum }: PlaceCardProps): ReactNode => { | ||
return ( | ||
<Link | ||
href={`/community/place/detail/${place.placeId}`} | ||
scroll={false} | ||
className='block h-[95%] w-[90%] rounded-lg p-3 shadow-tb-shadow hover:scale-105 hover:cursor-pointer' | ||
> | ||
<Image | ||
src={place.imgSrc || PLACE_DEFAULT_IMAGE || BusanImg} | ||
alt='BusanImg' | ||
width={200} | ||
height={200} | ||
quality={100} | ||
className='mb-2 h-2/3 w-full rounded-lg' | ||
/> | ||
<div className='flex flex-col justify-between pl-2'> | ||
<h2 className='truncate text-lg font-medium'>{removeTagsAndParentheses(place.placeName)}</h2> | ||
<p># {place.category}</p> | ||
<div className='flex gap-3'> | ||
<div className='flex items-center gap-1'> | ||
<LucideIcon name='Star' fill='tbPrimary' strokeWidth={0} /> | ||
<p>{place.star}</p> | ||
</div> | ||
<div className='flex items-center gap-1'> | ||
<LucideIcon name='Bookmark' strokeWidth={3} /> | ||
<p>{place.scrapped || 0}</p> | ||
</div> | ||
<div className='flex items-center gap-1'> | ||
<LucideIcon name='MessageCircle' strokeWidth={3} /> | ||
<p>{commentsNum || 0}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</Link> | ||
) | ||
} | ||
|
||
export default PlaceCard |
Oops, something went wrong.