Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
"use client";

import {
CalendarDisableIcon,
ChevronUpIcon,
ClockDisableIcon,
DeleteIcon,
MemoDisableIcon,
RepeatDisableIcon,
} from "@repo/timo-design-system/icons";
import {
Checkbox,
CreateButton,
PriorityIcon,
TagIcon,
} from "@repo/timo-design-system/ui";
import { cn } from "@repo/timo-design-system/utils";
import { useId } from "react";

export type TodoSubtaskVariant = "filled" | "placeholder";

export interface TodoSubtaskItem {
id: string;
label: string;
checked: boolean;
variant?: TodoSubtaskVariant;
}

const SUBTASK_LABEL_STYLE: Record<TodoSubtaskVariant, string> = {
filled: "typo-headline-b-14 text-timo-black",
placeholder: "typo-body-r-12 text-timo-gray-700",
};

const DEFAULT_SUBTASKS: TodoSubtaskItem[] = [
{ id: "1", label: "Plan a new task", checked: false, variant: "filled" },
{
id: "2",
label: "Add tasks in small units",
checked: false,
variant: "placeholder",
},
];

export interface TodoCreateModalProps {
subtasks?: TodoSubtaskItem[];
onSubtaskToggle?: (id: string, checked: boolean) => void;
note?: string;
onNoteChange?: (note: string) => void;
isIconPickerOpen?: boolean;
onToggleIconPicker?: () => void;
isCreateDisabled?: boolean;
onCreate?: () => void;
onClose?: () => void;
onDateClick?: () => void;
onTimeClick?: () => void;
onPriorityClick?: () => void;
onTagClick?: () => void;
onMemoClick?: () => void;
onRepeatClick?: () => void;
}

export const TodoCreateModal = ({
subtasks = DEFAULT_SUBTASKS,
onSubtaskToggle,
note = "",
onNoteChange,
isIconPickerOpen = false,
onToggleIconPicker,
isCreateDisabled = true,
onCreate,
onClose,
onDateClick,
onTimeClick,
onPriorityClick,
onTagClick,
onMemoClick,
onRepeatClick,
}: TodoCreateModalProps) => {
const noteId = useId();

return (
<div className="flex w-[490px] flex-col items-center justify-center gap-2.5 rounded-[4px] bg-white px-6 py-4">
<div className="flex w-full items-center justify-between">
<p className="typo-body-sb-12 text-timo-blue-300 whitespace-nowrap">
Add a task
</p>
<button
type="button"
onClick={onClose}
aria-label="닫기"
className="flex shrink-0 items-center justify-center"
>
<DeleteIcon />
</button>
</div>

<div className="flex w-full flex-col items-start gap-3.5">
<div className="flex w-full flex-col items-start gap-2">
<button
type="button"
onClick={onToggleIconPicker}
aria-expanded={isIconPickerOpen}
className="bg-timo-gray-200 flex items-center gap-1 rounded-[4px] px-1.5 py-0.5"
>
<ChevronUpIcon width={18} height={18} />
<span className="typo-caption-r-10 text-timo-gray-700 whitespace-nowrap">
Add an icon
</span>
</button>

<div className="flex w-full flex-col items-start gap-1.5">
{subtasks.map((subtask) => (
<div key={subtask.id} className="flex items-center gap-2">
<Checkbox
checked={subtask.checked}
onChange={(checked) => onSubtaskToggle?.(subtask.id, checked)}
/>
<p
className={cn(
"truncate",
SUBTASK_LABEL_STYLE[subtask.variant ?? "filled"],
)}
>
{subtask.label}
</p>
</div>
))}
</div>
</div>

<div className="flex h-[35px] w-full items-start">
<label htmlFor={noteId} className="sr-only">
노트
</label>
<textarea
id={noteId}
value={note}
onChange={(e) => onNoteChange?.(e.target.value)}
placeholder="Please enter a note.."
rows={1}
className="typo-body-r-12 text-timo-gray-700 placeholder:text-timo-gray-700 w-full resize-none bg-transparent outline-none"
/>
</div>
</div>

<div className="flex w-full items-center justify-between">
<div className="flex items-center gap-2">
<button
type="button"
onClick={onDateClick}
className="flex items-center gap-0.5"
>
<CalendarDisableIcon />
<span className="typo-caption-r-10 text-timo-gray-700 whitespace-nowrap">
Date
</span>
</button>

<button
type="button"
onClick={onTimeClick}
className="flex items-center"
>
<ClockDisableIcon />
<span className="typo-caption-r-10 text-timo-gray-700 flex w-9 items-center justify-center whitespace-nowrap">
00 : 00
</span>
</button>

<button
type="button"
onClick={onPriorityClick}
aria-label="우선순위 설정"
className="flex items-center justify-center p-1.5"
>
<PriorityIcon priority="Disable" />
</button>

<button type="button" onClick={onTagClick}>
<TagIcon text="Tag" />
</button>

<button type="button" onClick={onMemoClick} aria-label="메모 추가">
<MemoDisableIcon />
</button>

<button type="button" onClick={onRepeatClick} aria-label="반복 설정">
<RepeatDisableIcon />
</button>
</div>

<CreateButton
label="Create"
disabled={isCreateDisabled}
onClick={onCreate}
/>
</div>
</div>
);
};
File renamed without changes.
51 changes: 51 additions & 0 deletions apps/timo-web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import "./globals.css";
import localFont from "next/font/local";
import { notFound } from "next/navigation";
import { hasLocale, NextIntlClientProvider } from "next-intl";

