diff --git a/README.md b/README.md index d68adb6..b61ab74 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,12 @@ For More information, please refer to the Top Page. [TODO REAL](https://todo-real-c28fa.web.app/) ## Getting Started -First run this command to install required packages: - -```bash -npm install -``` - -Then, run the development server: +Run the development server: ```bash npm run dev ``` +This includes `npm i` and `next dev`, so you don't have to care about refreshing packages. ## Learn More To learn more about Next.js, take a look at the following resources: @@ -46,7 +41,7 @@ Then, you can start the emulator by running the following command if you have ac cd .\functions\ npm run emu ``` -This command includes `firebase emulators:start` and `npx tsc --watch` which watches the files and restarts the server when the files are changed. +This command includes `npm i`, `firebase emulators:start` and `npx tsc --watch` which watches the files and restarts the server when the files are changed. if you don't want ts-node to watch the files, just use ``` diff --git a/src/Components/GoalModal/CopyGoalAfterPostButton.tsx b/src/Components/GoalModal/CopyGoalAfterPostButton.tsx index 4551ede..1d5365d 100644 --- a/src/Components/GoalModal/CopyGoalAfterPostButton.tsx +++ b/src/Components/GoalModal/CopyGoalAfterPostButton.tsx @@ -22,8 +22,8 @@ export default function CopyGoalAfterPostButton({ onClick={() => { setOpen(true); showSnackBar({ - message: "1日後の同じ時間で同じ目標を作成できます", - type: "success", + message: "明日の同じ時間で同じ目標を作成できます", + type: "normal", }); }} > diff --git a/src/Components/GoalModal/CopyGoalButton.tsx b/src/Components/GoalModal/CopyGoalButton.tsx index dd70c6f..ce5a35d 100644 --- a/src/Components/GoalModal/CopyGoalButton.tsx +++ b/src/Components/GoalModal/CopyGoalButton.tsx @@ -18,8 +18,8 @@ export default function CopyModalButton({ onClick={() => { setOpen(true); showSnackBar({ - message: "1日後の同じ時間で同じ目標を作成できます", - type: "success", + message: "明日の同じ時間で同じ目標を作成できます", + type: "normal", }); }} sx={{ cursor: "pointer", fontSize: "23px" }} diff --git a/src/Components/GoalModal/CreateGoalModal.tsx b/src/Components/GoalModal/CreateGoalModal.tsx index 84a9b3f..d56761d 100644 --- a/src/Components/GoalModal/CreateGoalModal.tsx +++ b/src/Components/GoalModal/CreateGoalModal.tsx @@ -33,6 +33,17 @@ export default function CreateGoalModal({ const { user } = useUser(); + const resetDeadline = () => { + // 次の日の23時に設定 + const nextDay = new Date(); + nextDay.setDate(nextDay.getDate() + 1); + nextDay.setHours(23, 0, 0, 0); + const localNextDay = new Date( + nextDay.getTime() - nextDay.getTimezoneOffset() * 60000 + ); + setDeadline(localNextDay.toISOString().slice(0, 16)); + }; + useEffect(() => { if (defaultText) { setText(defaultText); @@ -42,17 +53,10 @@ export default function CreateGoalModal({ const localDate = new Date( convertedDate.getTime() - convertedDate.getTimezoneOffset() * 60000 ); - localDate.setDate(localDate.getDate() + 1); // 1日後にする + localDate.setDate(localDate.getDate() + 1); // 明日にする setDeadline(localDate.toISOString().slice(0, 16)); } else { - // 初期値の指定が無い場合は次の日の23時に設定 - const nextDay = new Date(); - nextDay.setDate(nextDay.getDate() + 1); - nextDay.setHours(23, 0, 0, 0); - const localNextDay = new Date( - nextDay.getTime() - nextDay.getTimezoneOffset() * 60000 - ); - setDeadline(localNextDay.toISOString().slice(0, 16)); + resetDeadline(); } }, [defaultText, defaultDeadline]); @@ -75,7 +79,7 @@ export default function CreateGoalModal({ triggerDashBoardRerender(); setText(""); - setDeadline(""); + resetDeadline(); setOpen(false); } catch (error: unknown) { console.error("Error creating goal:", error);