Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/timo-web/api/generated/endpoints/home/home.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const GetHomeResponse = zod.object({
name: zod.string(),
})
.optional(),
hasMemo: zod.boolean(),
hasSubtask: zod.boolean(),
isRepeated: zod.boolean(),
timerStatus: zod.enum(["STOPPED", "RUNNING", "PAUSED"]),
sortOrder: zod.number().optional(),
Expand Down Expand Up @@ -107,7 +107,7 @@ export const GetTodayResponse = zod.object({
})
.optional(),
isRepeated: zod.boolean(),
hasMemo: zod.boolean(),
hasSubtask: zod.boolean(),
timerStatus: zod.enum(["STOPPED", "RUNNING", "PAUSED"]),
sortOrder: zod.number().optional(),
subtasks: zod.array(
Expand Down
2 changes: 1 addition & 1 deletion apps/timo-web/api/generated/models/todayTodoResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface TodayTodoResponse {
priority?: string;
tag?: TagResponse;
isRepeated: boolean;
hasMemo: boolean;
hasSubtask: boolean;
timerStatus: TodayTodoResponseTimerStatus;
sortOrder?: number;
subtasks: SubtaskResponse[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type TodoCreateRequestIcon =
(typeof TodoCreateRequestIcon)[keyof typeof TodoCreateRequestIcon];

export const TodoCreateRequestIcon = {
NONE: "NONE",
ICON_1: "ICON_1",
ICON_2: "ICON_2",
ICON_3: "ICON_3",
Expand Down
2 changes: 1 addition & 1 deletion apps/timo-web/api/generated/models/todoResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface TodoResponse {
durationSeconds?: number;
priority?: string;
tag?: TagResponse;
hasMemo: boolean;
hasSubtask: boolean;
isRepeated: boolean;
timerStatus: TodoResponseTimerStatus;
sortOrder?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type TodoUpdateRequestIcon =
(typeof TodoUpdateRequestIcon)[keyof typeof TodoUpdateRequestIcon];

export const TodoUpdateRequestIcon = {
NONE: "NONE",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아이콘을 이런식으로 제거할 수 있네요 👍

ICON_1: "ICON_1",
ICON_2: "ICON_2",
ICON_3: "ICON_3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from "@repo/timo-design-system/ui";
import { cn } from "@repo/timo-design-system/utils";
import { useTranslations } from "next-intl";
import { useEffect, useState } from "react";

import type {
TodoPriorityTypes,
Expand All @@ -26,15 +27,6 @@ import type { KeyboardEvent, MouseEvent, PointerEvent } from "react";

import { convertDurationToTimeText } from "@/utils/todo/todo-time";

type PriorityLabelKeyTypes = "urgent" | "high" | "medium" | "low";

const PRIORITY_LABEL_KEY: Record<TodoPriorityTypes, PriorityLabelKeyTypes> = {
VERY_HIGH: "urgent",
HIGH: "high",
MEDIUM: "medium",
LOW: "low",
};

const isInteractiveElement = (target: EventTarget | null) =>
target instanceof HTMLElement &&
Boolean(target.closest("button, input, label"));
Expand All @@ -44,9 +36,9 @@ export interface HomeTodoCardProps {
title: string;
isCompleted: boolean;
durationSeconds: number;
priority: TodoPriorityTypes;
priority?: TodoPriorityTypes;
tagName?: string;
hasMemo: boolean;
hasSubtask: boolean;
isRepeated: boolean;
timerStatus: TodoTimerStatusTypes;
isPlayHighlighted: boolean;
Expand All @@ -65,7 +57,7 @@ export const HomeTodoCard = ({
durationSeconds,
priority,
tagName,
hasMemo,
hasSubtask,
isRepeated,
timerStatus,
isPlayHighlighted,
Expand All @@ -86,9 +78,16 @@ export const HomeTodoCard = ({
transition,
};

const [isHovered, setIsHovered] = useState(false);

useEffect(() => {
if (isCompleted) setIsHovered(false);
}, [isCompleted]);

const isDimmed = isCompleted && !isHovered;
const isRunning = timerStatus === "RUNNING";

const priorityLabel = tCommon(`priority.${PRIORITY_LABEL_KEY[priority]}`);
const priorityLabel = priority ? tCommon(`priority.${priority}`) : undefined;

const handleCardClick = (event: MouseEvent<HTMLDivElement>) => {
if (isInteractiveElement(event.target)) return;
Expand Down Expand Up @@ -123,7 +122,7 @@ export const HomeTodoCard = ({
<p
className={cn(
"typo-body-sb-12 min-w-0 flex-1 truncate",
isCompleted ? "text-timo-gray-700" : "text-timo-black",
isDimmed ? "text-timo-gray-700" : "text-timo-black",
)}
>
{title}
Expand Down Expand Up @@ -165,9 +164,11 @@ export const HomeTodoCard = ({
tabIndex={onClickTodo ? 0 : attributes.tabIndex}
onClick={onClickTodo ? handleCardClick : undefined}
onKeyDown={onClickTodo ? handleCardKeyDown : undefined}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
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",
isDimmed ? "bg-timo-gray-200" : "bg-white",
onClickTodo && "cursor-pointer",
)}
Comment thread
kimminna marked this conversation as resolved.
>
Expand All @@ -189,19 +190,23 @@ export const HomeTodoCard = ({
)}
<div className="flex w-full items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-1">
<PriorityIcon
priority={isCompleted ? "Disable" : priority}
label={priorityLabel}
/>
{priority && (
<div className="pl-2">
<PriorityIcon
priority={isDimmed ? "Disable" : priority}
label={priorityLabel}
/>
</div>
)}
{tagName && <TagIcon text={tagName} />}
{hasMemo &&
(isCompleted ? (
{hasSubtask &&
(isDimmed ? (
<MemoDisableIcon width={18} height={18} />
) : (
<MemoOnIcon width={18} height={18} />
))}
{isRepeated &&
(isCompleted ? (
(isDimmed ? (
<RepeatTodoDisableIcon width={18} height={18} />
) : (
<RepeatTodoOnIcon width={18} height={18} />
Expand All @@ -210,7 +215,7 @@ export const HomeTodoCard = ({
<span
className={cn(
"typo-body-sb-12 shrink-0 whitespace-nowrap",
isCompleted ? "text-timo-gray-700" : "text-timo-gray-900",
isDimmed ? "text-timo-gray-700" : "text-timo-gray-900",
)}
>
{convertDurationToTimeText(durationSeconds)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export const HomeTodoContainer = () => {
durationSeconds={durationSeconds}
priority={todo.priority}
tagName={todoTagName}
hasMemo={todo.hasMemo}
hasSubtask={todo.hasSubtask}
isRepeated={todo.isRepeated}
timerStatus={timerStatus}
isPlayHighlighted={isPlayHighlighted}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const TODO_TEMPLATES: TodoTemplate[] = [
durationSeconds: 7200,
priority: "HIGH",
tag: { tagId: 3, name: "work" },
hasMemo: false,
hasSubtask: false,
isRepeated: true,
timerStatus: "RUNNING",
sortOrder: 0,
Expand All @@ -28,7 +28,7 @@ const TODO_TEMPLATES: TodoTemplate[] = [
durationSeconds: 5400,
priority: "VERY_HIGH",
tag: { tagId: 1, name: "assignment" },
hasMemo: true,
hasSubtask: true,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 1,
Expand All @@ -47,7 +47,7 @@ const TODO_TEMPLATES: TodoTemplate[] = [
durationSeconds: 1800,
priority: "LOW",
tag: { tagId: 4, name: "exercise" },
hasMemo: false,
hasSubtask: false,
isRepeated: true,
timerStatus: "STOPPED",
sortOrder: 2,
Expand All @@ -60,7 +60,7 @@ const TODO_TEMPLATES: TodoTemplate[] = [
durationSeconds: 1800,
priority: "MEDIUM",
tag: { tagId: 5, name: "additional" },
hasMemo: true,
hasSubtask: true,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 3,
Expand All @@ -73,7 +73,7 @@ const TODO_TEMPLATES: TodoTemplate[] = [
durationSeconds: 3600,
priority: "MEDIUM",
tag: { tagId: 2, name: "dailyLife" },
hasMemo: false,
hasSubtask: false,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface TodayTodoCardToolbar {
time: string;
priority?: PriorityLevel;
tag?: string;
hasMemo: boolean;
hasSubtask: boolean;
hasRepeat: boolean;
}

Expand Down Expand Up @@ -185,7 +185,7 @@ export const TodayTodoCard = ({
tagLabel={toolbar.tag ?? "태그"}
tags={[]}
selectedTag={toolbar.tag}
hasMemo={toolbar.hasMemo}
hasMemo={toolbar.hasSubtask}
isRepeatActive={toolbar.hasRepeat}
repeat={{
detailHeading: "상세 설정",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const TodayTodoListContainer = () => {
time: convertDurationToTimeText(durationSeconds),
priority: todo.priority,
tag: todo.tag?.name,
hasMemo: todo.hasMemo,
hasSubtask: todo.hasSubtask,
hasRepeat: todo.isRepeated,
}}
subTodos={todo.subtasks.map((s) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface TodoMock {
durationSeconds: number;
priority: "URGENT" | "HIGH" | "MEDIUM" | "LOW";
tag: TodoTag | null;
hasMemo: boolean;
hasSubtask: boolean;
isRepeated: boolean;
timerStatus: "RUNNING" | "PAUSED" | "STOPPED";
sortOrder: number;
Expand All @@ -35,7 +35,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 36000,
priority: "URGENT",
tag: { tagId: 1, name: "작업" },
hasMemo: true,
hasSubtask: true,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 0,
Expand All @@ -53,7 +53,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 3600,
priority: "MEDIUM",
tag: { tagId: 2, name: "완료" },
hasMemo: false,
hasSubtask: false,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 1,
Expand All @@ -68,7 +68,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 1800,
priority: "HIGH",
tag: null,
hasMemo: true,
hasSubtask: true,
isRepeated: true,
timerStatus: "STOPPED",
sortOrder: 2,
Expand All @@ -83,7 +83,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 7200,
priority: "HIGH",
tag: { tagId: 3, name: "개발" },
hasMemo: false,
hasSubtask: false,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 3,
Expand All @@ -101,7 +101,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 2700,
priority: "MEDIUM",
tag: { tagId: 4, name: "회의" },
hasMemo: true,
hasSubtask: true,
isRepeated: true,
timerStatus: "STOPPED",
sortOrder: 4,
Expand All @@ -116,7 +116,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 5400,
priority: "URGENT",
tag: { tagId: 1, name: "작업" },
hasMemo: false,
hasSubtask: false,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 5,
Expand All @@ -131,7 +131,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 4500,
priority: "LOW",
tag: { tagId: 3, name: "개발" },
hasMemo: false,
hasSubtask: false,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 6,
Expand All @@ -149,7 +149,7 @@ export const todayTodoMocks: TodoMock[] = [
durationSeconds: 9000,
priority: "HIGH",
tag: { tagId: 3, name: "개발" },
hasMemo: true,
hasSubtask: true,
isRepeated: false,
timerStatus: "STOPPED",
sortOrder: 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const TimeboxPanel = ({ currentTime }: TimeboxPanelProps) => {
style={{ top: startOffset, height }}
>
{showLabel && (
<div className="flex items-start gap-1 pt-[2px] pl-[6px]">
<div className="flex items-start gap-1 pt-0.5 pl-1.5">
<span
className={cn(
"typo-body-sb-12 min-w-0 truncate",
Expand Down
Loading
Loading