import type { Metadata } from "next";

import { routing } from "@/i18n/routing";
import { QueryProvider } from "@/providers/QueryProvider";

const pretendard = localFont({
src: "../../fonts/PretendardVariable.woff2",
variable: "--font-family-pretendard",
weight: "45 920",
display: "swap",
});

export const metadata: Metadata = {
title: "Timo",
description: "Timo web",
};

interface RootLayoutProps {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}

export function generateStaticParams() {
return routing.locales.map((locale) => ({ locale }));
}

export default async function RootLayout({
children,
params,
}: Readonly<RootLayoutProps>) {
const { locale } = await params;

if (!hasLocale(routing.locales, locale)) {
notFound();
}

return (
<html lang={locale} className={pretendard.variable}>
<body>
<NextIntlClientProvider>
<QueryProvider>{children}</QueryProvider>
</NextIntlClientProvider>
</body>
</html>
);
}
7 changes: 7 additions & 0 deletions apps/timo-web/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useTranslations } from "next-intl";

export default function Home() {
const t = useTranslations("HomePage");

return <>{t("title")}</>;
}
Comment thread
kimminna marked this conversation as resolved.
32 changes: 0 additions & 32 deletions apps/timo-web/app/layout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions apps/timo-web/app/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import {
} from "@repo/timo-design-system/icons";
import { TabButton } from "@repo/timo-design-system/ui";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";

import { ROUTES } from "@/constants/routes";
import { Link, usePathname } from "@/i18n/navigation";

const NAV_ITEMS = [
{
Expand Down
6 changes: 6 additions & 0 deletions apps/timo-web/i18n/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createNavigation } from "next-intl/navigation";

import { routing } from "@/i18n/routing";

export const { Link, redirect, usePathname, useRouter, getPathname } =
createNavigation(routing);
16 changes: 16 additions & 0 deletions apps/timo-web/i18n/request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { hasLocale } from "next-intl";
import { getRequestConfig } from "next-intl/server";

import { routing } from "@/i18n/routing";

export default getRequestConfig(async ({ requestLocale }) => {
const requested = await requestLocale;
const locale = hasLocale(routing.locales, requested)
? requested
: routing.defaultLocale;

return {
locale,
messages: (await import(`../messages/${locale}.json`)).default,
};
});
7 changes: 7 additions & 0 deletions apps/timo-web/i18n/routing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineRouting } from "next-intl/routing";

export const routing = defineRouting({
locales: ["en", "ko"],
defaultLocale: "en",
localePrefix: "as-needed",
});
5 changes: 5 additions & 0 deletions apps/timo-web/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"HomePage": {
"title": "Hi Timo"
}
}
5 changes: 5 additions & 0 deletions apps/timo-web/messages/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"HomePage": {
"title": "안녕 티모"
}
}
5 changes: 4 additions & 1 deletion apps/timo-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* global process */
import { withSentryConfig } from "@sentry/nextjs";
import createNextIntlPlugin from "next-intl/plugin";

/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@repo/timo-design-system"],
};

export default withSentryConfig(nextConfig, {
const withNextIntl = createNextIntlPlugin();

export default withSentryConfig(withNextIntl(nextConfig), {
org: "timo-client",
project: "timo-web",
authToken: process.env["SENTRY_AUTH_TOKEN"],
Expand Down
1 change: 1 addition & 0 deletions apps/timo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@tanstack/react-query-devtools": "^5.101.1",
"axios": "^1.18.1",
"next": "16.2.0",
"next-intl": "^4.13.1",
Comment thread
kimminna marked this conversation as resolved.
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^4.4.3"
Expand Down
9 changes: 9 additions & 0 deletions apps/timo-web/proxy.ts

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.

미들웨어 파일명이 proxy.ts인데, Next.js는 미들웨어를 middleware.ts로만 인식하는 걸로 알고 있어요. proxy.ts로는 실제로 미들웨어가 동작하지 않을 것 같아서요 middleware.ts로 rename이 필요하지 않을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

middleware -> proxy로 변경이 되었다고 알고 있습니다!

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import createMiddleware from "next-intl/middleware";

import { routing } from "@/i18n/routing";

export default createMiddleware(routing);

export const config = {
matcher: ["/((?!api|_next|.*\\..*).*)"],
};
Loading
Loading