From 3e70a07011931940a044bfd14d33cdb4361a2822 Mon Sep 17 00:00:00 2001 From: Hosoda-abo Date: Wed, 8 Oct 2025 16:45:32 +0900 Subject: [PATCH 01/12] feat: create record branch --- src/app/record.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 src/app/record.tsx diff --git a/src/app/record.tsx b/src/app/record.tsx new file mode 100644 index 0000000..154eeee --- /dev/null +++ b/src/app/record.tsx @@ -0,0 +1,8 @@ +type record = { + id: string; + title: string; + content: string; + createdAt: Date; + updatedAt: Date; +} + From 29275dd5418b0ff07db4e058e7dfb44dc34f03c0 Mon Sep 17 00:00:00 2001 From: Hosoda-abo Date: Wed, 8 Oct 2025 17:58:56 +0900 Subject: [PATCH 02/12] feat: define type --- src/app/record.tsx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/app/record.tsx b/src/app/record.tsx index 154eeee..08edab5 100644 --- a/src/app/record.tsx +++ b/src/app/record.tsx @@ -1,8 +1,26 @@ -type record = { - id: string; - title: string; - content: string; - createdAt: Date; - updatedAt: Date; +type DailyRecord = { + id: string; //出席番号 + bedTime: Date; //寝た時刻 + wakeUpTime: Date;//起きた時刻 + studyStartTime: Date; //勉強を始めた時刻 + studyFinishTime: Date;//勉強を終えた時刻 + readingStartTime: Date; //読書を始めた時刻 + readingFinishTime: Date; //読書を終えた時刻 + mediaStartTime: Date; + mediaFinishTime: Date; + exercise: false; + breakfast: false; + assistance: false; + studentComment: string; } +type DailyGoal = { + bedTime_goal: Date; //寝た時刻 + wakeUpTime_goal: Date;//起きた時刻 + studyStartTime_goal: Date; //勉強を始めた時刻 + studyFinishTime_goal: Date;//勉強を終えた時刻 + readingStartTime_goal: Date; //読書を始めた時刻 + readingFinishTime_goal: Date; //読書を終えた時刻 + mediaStartTime_goal: Date; + mediaFinishTime_goal: Date; +} \ No newline at end of file From 5e8dad1b3419a6941bcbc5341c37da65bbc3ff49 Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Fri, 10 Oct 2025 16:38:49 +0900 Subject: [PATCH 03/12] feat: add type --- src/app/record.tsx | 47 +++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/app/record.tsx b/src/app/record.tsx index 08edab5..e2d795a 100644 --- a/src/app/record.tsx +++ b/src/app/record.tsx @@ -1,26 +1,39 @@ type DailyRecord = { - id: string; //出席番号 bedTime: Date; //寝た時刻 wakeUpTime: Date;//起きた時刻 - studyStartTime: Date; //勉強を始めた時刻 - studyFinishTime: Date;//勉強を終えた時刻 - readingStartTime: Date; //読書を始めた時刻 - readingFinishTime: Date; //読書を終えた時刻 - mediaStartTime: Date; - mediaFinishTime: Date; + studyTime: Date; //勉強時間 + mediaTime: Date; exercise: false; + reading: false; breakfast: false; assistance: false; - studentComment: string; } - + type DailyGoal = { - bedTime_goal: Date; //寝た時刻 - wakeUpTime_goal: Date;//起きた時刻 - studyStartTime_goal: Date; //勉強を始めた時刻 - studyFinishTime_goal: Date;//勉強を終えた時刻 - readingStartTime_goal: Date; //読書を始めた時刻 - readingFinishTime_goal: Date; //読書を終えた時刻 - mediaStartTime_goal: Date; - mediaFinishTime_goal: Date; + bedTimeGoal: Date; //寝た時刻 + wakeUpTimeGoal: Date;//起きた時刻 + studyTimeGoal: Date; + mediaTimeGoal: Date; + excerciseGoal: Date; + readingGoal: Date; +} + +type WeeklyGoal = { + weeklyBedTimeGoal: Date; //寝た時刻 + weeklyWakeUpTimeGoal: Date;//起きた時刻 + weeklyStudyTimeGoal: Date; + weeklyMediaTimeGoal: Date; + weeklyExcerciseGoal: Date; + weeklyReadingGoal: Date; +} + +type studentComment = { + comment: string; +} + +type Account = { + id: string; //ユーザーID + name:string; + password:string; + class: number; } \ No newline at end of file From ef2acd7d5e33ccc60ceb9d0fa03f1e48db5df2df Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Fri, 10 Oct 2025 16:39:42 +0900 Subject: [PATCH 04/12] feet: change character --- src/app/record.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/record.tsx b/src/app/record.tsx index e2d795a..f45c3b9 100644 --- a/src/app/record.tsx +++ b/src/app/record.tsx @@ -27,11 +27,11 @@ type WeeklyGoal = { weeklyReadingGoal: Date; } -type studentComment = { +type StudentComment = { comment: string; } -type Account = { +type StudentAccount = { id: string; //ユーザーID name:string; password:string; From 08a85644bd8d6bf813f7fdce2c08d62bb1ee6840 Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Sun, 12 Oct 2025 09:01:52 +0900 Subject: [PATCH 05/12] style: change the file extension --- src/app/record.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/app/record.ts diff --git a/src/app/record.ts b/src/app/record.ts new file mode 100644 index 0000000..f45c3b9 --- /dev/null +++ b/src/app/record.ts @@ -0,0 +1,39 @@ +type DailyRecord = { + bedTime: Date; //寝た時刻 + wakeUpTime: Date;//起きた時刻 + studyTime: Date; //勉強時間 + mediaTime: Date; + exercise: false; + reading: false; + breakfast: false; + assistance: false; +} + +type DailyGoal = { + bedTimeGoal: Date; //寝た時刻 + wakeUpTimeGoal: Date;//起きた時刻 + studyTimeGoal: Date; + mediaTimeGoal: Date; + excerciseGoal: Date; + readingGoal: Date; +} + +type WeeklyGoal = { + weeklyBedTimeGoal: Date; //寝た時刻 + weeklyWakeUpTimeGoal: Date;//起きた時刻 + weeklyStudyTimeGoal: Date; + weeklyMediaTimeGoal: Date; + weeklyExcerciseGoal: Date; + weeklyReadingGoal: Date; +} + +type StudentComment = { + comment: string; +} + +type StudentAccount = { + id: string; //ユーザーID + name:string; + password:string; + class: number; +} \ No newline at end of file From 9ad4ab33f56c622bc8cc82bd88572d3a5095be1c Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Sun, 12 Oct 2025 09:17:09 +0900 Subject: [PATCH 06/12] style: separated the record.ts --- src/app/record.ts | 39 ------------------------------------- src/app/record.tsx | 39 ------------------------------------- src/type/daily-record.ts | 10 ++++++++++ src/type/student-account.ts | 6 ++++++ src/type/student-comment.ts | 3 +++ src/type/weekday-goal.ts | 8 ++++++++ src/type/weekend-goal.ts | 8 ++++++++ 7 files changed, 35 insertions(+), 78 deletions(-) delete mode 100644 src/app/record.ts delete mode 100644 src/app/record.tsx create mode 100644 src/type/daily-record.ts create mode 100644 src/type/student-account.ts create mode 100644 src/type/student-comment.ts create mode 100644 src/type/weekday-goal.ts create mode 100644 src/type/weekend-goal.ts diff --git a/src/app/record.ts b/src/app/record.ts deleted file mode 100644 index f45c3b9..0000000 --- a/src/app/record.ts +++ /dev/null @@ -1,39 +0,0 @@ -type DailyRecord = { - bedTime: Date; //寝た時刻 - wakeUpTime: Date;//起きた時刻 - studyTime: Date; //勉強時間 - mediaTime: Date; - exercise: false; - reading: false; - breakfast: false; - assistance: false; -} - -type DailyGoal = { - bedTimeGoal: Date; //寝た時刻 - wakeUpTimeGoal: Date;//起きた時刻 - studyTimeGoal: Date; - mediaTimeGoal: Date; - excerciseGoal: Date; - readingGoal: Date; -} - -type WeeklyGoal = { - weeklyBedTimeGoal: Date; //寝た時刻 - weeklyWakeUpTimeGoal: Date;//起きた時刻 - weeklyStudyTimeGoal: Date; - weeklyMediaTimeGoal: Date; - weeklyExcerciseGoal: Date; - weeklyReadingGoal: Date; -} - -type StudentComment = { - comment: string; -} - -type StudentAccount = { - id: string; //ユーザーID - name:string; - password:string; - class: number; -} \ No newline at end of file diff --git a/src/app/record.tsx b/src/app/record.tsx deleted file mode 100644 index f45c3b9..0000000 --- a/src/app/record.tsx +++ /dev/null @@ -1,39 +0,0 @@ -type DailyRecord = { - bedTime: Date; //寝た時刻 - wakeUpTime: Date;//起きた時刻 - studyTime: Date; //勉強時間 - mediaTime: Date; - exercise: false; - reading: false; - breakfast: false; - assistance: false; -} - -type DailyGoal = { - bedTimeGoal: Date; //寝た時刻 - wakeUpTimeGoal: Date;//起きた時刻 - studyTimeGoal: Date; - mediaTimeGoal: Date; - excerciseGoal: Date; - readingGoal: Date; -} - -type WeeklyGoal = { - weeklyBedTimeGoal: Date; //寝た時刻 - weeklyWakeUpTimeGoal: Date;//起きた時刻 - weeklyStudyTimeGoal: Date; - weeklyMediaTimeGoal: Date; - weeklyExcerciseGoal: Date; - weeklyReadingGoal: Date; -} - -type StudentComment = { - comment: string; -} - -type StudentAccount = { - id: string; //ユーザーID - name:string; - password:string; - class: number; -} \ No newline at end of file diff --git a/src/type/daily-record.ts b/src/type/daily-record.ts new file mode 100644 index 0000000..fca4fb6 --- /dev/null +++ b/src/type/daily-record.ts @@ -0,0 +1,10 @@ +type DailyRecord = { + bedTime: Date; //寝た時刻 + wakeUpTime: Date;//起きた時刻 + studyTime: Date; //勉強時間 + mediaTime: Date; + exercise: false; + reading: false; + breakfast: false; + assistance: false; +} diff --git a/src/type/student-account.ts b/src/type/student-account.ts new file mode 100644 index 0000000..d665d43 --- /dev/null +++ b/src/type/student-account.ts @@ -0,0 +1,6 @@ +type StudentAccount = { + id: string; //ユーザーID + name:string; + password:string; + class: number; +} \ No newline at end of file diff --git a/src/type/student-comment.ts b/src/type/student-comment.ts new file mode 100644 index 0000000..0f93214 --- /dev/null +++ b/src/type/student-comment.ts @@ -0,0 +1,3 @@ +type StudentComment = { + studentComment: string; +} \ No newline at end of file diff --git a/src/type/weekday-goal.ts b/src/type/weekday-goal.ts new file mode 100644 index 0000000..be22af9 --- /dev/null +++ b/src/type/weekday-goal.ts @@ -0,0 +1,8 @@ +type WeekdayGoal = { + bedTimeGoal: Date; //寝た時刻 + wakeUpTimeGoal: Date;//起きた時刻 + studyTimeGoal: Date; + mediaTimeGoal: Date; + exerciseGoal: Date; + readingGoal: Date; +} \ No newline at end of file diff --git a/src/type/weekend-goal.ts b/src/type/weekend-goal.ts new file mode 100644 index 0000000..c19bbc5 --- /dev/null +++ b/src/type/weekend-goal.ts @@ -0,0 +1,8 @@ +type WeekendGoal = { + weeklyBedTimeGoal: Date; //寝た時刻 + weeklyWakeUpTimeGoal: Date;//起きた時刻 + weeklyStudyTimeGoal: Date; + weeklyMediaTimeGoal: Date; + weeklyExcerciseGoal: Date; + weeklyReadingGoal: Date; +} \ No newline at end of file From 03bd09bce38568b750f4a6947efde324be6f7d01 Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Sun, 12 Oct 2025 09:26:41 +0900 Subject: [PATCH 07/12] =?UTF-8?q?style:=20Change=20the=20folder=20name=20f?= =?UTF-8?q?rom=20=E2=80=9Ctype=E2=80=9D=20to=20=E2=80=9Ctypes=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/{type => types}/daily-record.ts | 0 src/{type => types}/student-account.ts | 0 src/{type => types}/student-comment.ts | 0 src/{type => types}/weekday-goal.ts | 0 src/{type => types}/weekend-goal.ts | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename src/{type => types}/daily-record.ts (100%) rename src/{type => types}/student-account.ts (100%) rename src/{type => types}/student-comment.ts (100%) rename src/{type => types}/weekday-goal.ts (100%) rename src/{type => types}/weekend-goal.ts (100%) diff --git a/src/type/daily-record.ts b/src/types/daily-record.ts similarity index 100% rename from src/type/daily-record.ts rename to src/types/daily-record.ts diff --git a/src/type/student-account.ts b/src/types/student-account.ts similarity index 100% rename from src/type/student-account.ts rename to src/types/student-account.ts diff --git a/src/type/student-comment.ts b/src/types/student-comment.ts similarity index 100% rename from src/type/student-comment.ts rename to src/types/student-comment.ts diff --git a/src/type/weekday-goal.ts b/src/types/weekday-goal.ts similarity index 100% rename from src/type/weekday-goal.ts rename to src/types/weekday-goal.ts diff --git a/src/type/weekend-goal.ts b/src/types/weekend-goal.ts similarity index 100% rename from src/type/weekend-goal.ts rename to src/types/weekend-goal.ts From 5744da1ce077179cf520a6190276c3be002c678c Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Wed, 15 Oct 2025 17:33:28 +0900 Subject: [PATCH 08/12] fix: change files name and add coment --- src/types/daily-record.ts | 10 ---------- src/types/dailyRecord.ts | 10 ++++++++++ src/types/student-account.ts | 6 ------ src/types/studentAccount.ts | 5 +++++ src/types/{student-comment.ts => studentComment.ts} | 2 +- src/types/weekday-goal.ts | 8 -------- src/types/weekdayGoal.ts | 8 ++++++++ src/types/{weekend-goal.ts => weekendGoal.ts} | 2 +- 8 files changed, 25 insertions(+), 26 deletions(-) delete mode 100644 src/types/daily-record.ts create mode 100644 src/types/dailyRecord.ts delete mode 100644 src/types/student-account.ts create mode 100644 src/types/studentAccount.ts rename src/types/{student-comment.ts => studentComment.ts} (96%) delete mode 100644 src/types/weekday-goal.ts create mode 100644 src/types/weekdayGoal.ts rename src/types/{weekend-goal.ts => weekendGoal.ts} (99%) diff --git a/src/types/daily-record.ts b/src/types/daily-record.ts deleted file mode 100644 index fca4fb6..0000000 --- a/src/types/daily-record.ts +++ /dev/null @@ -1,10 +0,0 @@ -type DailyRecord = { - bedTime: Date; //寝た時刻 - wakeUpTime: Date;//起きた時刻 - studyTime: Date; //勉強時間 - mediaTime: Date; - exercise: false; - reading: false; - breakfast: false; - assistance: false; -} diff --git a/src/types/dailyRecord.ts b/src/types/dailyRecord.ts new file mode 100644 index 0000000..fd9d512 --- /dev/null +++ b/src/types/dailyRecord.ts @@ -0,0 +1,10 @@ +type DailyRecord = { + bedTime: Date; // 寝た時刻 + wakeUpTime: Date; // 起きた時刻 + studyTime: Number; // 勉強時間 + mediaTime: Number; // テレビやゲームの時間 + exercise: false; // 運動をしたか + reading: false; // 読書をしたか + breakfast: false; // 朝食を食べたか + assistance: false; // お手伝いをしたか +} diff --git a/src/types/student-account.ts b/src/types/student-account.ts deleted file mode 100644 index d665d43..0000000 --- a/src/types/student-account.ts +++ /dev/null @@ -1,6 +0,0 @@ -type StudentAccount = { - id: string; //ユーザーID - name:string; - password:string; - class: number; -} \ No newline at end of file diff --git a/src/types/studentAccount.ts b/src/types/studentAccount.ts new file mode 100644 index 0000000..0446ae7 --- /dev/null +++ b/src/types/studentAccount.ts @@ -0,0 +1,5 @@ +type StudentAccount = { + id: string; // ユーザーID + name: string; // ユーザー名 + class: number; // クラス +} diff --git a/src/types/student-comment.ts b/src/types/studentComment.ts similarity index 96% rename from src/types/student-comment.ts rename to src/types/studentComment.ts index 0f93214..bbe503f 100644 --- a/src/types/student-comment.ts +++ b/src/types/studentComment.ts @@ -1,3 +1,3 @@ type StudentComment = { studentComment: string; -} \ No newline at end of file +} diff --git a/src/types/weekday-goal.ts b/src/types/weekday-goal.ts deleted file mode 100644 index be22af9..0000000 --- a/src/types/weekday-goal.ts +++ /dev/null @@ -1,8 +0,0 @@ -type WeekdayGoal = { - bedTimeGoal: Date; //寝た時刻 - wakeUpTimeGoal: Date;//起きた時刻 - studyTimeGoal: Date; - mediaTimeGoal: Date; - exerciseGoal: Date; - readingGoal: Date; -} \ No newline at end of file diff --git a/src/types/weekdayGoal.ts b/src/types/weekdayGoal.ts new file mode 100644 index 0000000..7a83994 --- /dev/null +++ b/src/types/weekdayGoal.ts @@ -0,0 +1,8 @@ +type WeekdayGoal = { + bedTimeGoal: Date; // 寝た時刻 + wakeUpTimeGoal: Date; // 起きた時刻 + studyTimeGoal: Number; + mediaTimeGoal: Number; + exerciseGoal: Number; + readingGoal: Number; +} diff --git a/src/types/weekend-goal.ts b/src/types/weekendGoal.ts similarity index 99% rename from src/types/weekend-goal.ts rename to src/types/weekendGoal.ts index c19bbc5..b72d4a8 100644 --- a/src/types/weekend-goal.ts +++ b/src/types/weekendGoal.ts @@ -5,4 +5,4 @@ type WeekendGoal = { weeklyMediaTimeGoal: Date; weeklyExcerciseGoal: Date; weeklyReadingGoal: Date; -} \ No newline at end of file +} From f2084d38630bf0eb1c7a410f00fd7a276fc3b418 Mon Sep 17 00:00:00 2001 From: Ayaka Hosoda Date: Mon, 20 Oct 2025 18:16:03 +0900 Subject: [PATCH 09/12] Change type --- package-lock.json | 27 +++++++++++++++++++++++++++ package.json | 14 ++++++++------ src/types/dailyRecord.ts | 14 ++++++++------ src/types/goal.ts | 19 +++++++++++++++++++ src/types/weekdayGoal.ts | 8 -------- src/types/weekendGoal.ts | 8 -------- 6 files changed, 62 insertions(+), 28 deletions(-) create mode 100644 src/types/goal.ts delete mode 100644 src/types/weekdayGoal.ts delete mode 100644 src/types/weekendGoal.ts diff --git a/package-lock.json b/package-lock.json index ba776de..4f36c8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "education", "version": "0.1.0", "dependencies": { + "luxon": "^3.7.2", "next": "15.5.4", "react": "19.1.0", "react-dom": "19.1.0" @@ -15,6 +16,7 @@ "devDependencies": { "@eslint/eslintrc": "^3", "@tailwindcss/postcss": "^4", + "@types/luxon": "^3.7.1", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", @@ -1293,6 +1295,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/luxon": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.7.1.tgz", + "integrity": "sha512-H3iskjFIAn5SlJU7OuxUmTEpebK6TKB8rxZShDslBMZJ5u9S//KM1sbdAisiSrqwLQncVjnpi2OK2J51h+4lsg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "20.19.19", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.19.tgz", @@ -1309,6 +1318,7 @@ "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -1369,6 +1379,7 @@ "integrity": "sha512-n1H6IcDhmmUEG7TNVSspGmiHHutt7iVKtZwRppD7e04wha5MrkV1h3pti9xQLcCMt6YWsncpoT0HMjkH1FNwWQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.46.0", "@typescript-eslint/types": "8.46.0", @@ -1886,6 +1897,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2736,6 +2748,7 @@ "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2910,6 +2923,7 @@ "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.9", @@ -4467,6 +4481,15 @@ "loose-envify": "cli.js" } }, + "node_modules/luxon": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.7.2.tgz", + "integrity": "sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/magic-string": { "version": "0.30.19", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.19.tgz", @@ -5032,6 +5055,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -5041,6 +5065,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -5734,6 +5759,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -5883,6 +5909,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index 2ddeaf0..beafc69 100644 --- a/package.json +++ b/package.json @@ -9,19 +9,21 @@ "lint": "eslint" }, "dependencies": { + "luxon": "^3.7.2", + "next": "15.5.4", "react": "19.1.0", - "react-dom": "19.1.0", - "next": "15.5.4" + "react-dom": "19.1.0" }, "devDependencies": { - "typescript": "^5", + "@eslint/eslintrc": "^3", + "@tailwindcss/postcss": "^4", + "@types/luxon": "^3.7.1", "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", - "@tailwindcss/postcss": "^4", - "tailwindcss": "^4", "eslint": "^9", "eslint-config-next": "15.5.4", - "@eslint/eslintrc": "^3" + "tailwindcss": "^4", + "typescript": "^5" } } diff --git a/src/types/dailyRecord.ts b/src/types/dailyRecord.ts index fd9d512..4825d4c 100644 --- a/src/types/dailyRecord.ts +++ b/src/types/dailyRecord.ts @@ -1,10 +1,12 @@ +import {Duration} from 'luxon' + type DailyRecord = { bedTime: Date; // 寝た時刻 wakeUpTime: Date; // 起きた時刻 - studyTime: Number; // 勉強時間 - mediaTime: Number; // テレビやゲームの時間 - exercise: false; // 運動をしたか - reading: false; // 読書をしたか - breakfast: false; // 朝食を食べたか - assistance: false; // お手伝いをしたか + studyTime: Duration; // 勉強時間(分) + mediaTime: Duration; // テレビやゲームの時間(分) + exercise: boolean; // 運動をしたか + reading: boolean; // 読書をしたか + breakfast: boolean; // 朝食を食べたか + assistance: boolean; // お手伝いをしたか } diff --git a/src/types/goal.ts b/src/types/goal.ts new file mode 100644 index 0000000..4342d79 --- /dev/null +++ b/src/types/goal.ts @@ -0,0 +1,19 @@ +import { Duration } from "luxon"; + +type Goal = { + /* 平日の目標 */ + bedTimeGoal: Date; // 寝た時刻 + wakeUpTimeGoal: Date; // 起きた時刻 + studyTimeGoal: Duration; // 勉強時間(分) + mediaTimeGoal: Duration; // テレビやゲームの時間(分) + exerciseGoal: Duration; // 運動の時間(分) + readingGoal: Duration; // 読書の時間(分) + + /* 週末の目標 */ + weekendBedTimeGoal: Date; //寝た時刻 + weekendWakeUpTimeGoal: Date;//起きた時刻 + weekendStudyTimeGoal: Duration; + weekendMediaTimeGoal: Duration; + weekendExerciseGoal: Duration; + weekendReadingGoal: Duration; +} diff --git a/src/types/weekdayGoal.ts b/src/types/weekdayGoal.ts deleted file mode 100644 index 7a83994..0000000 --- a/src/types/weekdayGoal.ts +++ /dev/null @@ -1,8 +0,0 @@ -type WeekdayGoal = { - bedTimeGoal: Date; // 寝た時刻 - wakeUpTimeGoal: Date; // 起きた時刻 - studyTimeGoal: Number; - mediaTimeGoal: Number; - exerciseGoal: Number; - readingGoal: Number; -} diff --git a/src/types/weekendGoal.ts b/src/types/weekendGoal.ts deleted file mode 100644 index b72d4a8..0000000 --- a/src/types/weekendGoal.ts +++ /dev/null @@ -1,8 +0,0 @@ -type WeekendGoal = { - weeklyBedTimeGoal: Date; //寝た時刻 - weeklyWakeUpTimeGoal: Date;//起きた時刻 - weeklyStudyTimeGoal: Date; - weeklyMediaTimeGoal: Date; - weeklyExcerciseGoal: Date; - weeklyReadingGoal: Date; -} From a3407daac3cebcaa02e0421033100c22f1d50ea1 Mon Sep 17 00:00:00 2001 From: taki3210 Date: Tue, 21 Oct 2025 09:02:01 +0900 Subject: [PATCH 10/12] chore: restore data/records.json initial empty array --- data/records.json | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 data/records.json diff --git a/data/records.json b/data/records.json new file mode 100644 index 0000000..6c87723 --- /dev/null +++ b/data/records.json @@ -0,0 +1,2 @@ + +[] From c34312f8e7f9eb028560aa05ea904771dd273378 Mon Sep 17 00:00:00 2001 From: taki3210 Date: Wed, 22 Oct 2025 14:55:21 +0900 Subject: [PATCH 11/12] chore: reset saved records (clear data/records.json) --- data/records.json | 66 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/data/records.json b/data/records.json index 6c87723..db5e035 100644 --- a/data/records.json +++ b/data/records.json @@ -1,2 +1,64 @@ - -[] +[ + { + "id": 1, + "bedTime": "2025-10-21T00:35", + "wakeUpTime": "2025-10-21T07:25", + "studyTime": 0, + "mediaTime": 0, + "exercise": true, + "reading": true, + "breakfast": true, + "assistance": false, + "createdAt": "2025-10-21T00:02:26.738Z" + }, + { + "id": 2, + "bedTime": "2025-10-21T05:40", + "wakeUpTime": "2025-10-21T11:25", + "studyTime": 30, + "mediaTime": 120, + "exercise": true, + "reading": false, + "breakfast": true, + "assistance": true, + "createdAt": "2025-10-21T00:10:24.822Z" + }, + { + "id": 3, + "bedTime": "2025-10-21T21:16", + "wakeUpTime": "2025-10-22T08:16", + "studyTime": 20, + "mediaTime": 50, + "exercise": false, + "reading": true, + "breakfast": true, + "assistance": false, + "createdAt": "2025-10-22T04:17:02.502Z" + }, + { + "id": 4, + "bedTime": "2025-10-20T20:53", + "wakeUpTime": "2025-10-22T07:53", + "studyTime": 34, + "mediaTime": 23, + "exercise": true, + "reading": true, + "breakfast": true, + "assistance": true, + "recordDate": "2025-10-20", + "createdAt": "2025-10-19T15:00:00.000Z" + }, + { + "id": 5, + "bedTime": "2025-10-20T13:38:00.000Z", + "wakeUpTime": "2025-10-19T21:38:00.000Z", + "studyTime": 20, + "mediaTime": 50, + "exercise": false, + "reading": true, + "breakfast": false, + "assistance": false, + "recordDate": "2025-10-20", + "createdAt": "2025-10-19T15:00:00.000Z" + } +] \ No newline at end of file From 06343845c98243a9b69bf8c6eb22e9841e52581a Mon Sep 17 00:00:00 2001 From: taki3210 Date: Wed, 29 Oct 2025 16:47:09 +0900 Subject: [PATCH 12/12] =?UTF-8?q?=E8=A8=98=E9=8C=B2=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E4=BD=9C=E3=82=8A=E3=81=BE=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/records.json | 65 +--------- src/app/api/records/route.ts | 183 +++++++++++++++++++++++++++ src/app/records/page.tsx | 234 +++++++++++++++++++++++++++++++++++ src/types/dailyRecord.ts | 2 +- 4 files changed, 419 insertions(+), 65 deletions(-) create mode 100644 src/app/api/records/route.ts create mode 100644 src/app/records/page.tsx diff --git a/data/records.json b/data/records.json index db5e035..0637a08 100644 --- a/data/records.json +++ b/data/records.json @@ -1,64 +1 @@ -[ - { - "id": 1, - "bedTime": "2025-10-21T00:35", - "wakeUpTime": "2025-10-21T07:25", - "studyTime": 0, - "mediaTime": 0, - "exercise": true, - "reading": true, - "breakfast": true, - "assistance": false, - "createdAt": "2025-10-21T00:02:26.738Z" - }, - { - "id": 2, - "bedTime": "2025-10-21T05:40", - "wakeUpTime": "2025-10-21T11:25", - "studyTime": 30, - "mediaTime": 120, - "exercise": true, - "reading": false, - "breakfast": true, - "assistance": true, - "createdAt": "2025-10-21T00:10:24.822Z" - }, - { - "id": 3, - "bedTime": "2025-10-21T21:16", - "wakeUpTime": "2025-10-22T08:16", - "studyTime": 20, - "mediaTime": 50, - "exercise": false, - "reading": true, - "breakfast": true, - "assistance": false, - "createdAt": "2025-10-22T04:17:02.502Z" - }, - { - "id": 4, - "bedTime": "2025-10-20T20:53", - "wakeUpTime": "2025-10-22T07:53", - "studyTime": 34, - "mediaTime": 23, - "exercise": true, - "reading": true, - "breakfast": true, - "assistance": true, - "recordDate": "2025-10-20", - "createdAt": "2025-10-19T15:00:00.000Z" - }, - { - "id": 5, - "bedTime": "2025-10-20T13:38:00.000Z", - "wakeUpTime": "2025-10-19T21:38:00.000Z", - "studyTime": 20, - "mediaTime": 50, - "exercise": false, - "reading": true, - "breakfast": false, - "assistance": false, - "recordDate": "2025-10-20", - "createdAt": "2025-10-19T15:00:00.000Z" - } -] \ No newline at end of file +[] \ No newline at end of file diff --git a/src/app/api/records/route.ts b/src/app/api/records/route.ts new file mode 100644 index 0000000..928491d --- /dev/null +++ b/src/app/api/records/route.ts @@ -0,0 +1,183 @@ +import { NextResponse } from 'next/server' +import fs from 'fs' +import path from 'path' +import { Duration } from 'luxon' +// DailyRecord 型をここでも再定義(src/types/dailyRecord.ts を変更せず扱うため) +type DailyRecord = { + bedTime: Date + wakeUpTime: Date + studyTime: Duration + mediaTime: Duration + exercise: boolean + reading: boolean + breakfast: boolean + assistance: boolean +} + +// 保存先ファイル +const DATA_FILE = path.join(process.cwd(), 'data', 'records.json') + +// DailyRecord -> JSON 用オブジェクト +function serializeRecord(r: DailyRecord) { + return { + bedTime: r.bedTime.toISOString(), + wakeUpTime: r.wakeUpTime.toISOString(), + studyTime: r.studyTime.toISO(), + mediaTime: r.mediaTime.toISO(), + exercise: r.exercise, + reading: r.reading, + breakfast: r.breakfast, + assistance: r.assistance, + } +} + +// JSON オブジェクト -> DailyRecord +function deserializeRecord(o: any): DailyRecord { + return { + bedTime: new Date(o.bedTime), + wakeUpTime: new Date(o.wakeUpTime), + studyTime: Duration.fromISO(o.studyTime), + mediaTime: Duration.fromISO(o.mediaTime), + exercise: !!o.exercise, + reading: !!o.reading, + breakfast: !!o.breakfast, + assistance: !!o.assistance, + } +} + +function readRecords(): DailyRecord[] { + try { + if (!fs.existsSync(DATA_FILE)) return [] + const raw = fs.readFileSync(DATA_FILE, 'utf8') + const arr = JSON.parse(raw) + if (!Array.isArray(arr)) return [] + return arr.map(deserializeRecord) + } catch (err) { + console.error('readRecords error', err) + return [] + } +} + +// 生データをそのまま返す(recordDate メタ情報などを保持) +function readRawRecords(): any[] { + try { + if (!fs.existsSync(DATA_FILE)) return [] + const raw = fs.readFileSync(DATA_FILE, 'utf8') + const arr = JSON.parse(raw) + if (!Array.isArray(arr)) return [] + return arr + } catch (err) { + console.error('readRawRecords error', err) + return [] + } +} + +function writeRawRecords(records: any[]): boolean { + try { + fs.writeFileSync(DATA_FILE, JSON.stringify(records, null, 2), 'utf8') + return true + } catch (err) { + console.error('writeRawRecords error:', err) + return false + } +} + +function writeRecords(records: DailyRecord[]): boolean { + try { + const out = records.map(serializeRecord) + fs.writeFileSync(DATA_FILE, JSON.stringify(out, null, 2), 'utf8') + return true + } catch (err) { + console.error('writeRecords error', err) + return false + } +} + +// GET: ?days=14 (デフォルト14日) +export async function GET(request: Request) { + try { + const url = new URL(request.url) + const daysParam = url.searchParams.get('days') + const dateParam = url.searchParams.get('date') // YYYY-MM-DD + const days = daysParam ? Number(daysParam) : 14 + + const records = readRecords() + + // date 指定がある場合はその日のレコードを返す(upsertの基準は bedTime の日付) + if (dateParam) { + // search raw records for explicit recordDate metadata first, then fall back to bedTime date + const raw = readRawRecords() + const byMeta = raw.find((r: any) => r.recordDate === dateParam) + if (byMeta) return NextResponse.json(byMeta) + const target = records.find(r => r.bedTime.toISOString().slice(0, 10) === dateParam) + if (!target) return NextResponse.json({ message: 'not found' }, { status: 404 }) + return NextResponse.json(serializeRecord(target)) + } + + // return list with recordDate metadata so front-end can match by logical day + const raw = readRawRecords() + const listOut = raw.map((r: any) => ({ + bedTime: r.bedTime, + wakeUpTime: r.wakeUpTime, + studyTime: r.studyTime, + mediaTime: r.mediaTime, + exercise: !!r.exercise, + reading: !!r.reading, + breakfast: !!r.breakfast, + assistance: !!r.assistance, + recordDate: r.recordDate || (r.bedTime ? r.bedTime.slice(0,10) : undefined), + })) + + if (Number.isFinite(days) && days > 0) { + const cutoff = new Date() + cutoff.setDate(cutoff.getDate() - days + 1) // include today and past (days-1) days + const filtered = listOut.filter((r: any) => new Date(r.bedTime) >= cutoff) + return NextResponse.json(filtered) + } + + return NextResponse.json(listOut) + } catch (err) { + console.error('GET /api/records error', err) + return NextResponse.json({ message: '読み込みエラー' }, { status: 500 }) + } +} + +// POST: 単一日の記録を追加。期待する body 形:{ bedTime, wakeUpTime, studyTime, mediaTime, exercise, reading, breakfast, assistance } +export async function POST(request: Request) { + try { + const body = await request.json() + + if (!body || !body.bedTime || !body.wakeUpTime) { + return NextResponse.json({ message: '就寝時刻と起床時刻は必須です' }, { status: 400 }) + } + // Build stored object; accept optional recordDate to indicate logical day this record belongs to + const recordDate = body.recordDate || new Date(body.bedTime).toISOString().slice(0, 10) + const stored = { + bedTime: new Date(body.bedTime).toISOString(), + wakeUpTime: new Date(body.wakeUpTime).toISOString(), + studyTime: Duration.fromObject({ minutes: body.studyTime ?? 0 }).toISO(), + mediaTime: Duration.fromObject({ minutes: body.mediaTime ?? 0 }).toISO(), + exercise: !!body.exercise, + reading: !!body.reading, + breakfast: !!body.breakfast, + assistance: !!body.assistance, + recordDate: recordDate, + } + + const raw = readRawRecords() + // upsert by recordDate if exists, otherwise by bedTime date + const idx = raw.findIndex((r: any) => r.recordDate === recordDate || (r.bedTime && r.bedTime.slice(0, 10) === recordDate)) + if (idx >= 0) raw[idx] = stored + else raw.push(stored) + + if (!writeRawRecords(raw)) { + return NextResponse.json({ message: '保存に失敗しました' }, { status: 500 }) + } + + return NextResponse.json(stored) + } catch (err) { + console.error('POST /api/records error', err) + return NextResponse.json({ message: '処理エラー' }, { status: 500 }) + } +} + diff --git a/src/app/records/page.tsx b/src/app/records/page.tsx new file mode 100644 index 0000000..2ac2a52 --- /dev/null +++ b/src/app/records/page.tsx @@ -0,0 +1,234 @@ +"use client" +import React, { useEffect, useState } from "react" + +type ServerRecord = { + bedTime: string + wakeUpTime: string + studyTime: string + mediaTime: string + exercise: boolean + reading: boolean + breakfast: boolean + assistance: boolean + recordDate?: string +} + +export default function RecordsPage() { + // modal state + const [openDate, setOpenDate] = useState(null) // YYYY-MM-DD + const [slots, setSlots] = useState([]) // YYYY-MM-DD array for 14 days + const [list, setList] = useState([]) // raw server records (serialized) + const [loading, setLoading] = useState(false) + const [saving, setSaving] = useState(false) + const [message, setMessage] = useState(null) + + // modal form state + const [form, setForm] = useState({ + bedTime: "", + wakeUpTime: "", + studyTime: 0, + mediaTime: 0, + exercise: false, + reading: false, + breakfast: false, + assistance: false, + }) + + useEffect(() => { + buildSlots() + fetchList() + }, []) + + function buildSlots() { + const arr: string[] = [] + const today = new Date() + for (let i = 13; i >= 0; i--) { + const d = new Date() + d.setDate(today.getDate() - i) + arr.push(d.toISOString().slice(0, 10)) + } + setSlots(arr) + } + + async function fetchList() { + setLoading(true) + try { + const res = await fetch('/api/records') + const data = await res.json() + setList(data) + } catch (err) { + setMessage('取得エラー: ' + String(err)) + } finally { + setLoading(false) + } + } + + // helper: parse PT45M -> 45 + function durationIsoToMinutes(iso?: string) { + if (!iso) return 0 + const m = iso.match(/PT(\d+)M/) + if (m) return Number(m[1]) + return 0 + } + + async function openModalFor(date: string) { + setMessage(null) + setOpenDate(date) + // fetch single-day record from server + try { + const res = await fetch(`/api/records?date=${date}`) + if (res.status === 404) { + // empty form default times: bedTime -> previous day 22:00, wakeUpTime -> this date 06:00 + const bed = new Date(date + 'T00:00') + bed.setDate(bed.getDate() - 1) + bed.setHours(22, 0, 0, 0) + const wake = new Date(date + 'T06:00') + setForm({ + bedTime: toLocalInput(bed.toISOString()), + wakeUpTime: toLocalInput(wake.toISOString()), + studyTime: 0, + mediaTime: 0, + exercise: false, + reading: false, + breakfast: false, + assistance: false, + }) + return + } + if (!res.ok) throw new Error(String(res.status)) + const data = await res.json() + setForm({ + bedTime: toLocalInput(data.bedTime), + wakeUpTime: toLocalInput(data.wakeUpTime), + studyTime: durationIsoToMinutes(data.studyTime), + mediaTime: durationIsoToMinutes(data.mediaTime), + exercise: !!data.exercise, + reading: !!data.reading, + breakfast: !!data.breakfast, + assistance: !!data.assistance, + }) + } catch (err) { + setMessage('モーダル読み込みエラー: ' + String(err)) + } + } + + function toLocalInput(dtIso?: string) { + if (!dtIso) return '' + const d = new Date(dtIso) + const pad = (n: number) => String(n).padStart(2, '0') + return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}` + } + + async function saveForm(e?: React.FormEvent) { + if (e) e.preventDefault() + if (!openDate) return + setSaving(true) + setMessage(null) + try { + const payload = { + bedTime: new Date(form.bedTime).toISOString(), + wakeUpTime: new Date(form.wakeUpTime).toISOString(), + studyTime: form.studyTime ?? 0, + mediaTime: form.mediaTime ?? 0, + exercise: !!form.exercise, + reading: !!form.reading, + breakfast: !!form.breakfast, + assistance: !!form.assistance, + recordDate: openDate, + } + const res = await fetch('/api/records', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify(payload), + }) + if (!res.ok) throw new Error(String(res.status)) + await fetchList() + setOpenDate(null) + setMessage('保存しました') + } catch (err) { + setMessage('保存エラー: ' + String(err)) + } finally { + setSaving(false) + } + } + + return ( +
+

2週間の記録(テスト用)

+ +
+ {slots.map(d => { + const rec = list.find((r: any) => { + // If a record has an explicit recordDate, match only by that (logical day). + if (r.recordDate) return r.recordDate === d + // Otherwise fall back to bedTime's calendar date. + return r.bedTime && new Date(r.bedTime).toISOString().slice(0, 10) === d + }) + return ( +
+
{d}
+
+ {rec ? ( + <> +
寝: {rec.bedTime ? new Date(rec.bedTime).toLocaleTimeString() : '—'}
+
起: {rec.wakeUpTime ? new Date(rec.wakeUpTime).toLocaleTimeString() : '—'}
+
勉強: {durationIsoToMinutes((rec as any).studyTime)} 分
+
テレビ/ゲーム: {durationIsoToMinutes((rec as any).mediaTime)} 分
+
+ {rec.exercise ? 運動 : null} + {rec.reading ? 読書 : null} + {rec.breakfast ? 朝食 : null} + {rec.assistance ? お手伝い : null} +
+ + ) : ( +
未登録
+ )} +
+
+ +
+
+ ) + })} +
+ + {message &&
{message}
} + + {/* Modal */} + {openDate && ( +
+
+

{openDate} の記録

+
+
+ + +
+
+ + +
+
+ + + + +
+
+ + +
+
+
+
+ )} +
+ ) +} diff --git a/src/types/dailyRecord.ts b/src/types/dailyRecord.ts index 4825d4c..9393b48 100644 --- a/src/types/dailyRecord.ts +++ b/src/types/dailyRecord.ts @@ -1,4 +1,4 @@ -import {Duration} from 'luxon' +import { Duration } from 'luxon' type DailyRecord = { bedTime: Date; // 寝た時刻