code refactor

This commit is contained in:
MaysWind
2025-06-09 23:32:19 +08:00
parent cd37e2ab1d
commit 4111eb0838
27 changed files with 73 additions and 56 deletions
@@ -63,6 +63,8 @@ import { type CommonDateRangeSelectionProps, useDateRangeSelectionBase } from '@
import { useEnvironmentsStore } from '@/stores/environment.ts';
import { useUserStore } from '@/stores/user.ts';
import { type WeekDayValue } from '@/core/datetime.ts';
import {
getLocalDatetimeFromUnixTime,
getDummyUnixTimeForLocalUsage,
@@ -87,7 +89,7 @@ const userStore = useUserStore();
const datetimepicker = useTemplateRef<VueDatePickerType>('datetimepicker');
const isDarkMode = computed<boolean>(() => environmentsStore.framework7DarkMode || false);
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
function confirm(): void {
try {
+2 -1
View File
@@ -45,6 +45,7 @@ import { useI18n } from '@/locales/helpers.ts';
import { useEnvironmentsStore } from '@/stores/environment.ts';
import { useUserStore } from '@/stores/user.ts';
import { type WeekDayValue } from '@/core/datetime.ts';
import { arrangeArrayWithNewStartIndex } from '@/lib/common.ts';
import { getCurrentYear } from '@/lib/datetime.ts';
@@ -70,7 +71,7 @@ const yearRange = ref<number[]>([
const dateTime = ref<string>('');
const isDarkMode = computed<boolean>(() => environmentsStore.framework7DarkMode || false);
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
const isYearFirst = computed<boolean>(() => isLongDateMonthAfterYear());
@@ -37,7 +37,7 @@
<div class="block block-outline no-margin no-padding padding-vertical-half" v-show="mode === 'time'">
<div id="time-picker-container" class="time-picker-container"></div>
</div>
<input id="time-picker-input" style="display: none" type="text" readonly="readonly"/>
<input id="time-picker-input" style="display: none" type="text" :readonly="true"/>
<div class="margin-top text-align-center">
<div class="display-flex padding-horizontal justify-content-space-between">
<div class="align-self-center">{{ displayTime }}</div>
@@ -59,6 +59,7 @@ import { useI18nUIComponents, createInlinePicker } from '@/lib/ui/mobile.ts';
import { useEnvironmentsStore } from '@/stores/environment.ts';
import { useUserStore } from '@/stores/user.ts';
import { type WeekDayValue } from '@/core/datetime.ts';
import { arrangeArrayWithNewStartIndex } from '@/lib/common.ts';
import {
getCurrentUnixTime,
@@ -106,7 +107,7 @@ const timeValues = ref<string[]>(getTimeValues(dateTime.value, is24Hour, isMerid
const datetimepicker = useTemplateRef<VueDatePickerType>('datetimepicker');
const isDarkMode = computed<boolean>(() => environmentsStore.framework7DarkMode || false);
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
const dayNames = computed<string[]>(() => arrangeArrayWithNewStartIndex(getAllMinWeekdayNames(), firstDayOfWeek.value));
const isYearFirst = computed<boolean>(() => isLongDateMonthAfterYear());
const displayTime = computed<string>(() => formatUnixTimeToLongDateTime(getActualUnixTimeForStore(getUnixTime(dateTime.value), getTimezoneOffsetMinutes(), getBrowserTimezoneOffsetMinutes())));
+1 -1
View File
@@ -15,7 +15,7 @@
v-if="enableCopy"
></f7-link>
</p>
<textarea class="information-content full-line" readonly="readonly" :rows="rowCount" :value="information"></textarea>
<textarea class="information-content full-line" :readonly="true" :rows="rowCount" :value="information"></textarea>
<div class="margin-top text-align-center">
<f7-link @click="close" :text="tt('Close')"></f7-link>
</div>
@@ -72,6 +72,7 @@ import { type CommonScheduleFrequencySelectionProps, useScheduleFrequencySelecti
import { useUserStore } from '@/stores/user.ts';
import { type WeekDayValue } from '@/core/datetime.ts';
import { ScheduledTemplateFrequencyType } from '@/core/template.ts';
import { sortNumbersArray } from '@/lib/common.ts';
import { type Framework7Dom, scrollToSelectedItem } from '@/lib/ui/mobile.ts';
@@ -95,7 +96,7 @@ const userStore = useUserStore();
const currentFrequencyType = ref<number>(props.type);
const currentFrequencyValue = ref<number[]>(getFrequencyValues(props.modelValue));
const firstDayOfWeek = computed<number>(() => userStore.currentUserFirstDayOfWeek);
const firstDayOfWeek = computed<WeekDayValue>(() => userStore.currentUserFirstDayOfWeek);
function isChecked(value: number): boolean {
return currentFrequencyValue.value.indexOf(value) >= 0;