diff --git a/src/app/[slug]/[date]/page.tsx b/src/app/[slug]/[date]/page.tsx index 193288b..66d9cfe 100644 --- a/src/app/[slug]/[date]/page.tsx +++ b/src/app/[slug]/[date]/page.tsx @@ -33,7 +33,7 @@ export default async function Page({ params }: Props) {

{dateString}

{currentUser?._id === objective.createdUserId ? ( - + ) : ( )} diff --git a/src/app/_components/domains/Nippo/NippoEditor/NippoEditor.tsx b/src/app/_components/domains/Nippo/NippoEditor/NippoEditor.tsx index 17eaadd..a2815a8 100644 --- a/src/app/_components/domains/Nippo/NippoEditor/NippoEditor.tsx +++ b/src/app/_components/domains/Nippo/NippoEditor/NippoEditor.tsx @@ -11,26 +11,25 @@ import Placeholder from '@tiptap/extension-placeholder'; import StarterKit from '@tiptap/starter-kit'; import ListItem from '@tiptap/extension-list-item'; import Heading from '@tiptap/extension-heading'; -import { format } from 'date-fns'; import { postNippo } from '~/app/_actions/nippoActions'; import { Nippo } from '~/domains/Nippo'; -import { getCurrentDate } from '~/libs/getCurrentDate'; import { useDebounce } from '~/libs/useDebounce'; type Props = { objectiveId: string; nippo?: Nippo; + date: string; }; -export const NippoEditor: FC = ({ objectiveId, nippo }) => { +export const NippoEditor: FC = ({ objectiveId, nippo, date }) => { const [inputText, setInputText] = useState(); const debouncedInputText = useDebounce({ value: inputText, delay: 200 }); const handleEditorChange = useCallback( async (body: string) => { - await postNippo({ objectiveId, date: nippo?.date || format(getCurrentDate(), 'yyyy-MM-dd'), body }); + await postNippo({ objectiveId, date, body }); }, - [nippo?.date, objectiveId], + [date, objectiveId], ); useEffect(() => {