mirror of
https://github.com/usememos/memos.git
synced 2024-12-19 00:51:30 +03:00
chore: persist selected date of DailyReview page (#2219)
* Persist selected date of DailyReview page * Use hook useLocalStorage instead of useState * Update web/src/pages/DailyReview.tsx Co-authored-by: boojack <stevenlgtm@gmail.com> Signed-off-by: Athurg Gooth <athurg@gooth.org> --------- Signed-off-by: Athurg Gooth <athurg@gooth.org> Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
parent
14aa3224ce
commit
41e26f56e9
@ -1,7 +1,8 @@
|
||||
import classNames from "classnames";
|
||||
import { last } from "lodash-es";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import toast from "react-hot-toast";
|
||||
import useLocalStorage from "react-use/lib/useLocalStorage";
|
||||
import useToggle from "react-use/lib/useToggle";
|
||||
import DailyMemo from "@/components/DailyMemo";
|
||||
import Empty from "@/components/Empty";
|
||||
@ -23,7 +24,11 @@ const DailyReview = () => {
|
||||
const userStore = useUserStore();
|
||||
const user = useCurrentUser();
|
||||
const { localSetting } = userStore.state.user as User;
|
||||
const [currentDateStamp, setCurrentDateStamp] = useState(getDateStampByDate(getNormalizedDateString()));
|
||||
const [currentDateStampRaw, setCurrentDateStamp] = useLocalStorage<number>(
|
||||
"daily-review-datestamp",
|
||||
getDateStampByDate(getNormalizedDateString())
|
||||
);
|
||||
const currentDateStamp = currentDateStampRaw as number;
|
||||
const [showDatePicker, toggleShowDatePicker] = useToggle(false);
|
||||
const memosElRef = useRef<HTMLDivElement>(null);
|
||||
const currentDate = new Date(currentDateStamp);
|
||||
|
Loading…
Reference in New Issue
Block a user