-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 홈 화면 7일 뷰 퍼블리싱 및 투두 드래그 정렬/타이머 연동 구현 #124
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
11 commits
Select commit
Hold shift + click to select a range
e62b92e
feat(web): Suspense/ErrorBoundary 공통 래퍼 추가 (#114)
kimminna 26f7f7a
feat(ui): AddTaskButton 너비를 유동적으로 개선 (#121)
kimminna bf37f2f
feat(web): 홈 화면 7일 뷰 mock/레이아웃/i18n 키 정리 (#121)
kimminna 6e1d28d
Merge branch 'develop' of https://github.com/Team-Timo/Timo-client in…
kimminna ff15536
chore(web): 드래그 정렬/전역 상태 관리 의존성 추가 (#121)
kimminna 9a40f9d
feat(web): 홈 투두 드래그 앤 드롭 정렬 기능 추가 (#121)
kimminna de65eb7
file(web): 프로바이더/토스트 컨테이너를 기능별 하위 폴더로 이동 (#121)
kimminna f775ed3
comment(web): 홈 유틸 함수에 JSDoc 주석 추가 (#121)
kimminna fdac278
fix(web): 투두 카드 세로 스크롤 리스트 레이아웃 깨짐 수정 (#121)
kimminna cdfbfef
feat(web): 재생 버튼 클릭 시 타이머 사이드바 자동 오픈 (#121)
kimminna 2f68202
Merge remote-tracking branch 'origin/develop' into feat/web/121-home-…
kimminna 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 |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import { useSortable } from "@dnd-kit/sortable"; | ||
| import { CSS } from "@dnd-kit/utilities"; | ||
| import { | ||
| MemoDisableIcon, | ||
| MemoOnIcon, | ||
|
|
@@ -14,6 +16,7 @@ import { | |
| TagIcon, | ||
| } from "@repo/timo-design-system/ui"; | ||
| import { cn } from "@repo/timo-design-system/utils"; | ||
| import { useTranslations } from "next-intl"; | ||
|
|
||
| import type { | ||
| TodoPriorityTypes, | ||
|
|
@@ -33,11 +36,11 @@ const PRIORITY_MAP: Record< | |
| }; | ||
|
|
||
| export interface HomeTodoCardProps { | ||
| todoId: number; | ||
| title: string; | ||
| isCompleted: boolean; | ||
| durationSeconds: number; | ||
| priority: TodoPriorityTypes; | ||
| priorityLabel?: string; | ||
| tagName?: string; | ||
| hasMemo: boolean; | ||
| isRepeated: boolean; | ||
|
|
@@ -50,11 +53,11 @@ export interface HomeTodoCardProps { | |
| } | ||
|
|
||
| export const HomeTodoCard = ({ | ||
| todoId, | ||
| title, | ||
| isCompleted, | ||
| durationSeconds, | ||
| priority, | ||
| priorityLabel, | ||
| tagName, | ||
| hasMemo, | ||
| isRepeated, | ||
|
|
@@ -65,19 +68,32 @@ export const HomeTodoCard = ({ | |
| onTogglePlay, | ||
| onToggleSubtaskCompleted, | ||
| }: HomeTodoCardProps) => { | ||
| const tCommon = useTranslations("Common"); | ||
|
|
||
| const { attributes, listeners, setNodeRef, transform, transition } = | ||
| useSortable({ id: todoId, disabled: isCompleted }); | ||
|
|
||
| const sortableStyle = { | ||
| transform: CSS.Transform.toString(transform), | ||
| transition, | ||
| touchAction: "none", | ||
| }; | ||
|
|
||
| const isRunning = timerStatus === "RUNNING"; | ||
|
|
||
| const priorityLabel = tCommon(`priority.${PRIORITY_MAP[priority]}`); | ||
|
|
||
| const titleRow = ( | ||
| <div className="flex w-full items-center justify-between gap-2"> | ||
| <div className="flex w-[165px] items-center gap-1"> | ||
| <div className="flex min-w-0 flex-1 items-center gap-1"> | ||
| <Checkbox | ||
| checked={isCompleted} | ||
| onChange={onToggleCompleted} | ||
| disabled={isCompleted} | ||
| /> | ||
| <p | ||
| className={cn( | ||
| "typo-body-sb-12 w-[137px] truncate", | ||
| "typo-body-sb-12 min-w-0 flex-1 truncate", | ||
| isCompleted ? "text-timo-gray-700" : "text-timo-black", | ||
| )} | ||
| > | ||
|
|
@@ -103,21 +119,27 @@ export const HomeTodoCard = ({ | |
|
|
||
| return ( | ||
| <article | ||
| ref={setNodeRef} | ||
| style={sortableStyle} | ||
| {...attributes} | ||
| {...listeners} | ||
| className={cn( | ||
| "border-timo-gray-500 flex size-full flex-col items-start gap-2 overflow-hidden rounded-[4px] border border-solid px-3.5 py-3", | ||
| "border-timo-gray-500 flex w-full shrink-0 flex-col items-start gap-2 overflow-hidden rounded-[4px] border border-solid px-3.5 py-3", | ||
| isCompleted ? "bg-timo-gray-200" : "bg-white", | ||
| )} | ||
| > | ||
|
Comment on lines
121
to
130
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. 체크박스나 재생 버튼 클릭할 때도 드래그가 시작될 수 있어보여요. |
||
| {subtaskTitle ? ( | ||
| <div className="flex w-full flex-col items-start gap-1"> | ||
| {titleRow} | ||
| <div className="flex items-center gap-2"> | ||
| <div className="flex w-full min-w-0 items-center gap-2"> | ||
| <Checkbox | ||
| checked={isSubtaskCompleted} | ||
| onChange={(checked) => onToggleSubtaskCompleted?.(checked)} | ||
| disabled={isCompleted} | ||
| /> | ||
| <p className="typo-body-r-12 text-timo-gray-700">{subtaskTitle}</p> | ||
| <p className="typo-body-r-12 text-timo-gray-700 min-w-0 flex-1 truncate"> | ||
| {subtaskTitle} | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ) : ( | ||
|
|
||
49 changes: 49 additions & 0 deletions
49
...o-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeDayHeaderContainer.tsx
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,49 @@ | ||
| "use client"; | ||
|
|
||
| import { AddTaskButton } from "@repo/timo-design-system/ui"; | ||
| import { useTranslations } from "next-intl"; | ||
|
|
||
| import type { ApiDayOfWeek } from "@/app/[locale]/(main)/(with-time-sidebar)/home/_types/home-view-type"; | ||
|
|
||
| import { HomeDateInformation } from "@/app/[locale]/(main)/(with-time-sidebar)/home/_components/HomeDateInformation"; | ||
| import { | ||
| convertDateToDateText, | ||
| getToday, | ||
| parseDateKey, | ||
| } from "@/app/[locale]/(main)/(with-time-sidebar)/home/_utils/date"; | ||
|
|
||
| export interface HomeDayHeaderContainerProps { | ||
| dateKey: string; | ||
| dayOfWeek: ApiDayOfWeek; | ||
| isHoliday: boolean; | ||
| isToday: boolean; | ||
| totalCount: number; | ||
| completedCount: number; | ||
| } | ||
|
|
||
| export const HomeDayHeaderContainer = ({ | ||
| dateKey, | ||
| dayOfWeek, | ||
| isHoliday, | ||
| isToday, | ||
| totalCount, | ||
| completedCount, | ||
| }: HomeDayHeaderContainerProps) => { | ||
| const t = useTranslations("Home"); | ||
| const tCommon = useTranslations("Common"); | ||
| const date = parseDateKey(dateKey) ?? getToday(); | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-3 pb-2"> | ||
| <HomeDateInformation | ||
| date={convertDateToDateText(date)} | ||
| dayOfWeek={tCommon(`weekday.${dayOfWeek}`)} | ||
| isHoliday={isHoliday} | ||
| isToday={isToday} | ||
| totalCount={totalCount} | ||
| completedCount={completedCount} | ||
| /> | ||
| <AddTaskButton text={t("addTask")} /> | ||
| </div> | ||
| ); | ||
| }; |
25 changes: 20 additions & 5 deletions
25
...timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers/HomeHeaderContainer.tsx
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.
todo 완료되면 체크박스도 잠기는 걸로 보이는데 화면설계서에서 [Home-Default 4-4]에 완료 투두에서 체크 박스는 수정할 수가 있어서 확인부탁드립니다!
(TodayTodoCard처럼 완료되어도 hover시에 체크박스 수정가능한걸로 알고있습니다.)
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.
체크박스 수정 시 완료 토글 API를 호출하고, 재정렬된 데이터를 받아와야 해서 지금 프론트 로직에서 추가할 건 없어보입니다. 추후에 수정해 둘게요~!!