-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
홈(모임 목록) 비즈니스 로직 및 API 연동 작업
- Loading branch information
Showing
19 changed files
with
240 additions
and
43 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
22 changes: 22 additions & 0 deletions
22
frontend/src/components/HomeMainContent/HomeMainContent.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,22 @@ | ||
import MoimList from '@_components/MoimList/MoimList'; | ||
import { MainPageTab } from '@_components/MoimTabBar/MoimTabBar'; | ||
import MyMoimList from '@_components/MyMoim/MyMoim'; | ||
import MyZzimMoimList from '@_components/MyZzimMoimList/MyZzimMoimList'; | ||
|
||
interface MoimMainContentProps { | ||
currentTab: MainPageTab; | ||
} | ||
|
||
export default function HomeMainContent(props: MoimMainContentProps) { | ||
const { currentTab } = props; | ||
|
||
if (currentTab === '모임목록') { | ||
return <MoimList />; | ||
} | ||
if (currentTab === '나의모임') { | ||
return <MyMoimList />; | ||
} | ||
if (currentTab === '찜한모임') { | ||
return <MyZzimMoimList />; | ||
} | ||
} |
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
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,12 @@ | ||
import MoimCardList from '@_components/MoimCardList/MoimCardList'; | ||
import useMoims from '@_hooks/queries/useMoims'; | ||
|
||
export default function MoimList() { | ||
const { moims, isLoading } = useMoims(); | ||
|
||
if (isLoading) { | ||
return <div>로딩중...</div>; | ||
} | ||
|
||
return moims && <MoimCardList moimInfos={moims} />; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import MoimCardList from '@_components/MoimCardList/MoimCardList'; | ||
import MyMoimListFilters, { | ||
Filter, | ||
} from '@_components/MyMoimListFilters/MyMoimListFilters'; | ||
import useMyMoims from '@_hooks/queries/useMyMoims'; | ||
import { Fragment, useState } from 'react'; | ||
|
||
export default function MyMoimList() { | ||
const [selectedFilter, setSelectedFilter] = useState<Filter['api']>('all'); | ||
|
||
const { myMoims, isLoading } = useMyMoims(selectedFilter); | ||
|
||
const handleFilterSelect = (filter: Filter['api']) => { | ||
setSelectedFilter(filter); | ||
}; | ||
|
||
if (isLoading) { | ||
return <div>로딩중...</div>; | ||
} | ||
|
||
return ( | ||
<Fragment> | ||
<MyMoimListFilters | ||
selectedFilter={selectedFilter} | ||
handleFilterSelect={handleFilterSelect} | ||
/> | ||
{myMoims && <MoimCardList moimInfos={myMoims} />} | ||
</Fragment> | ||
); | ||
} |
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
40 changes: 31 additions & 9 deletions
40
frontend/src/components/MyMoimListFilters/MyMoimListFilters.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
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,12 @@ | ||
import MoimCardList from '@_components/MoimCardList/MoimCardList'; | ||
import useMyZzimMoims from '@_hooks/queries/useMyZzimMoim'; | ||
|
||
export default function MyZzimMoimList() { | ||
const { myZzimMoims, isLoading } = useMyZzimMoims(); | ||
|
||
if (isLoading) { | ||
return <div>로딩중...</div>; | ||
} | ||
|
||
return myZzimMoims && <MoimCardList moimInfos={myZzimMoims} />; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getMyMoims } from '@_apis/gets'; | ||
import { Filter } from '@_components/MyMoimListFilters/MyMoimListFilters'; | ||
import QUERY_KEYS from '@_constants/queryKeys'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export default function useMyMoims(selectedFilter: Filter['api']) { | ||
const { data: myMoims, isLoading } = useQuery({ | ||
queryKey: [QUERY_KEYS.myMoims, selectedFilter], | ||
queryFn: () => getMyMoims(selectedFilter), | ||
}); | ||
|
||
return { myMoims, isLoading }; | ||
} |
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,12 @@ | ||
import { getMyZzimMoims } from '@_apis/gets'; | ||
import QUERY_KEYS from '@_constants/queryKeys'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
|
||
export default function useMyZzimMoims() { | ||
const { data: myZzimMoims, isLoading } = useQuery({ | ||
queryKey: [QUERY_KEYS.myZzimMoims], | ||
queryFn: getMyZzimMoims, | ||
}); | ||
|
||
return { myZzimMoims, isLoading }; | ||
} |
Oops, something went wrong.