summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-01-21 19:08:07 +0900
committerGitHub <noreply@github.com>2024-01-21 19:08:07 +0900
commit3784b39a5fffedde6599c1a3fa51af3672107e2a (patch)
tree9e89eae9003ec5dec26b2166d7f970935c531265 /packages
parentchore(deps-dev): bump vite in /scripts/changelog-checker (#13040) (diff)
downloadsharkey-3784b39a5fffedde6599c1a3fa51af3672107e2a.tar.gz
sharkey-3784b39a5fffedde6599c1a3fa51af3672107e2a.tar.bz2
sharkey-3784b39a5fffedde6599c1a3fa51af3672107e2a.zip
enhance(frontend): 季節に応じた画面の演出を南半球に対応させる (#12838)
* (enhance) 季節に応じた画面の演出を南半球に対応させる * Update Changelog * (add) 半球の簡易自動判定 --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages')
-rw-r--r--packages/frontend/src/boot/main-boot.ts15
-rw-r--r--packages/frontend/src/pages/settings/general.vue9
-rw-r--r--packages/frontend/src/scripts/intl-const.ts4
-rw-r--r--packages/frontend/src/store.ts5
4 files changed, 30 insertions, 3 deletions
diff --git a/packages/frontend/src/boot/main-boot.ts b/packages/frontend/src/boot/main-boot.ts
index c99118f9b2..eb0ac43da7 100644
--- a/packages/frontend/src/boot/main-boot.ts
+++ b/packages/frontend/src/boot/main-boot.ts
@@ -77,9 +77,18 @@ export async function mainBoot() {
if (defaultStore.state.enableSeasonalScreenEffect) {
const month = new Date().getMonth() + 1;
- if (month === 12 || month === 1) {
- const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
- new SnowfallEffect().render();
+ if (defaultStore.state.hemisphere === 'S') {
+ // ▼南半球
+ if (month === 7 || month === 8) {
+ const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
+ new SnowfallEffect().render();
+ }
+ } else {
+ // ▼北半球
+ if (month === 12 || month === 1) {
+ const SnowfallEffect = (await import('@/scripts/snowfall-effect.js')).SnowfallEffect;
+ new SnowfallEffect().render();
+ }
}
}
diff --git a/packages/frontend/src/pages/settings/general.vue b/packages/frontend/src/pages/settings/general.vue
index bbc910a32a..8b489c7a11 100644
--- a/packages/frontend/src/pages/settings/general.vue
+++ b/packages/frontend/src/pages/settings/general.vue
@@ -17,6 +17,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
</MkSelect>
+ <MkRadios v-model="hemisphere">
+ <template #label>{{ i18n.ts.hemisphere }}</template>
+ <option value="N">{{ i18n.ts._hemisphere.N }}</option>
+ <option value="S">{{ i18n.ts._hemisphere.S }}</option>
+ <template #caption>{{ i18n.ts._hemisphere.caption }}</template>
+ </MkRadios>
+
<MkRadios v-model="overridedDeviceKind">
<template #label>{{ i18n.ts.overridedDeviceKind }}</template>
<option :value="null">{{ i18n.ts.auto }}</option>
@@ -260,6 +267,7 @@ async function reloadAsk() {
unisonReload();
}
+const hemisphere = computed(defaultStore.makeGetterSetter('hemisphere'));
const overridedDeviceKind = computed(defaultStore.makeGetterSetter('overridedDeviceKind'));
const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serverDisconnectedBehavior'));
const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover'));
@@ -322,6 +330,7 @@ watch(useSystemFont, () => {
});
watch([
+ hemisphere,
lang,
fontSize,
useSystemFont,
diff --git a/packages/frontend/src/scripts/intl-const.ts b/packages/frontend/src/scripts/intl-const.ts
index ea16c9c2ae..d2d939af1f 100644
--- a/packages/frontend/src/scripts/intl-const.ts
+++ b/packages/frontend/src/scripts/intl-const.ts
@@ -33,6 +33,10 @@ try {
}
export const dateTimeFormat = _dateTimeFormat;
+export const timeZone = dateTimeFormat.resolvedOptions().timeZone;
+
+export const hemisphere = /^(australia|pacific|antarctica|indian)\//i.test(timeZone) ? 'S' : 'N';
+
let _numberFormat: Intl.NumberFormat;
try {
_numberFormat = new Intl.NumberFormat(versatileLang);
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index 5635e99650..afc35bb825 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -8,6 +8,7 @@ import * as Misskey from 'misskey-js';
import { miLocalStorage } from './local-storage.js';
import type { SoundType } from '@/scripts/sound.js';
import { Storage } from '@/pizzax.js';
+import { hemisphere } from '@/scripts/intl-const.js';
interface PostFormAction {
title: string,
@@ -429,6 +430,10 @@ export const defaultStore = markRaw(new Storage('base', {
sfxVolume: 1,
},
},
+ hemisphere: {
+ where: 'device',
+ default: hemisphere as 'N' | 'S',
+ },
enableHorizontalSwipe: {
where: 'device',
default: true,