chore: deprecate daily review offset local setting

This commit is contained in:
Steven 2023-11-08 21:49:03 +08:00
parent 504d1768f2
commit 4499f45b67
5 changed files with 3 additions and 42 deletions

View File

@ -18,8 +18,6 @@ const PreferencesSection = () => {
const { setting, localSetting } = userStore.state.user as User;
const [telegramUserId, setTelegramUserId] = useState<string>(setting.telegramUserId);
const dailyReviewTimeOffsetOptions: number[] = [...Array(24).keys()];
const handleLocaleSelectChange = async (locale: Locale) => {
await userStore.upsertUserSetting("locale", locale);
globalStore.setLocale(locale);
@ -38,10 +36,6 @@ const PreferencesSection = () => {
userStore.upsertLocalSetting({ ...localSetting, enableDoubleClickEditing: event.target.checked });
};
const handleDailyReviewTimeOffsetChanged = (value: number) => {
userStore.upsertLocalSetting({ ...localSetting, dailyReviewTimeOffset: value });
};
const handleSaveTelegramUserId = async () => {
try {
await userStore.upsertUserSetting("telegram-user-id", telegramUserId);
@ -87,35 +81,6 @@ const PreferencesSection = () => {
))}
</Select>
</div>
<div className="form-label selector">
<span className="text-sm break-keep text-ellipsis overflow-hidden">{t("setting.preference-section.daily-review-time-offset")}</span>
<span className="w-auto inline-flex">
<Select
placeholder="hh"
className="!min-w-fit"
value={localSetting.dailyReviewTimeOffset}
onChange={(_, value) => {
if (value !== null) {
handleDailyReviewTimeOffsetChanged(value);
}
}}
slotProps={{
listbox: {
sx: {
maxHeight: "15rem",
overflow: "auto",
},
},
}}
>
{dailyReviewTimeOffsetOptions.map((item) => (
<Option key={item} value={item} className="whitespace-nowrap">
{item.toString().padStart(2, "0")}
</Option>
))}
</Select>
</span>
</div>
<label className="form-label selector">
<span className="text-sm break-keep">{t("setting.preference-section.enable-double-click")}</span>

View File

@ -132,7 +132,7 @@ const TagItemContainer: React.FC<TagItemContainerProps> = (props: TagItemContain
className={`flex flex-row justify-center items-center w-6 h-6 shrink-0 transition-all rotate-0 ${showSubTags && "rotate-90"}`}
onClick={handleToggleBtnClick}
>
<Icon.ChevronRight className="w-5 h-5 opacity-80 dark:text-gray-400" />
<Icon.ChevronRight className="w-5 h-5 opacity-40 dark:text-gray-400" />
</span>
) : null}
</div>

View File

@ -14,23 +14,21 @@ import DatePicker from "@/components/kit/DatePicker";
import { DAILY_TIMESTAMP, DEFAULT_MEMO_LIMIT } from "@/helpers/consts";
import { getDateStampByDate, getNormalizedDateString, getTimeStampByDate, getTimeString } from "@/helpers/datetime";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useMemoStore, useUserStore } from "@/store/module";
import { useMemoStore } from "@/store/module";
import { extractUsernameFromName } from "@/store/v1";
import { useTranslate } from "@/utils/i18n";
const DailyReview = () => {
const t = useTranslate();
const memoStore = useMemoStore();
const userStore = useUserStore();
const user = useCurrentUser();
const { localSetting } = userStore.state.user as User;
const currentDateStamp = getDateStampByDate(getNormalizedDateString()) as number;
const [selectedDateStamp, setSelectedDateStamp] = useState<number>(currentDateStamp as number);
const [showDatePicker, toggleShowDatePicker] = useToggle(false);
const dailyMemos = memoStore.state.memos
.filter((m) => {
const displayTimestamp = getTimeStampByDate(m.displayTs);
const selectedDateStampWithOffset = selectedDateStamp + localSetting.dailyReviewTimeOffset * 60 * 60 * 1000;
const selectedDateStampWithOffset = selectedDateStamp;
return (
m.rowStatus === "NORMAL" &&
m.creatorUsername === extractUsernameFromName(user.name) &&

View File

@ -15,7 +15,6 @@ const defaultSetting: Setting = {
const defaultLocalSetting: LocalSetting = {
enableDoubleClickEditing: false,
dailyReviewTimeOffset: 0,
};
export const convertResponseModelUser = (user: User): User => {

View File

@ -13,7 +13,6 @@ interface Setting {
interface LocalSetting {
enableDoubleClickEditing: boolean;
dailyReviewTimeOffset: number;
}
interface UserLocaleSetting {