-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/#220 팀 페이지 내 미구현 기능 구현 #221
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
16ff6cd
feat(#220): 목표 리스트 API 및 useInfiniteScroll 구현
SugarSyrup ae3db22
feat(#220): Error / Loading 상태일때 UI 적용
SugarSyrup 7d38365
feat(#220): 반응형 적용
SugarSyrup 64fe48f
feat(#220): 팀 내 멤버 리스트영역에 Loading/Error/반응형 적용
SugarSyrup 940de87
feat(#220): 팀 내 멤버 리스트영역에 팀나가기 조건부 렌더링
SugarSyrup 7125829
feat(#220): Summary 반응형 / Loading / Error UI 구현
SugarSyrup cac8bc1
feat(#220): 모바일 UI 조정
SugarSyrup 7a7115c
feat(#220): 투두 리스트의 갯수를 잘못 가져오던 문제 해결
SugarSyrup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,42 @@ | ||
| "use client"; | ||
|
|
||
| import Button from "@/components/common/Button/Button"; | ||
| import { Icon } from "@/components/common/Icon"; | ||
|
|
||
| interface Props { | ||
| error: Error; | ||
| onReset: () => void; | ||
| } | ||
|
|
||
| export default function GoalListError({ error, onReset }: Props) { | ||
| return ( | ||
| <div className="flex w-full flex-col items-start gap-5 rounded-3xl bg-white p-6"> | ||
| <div className="flex w-full items-center justify-start gap-3"> | ||
| <Icon | ||
| name="FlagGreen" | ||
| size={40} | ||
| /> | ||
| <h2 className="typography-body-1 text-label-neutral font-medium"> | ||
| 목표 | ||
| </h2> | ||
| </div> | ||
|
|
||
| <div className="flex w-full flex-col items-center gap-2 rounded-2xl bg-gray-50 px-6 py-8"> | ||
| <p className="typography-body-2 text-label-strong font-semibold"> | ||
| 목표를 불러오지 못했어요 | ||
| </p> | ||
| <p className="typography-label-2 text-center text-gray-400"> | ||
| {error.message || "잠시 후 다시 시도해주세요."} | ||
| </p> | ||
| <Button | ||
| variant="secondary" | ||
| size="md" | ||
| className="mt-3" | ||
| onClick={onReset} | ||
| > | ||
| 다시 시도 | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,79 @@ | ||
| "use client"; | ||
|
|
||
| import { useMemo, useState } from "react"; | ||
|
|
||
| import { Icon } from "@/components/common/Icon"; | ||
| import { MainSecondaryProgressCard } from "@/components/team/MainSecondaryProgressCard"; | ||
| import { Order } from "@/components/todo/List/Order"; | ||
| import { goalQueries } from "@/features/goal/query/goal.queryKey"; | ||
| import { SortType } from "@/features/goal/types"; | ||
| import { useTeamId } from "@/features/team/hooks/useTeamId"; | ||
| import { useInfiniteScroll } from "@/hooks/useInfiniteScroll/useInfiniteScroll"; | ||
|
|
||
| const sortTypeByLabel: Record<string, SortType> = { | ||
| 최신순: "LATEST", | ||
| 오래된순: "OLDEST", | ||
| }; | ||
|
|
||
| export default function GoalList() { | ||
| const teamId = useTeamId(); | ||
| const sortOptions = ["최신순", "오래된순"]; | ||
| const [selectedSort, setSelectedSort] = useState("최신순"); | ||
| const sort = sortTypeByLabel[selectedSort] ?? "LATEST"; | ||
|
|
||
| const { ref, data } = useInfiniteScroll( | ||
| goalQueries.getTeamGoalListInfinite(teamId, sort), | ||
| ); | ||
|
|
||
| const size = data.pages[0].size; | ||
| const goalList = useMemo( | ||
| () => data.pages.flatMap((page) => page.items), | ||
| [data.pages], | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="flex w-full flex-col items-start gap-5"> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <div className="flex items-center justify-start gap-3"> | ||
| <Icon | ||
| name="FlagGreen" | ||
| size={40} | ||
| /> | ||
| <h2 className="typography-body-1 text-label-neutral font-medium"> | ||
| 목표 | ||
| </h2> | ||
| <span className="typography-body-1 ml-[-8px] font-medium text-gray-400"> | ||
| {size}개 | ||
| </span> | ||
| </div> | ||
|
|
||
| <Order | ||
| options={sortOptions} | ||
| selected={selectedSort} | ||
| onSelect={setSelectedSort} | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="max-h-[300px] w-full overflow-y-auto pr-1"> | ||
| <div className="tablet:grid-cols-2 desktop:grid-cols-3 grid w-full grid-cols-1 gap-4"> | ||
| {goalList.map((goal) => ( | ||
| <MainSecondaryProgressCard | ||
| teamId={teamId} | ||
| key={goal.goalId} | ||
| goalId={goal.goalId} | ||
| title={goal.name} | ||
| progress={goal.progressPercent} | ||
| color="green" | ||
| isFavorite={goal.isFavorite} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| <div | ||
| ref={ref} | ||
| className="h-1 w-full" | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,26 @@ | ||
| "use client"; | ||
|
|
||
| import { Icon } from "@/components/common/Icon"; | ||
| import Spinner from "@/components/common/Spinner"; | ||
|
|
||
| export default function GoalListLoading() { | ||
| return ( | ||
| <div className="flex w-full flex-col items-start gap-5"> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <div className="flex items-center justify-start gap-3"> | ||
| <Icon | ||
| name="FlagGreen" | ||
| size={40} | ||
| /> | ||
| <h2 className="typography-body-1 text-label-neutral font-medium"> | ||
| 목표 | ||
| </h2> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div className="flex h-[300px] w-full items-center justify-center"> | ||
| <Spinner size={40} /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,71 +1,8 @@ | ||
| "use client"; | ||
|
|
||
| import { useSuspenseQuery } from "@tanstack/react-query"; | ||
| import { useState } from "react"; | ||
|
|
||
| import { Icon } from "@/components/common/Icon"; | ||
| import { MainSecondaryProgressCard } from "@/components/team/MainSecondaryProgressCard"; | ||
| import { Order } from "@/components/todo/List/Order"; | ||
| import { goalQueries } from "@/features/goal/query/goal.queryKey"; | ||
| import { SortType } from "@/features/goal/types"; | ||
| import { useTeamId } from "@/features/team/hooks/useTeamId"; | ||
|
|
||
| const sortTypeByLabel: Record<string, SortType> = { | ||
| 최신순: "LATEST", | ||
| "마감일 순": "OLDEST", | ||
| }; | ||
|
|
||
| // @TODO: 목표 목록 조회 시 무한 스크롤 처리 (useSuspenseInfiniteQuery ) | ||
| export const GoalList = () => { | ||
| const teamId = useTeamId(); | ||
| const sortOptions = ["최신순", "마감일 순"]; | ||
| const [selectedSort, setSelectedSort] = useState("최신순"); | ||
|
|
||
| const { | ||
| data: { items: goalList }, | ||
| } = useSuspenseQuery( | ||
| goalQueries.getTeamGoalList( | ||
| teamId, | ||
| sortTypeByLabel[selectedSort] ?? "LATEST", | ||
| ), | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="flex w-full flex-col items-start gap-5"> | ||
| <div className="flex w-full items-center justify-between"> | ||
| <div className="flex items-center justify-start gap-3"> | ||
| <Icon | ||
| name="FlagGreen" | ||
| size={40} | ||
| /> | ||
| <h2 className="typography-body-1 text-label-neutral font-medium"> | ||
| 목표 | ||
| </h2> | ||
| <span className="typography-body-1 ml-[-8px] font-medium text-gray-400"> | ||
| {goalList.length}개 | ||
| </span> | ||
| </div> | ||
|
|
||
| <Order | ||
| options={sortOptions} | ||
| selected={selectedSort} | ||
| onSelect={setSelectedSort} | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="grid w-full grid-cols-3 gap-4"> | ||
| {goalList.map((goal) => ( | ||
| <MainSecondaryProgressCard | ||
| teamId={teamId} | ||
| key={goal.goalId} | ||
| goalId={goal.goalId} | ||
| title={goal.name} | ||
| progress={goal.progressPercent} | ||
| color="green" | ||
| isFavorite={goal.isFavorite} | ||
| /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
| import GoalListError from "./Error"; | ||
| import GoalListComponent from "./GoalList"; | ||
| import GoalListLoading from "./Loading"; | ||
|
|
||
| export const GoalList = Object.assign(GoalListComponent, { | ||
| Error: GoalListError, | ||
| Loading: GoalListLoading, | ||
| }); |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use client가 붙어 있는데, AsyncBoundary가 ssr: false로 dynamic import 되어있어서 제거해도 괜찮지않나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errorFallback에서 화살표 함수 prop을 전달하는게, 서버 컴포넌트에서는 함수를 전달 못해서 에러가 발생하더라고요