-
Notifications
You must be signed in to change notification settings - Fork 0
[FEAT] 기존 카드 투두 클릭 모달 구현 #164
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 all commits
6bcb68b
7b17cef
fc3494d
354eb92
bbee8f3
3c02616
fdcbf65
1c9b19e
38abc3d
78f98d3
796de1f
1fca154
ab7a493
86daee3
b128a11
83fe429
6925613
cd0c888
23daadb
c763069
6accb01
90eea50
df8fadf
1370156
c715de1
14343d0
8117609
9d75ebc
9470836
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 |
|---|---|---|
|
|
@@ -22,8 +22,9 @@ import type { | |
| TodoPriorityTypes, | ||
| TodoTimerStatusTypes, | ||
| } from "@/app/[locale]/(main)/(with-time-sidebar)/home/_types/todo-type"; | ||
| import type { KeyboardEvent, MouseEvent } from "react"; | ||
|
|
||
| import { convertDurationToTimeText } from "@/app/[locale]/(main)/(with-time-sidebar)/home/_utils/todo-time"; | ||
| import { convertDurationToTimeText } from "@/utils/todo/todo-time"; | ||
|
|
||
| type PriorityLabelKeyTypes = "urgent" | "high" | "medium" | "low"; | ||
|
|
||
|
|
@@ -34,6 +35,10 @@ const PRIORITY_LABEL_KEY: Record<TodoPriorityTypes, PriorityLabelKeyTypes> = { | |
| LOW: "low", | ||
| }; | ||
|
|
||
| const isInteractiveElement = (target: EventTarget | null) => | ||
| target instanceof HTMLElement && | ||
| Boolean(target.closest("button, input, label")); | ||
|
|
||
| export interface HomeTodoCardProps { | ||
| todoId: number; | ||
| title: string; | ||
|
|
@@ -46,6 +51,7 @@ export interface HomeTodoCardProps { | |
| timerStatus: TodoTimerStatusTypes; | ||
| subtaskTitle?: string; | ||
| isSubtaskCompleted?: boolean; | ||
| onClickTodo?: () => void; | ||
| onToggleCompleted: (completed: boolean) => void; | ||
| onTogglePlay: () => void; | ||
| onToggleSubtaskCompleted?: (completed: boolean) => void; | ||
|
|
@@ -63,6 +69,7 @@ export const HomeTodoCard = ({ | |
| timerStatus, | ||
| subtaskTitle, | ||
| isSubtaskCompleted = false, | ||
| onClickTodo, | ||
| onToggleCompleted, | ||
| onTogglePlay, | ||
| onToggleSubtaskCompleted, | ||
|
|
@@ -81,6 +88,21 @@ export const HomeTodoCard = ({ | |
|
|
||
| const priorityLabel = tCommon(`priority.${PRIORITY_LABEL_KEY[priority]}`); | ||
|
|
||
| const handleCardClick = (event: MouseEvent<HTMLDivElement>) => { | ||
| if (isInteractiveElement(event.target)) return; | ||
|
|
||
| onClickTodo?.(); | ||
| }; | ||
|
|
||
| const handleCardKeyDown = (event: KeyboardEvent<HTMLDivElement>) => { | ||
| if (isInteractiveElement(event.target)) return; | ||
| if (!onClickTodo) return; | ||
| if (event.key !== "Enter" && event.key !== " ") return; | ||
|
|
||
| event.preventDefault(); | ||
| onClickTodo(); | ||
| }; | ||
|
|
||
| const titleRow = ( | ||
| <div className="flex w-full items-center justify-between gap-2"> | ||
| <div className="flex min-w-0 flex-1 items-center gap-1"> | ||
|
|
@@ -112,14 +134,19 @@ export const HomeTodoCard = ({ | |
| ); | ||
|
|
||
| return ( | ||
| <article | ||
| <div | ||
| ref={setNodeRef} | ||
| style={sortableStyle} | ||
| {...attributes} | ||
| {...listeners} | ||
| role={onClickTodo ? "button" : attributes.role} | ||
| tabIndex={onClickTodo ? 0 : attributes.tabIndex} | ||
| onClick={onClickTodo ? handleCardClick : undefined} | ||
| onKeyDown={onClickTodo ? handleCardKeyDown : undefined} | ||
| className={cn( | ||
| "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", | ||
| onClickTodo && "cursor-pointer", | ||
| )} | ||
| > | ||
|
Comment on lines
+137
to
151
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. 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate the target file and nearby related components
git ls-files 'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_components/todo-card/*' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/**/*todo-card*' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/**/*TodoCard*'
# Show the target file with line numbers if present
target='apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_components/todo-card/HomeTodoCard.tsx'
if [ -f "$target" ]; then
sed -n '1,260p' "$target" | cat -n
fi
# Find keyboard / click handling and interactive descendants in the home todo card area
rg -n --context 3 'role="button"|tabIndex=0|onKeyDown|onClickTodo|checkbox|button|play|aria-label' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_components' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_containers' \
'apps/timo-web/app/[locale]/(main)/(with-time-sidebar)/home/_hooks' \
|| trueRepository: Team-Timo/Timo-client Length of output: 50377 카드 전체를 버튼으로 만들기보다 내부 컨트롤과 분리해 주세요
상세 진입이 필요하면 카드 자체는 드래그/표시용으로 두고, 별도의 🤖 Prompt for AI Agents |
||
| {subtaskTitle ? ( | ||
|
|
@@ -167,6 +194,6 @@ export const HomeTodoCard = ({ | |
| {convertDurationToTimeText(durationSeconds)} | ||
| </span> | ||
| </div> | ||
| </article> | ||
| </div> | ||
| ); | ||
| }; | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.