enhnace(frontend): リロードのサジェストをダイアログではなくバナー表示に
This commit is contained in:
parent
8449354887
commit
fc244067e0
|
@ -97,8 +97,8 @@ import { i18n } from '@/i18n.js';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
import MkPreferenceContainer from '@/components/MkPreferenceContainer.vue';
|
import MkPreferenceContainer from '@/components/MkPreferenceContainer.vue';
|
||||||
import { reloadAsk } from '@/utility/reload-ask.js';
|
|
||||||
import { selectFile } from '@/utility/drive.js';
|
import { selectFile } from '@/utility/drive.js';
|
||||||
|
import { suggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const navWindow = prefer.model('deck.navWindow');
|
const navWindow = prefer.model('deck.navWindow');
|
||||||
const useSimpleUiForNonRootPages = prefer.model('deck.useSimpleUiForNonRootPages');
|
const useSimpleUiForNonRootPages = prefer.model('deck.useSimpleUiForNonRootPages');
|
||||||
|
@ -109,8 +109,8 @@ const menuPosition = prefer.model('deck.menuPosition');
|
||||||
const navbarPosition = prefer.model('deck.navbarPosition');
|
const navbarPosition = prefer.model('deck.navbarPosition');
|
||||||
const wallpaper = prefer.model('deck.wallpaper');
|
const wallpaper = prefer.model('deck.wallpaper');
|
||||||
|
|
||||||
watch(wallpaper, async () => {
|
watch(wallpaper, () => {
|
||||||
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
suggestReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
function setWallpaper(ev: MouseEvent) {
|
function setWallpaper(ev: MouseEvent) {
|
||||||
|
|
|
@ -189,10 +189,10 @@ import { ensureSignin } from '@/i.js';
|
||||||
import MkInfo from '@/components/MkInfo.vue';
|
import MkInfo from '@/components/MkInfo.vue';
|
||||||
import MkFolder from '@/components/MkFolder.vue';
|
import MkFolder from '@/components/MkFolder.vue';
|
||||||
import MkSwitch from '@/components/MkSwitch.vue';
|
import MkSwitch from '@/components/MkSwitch.vue';
|
||||||
import { reloadAsk } from '@/utility/reload-ask.js';
|
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
import MkFeatureBanner from '@/components/MkFeatureBanner.vue';
|
import MkFeatureBanner from '@/components/MkFeatureBanner.vue';
|
||||||
import { Paginator } from '@/utility/paginator.js';
|
import { Paginator } from '@/utility/paginator.js';
|
||||||
|
import { suggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const $i = ensureSignin();
|
const $i = ensureSignin();
|
||||||
|
|
||||||
|
@ -216,8 +216,8 @@ const showSoftWordMutedWord = prefer.model('showSoftWordMutedWord');
|
||||||
|
|
||||||
watch([
|
watch([
|
||||||
showSoftWordMutedWord,
|
showSoftWordMutedWord,
|
||||||
], async () => {
|
], () => {
|
||||||
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
suggestReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function unrenoteMute(user, ev) {
|
async function unrenoteMute(user, ev) {
|
||||||
|
|
|
@ -64,7 +64,6 @@ import MkPreferenceContainer from '@/components/MkPreferenceContainer.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { navbarItemDef } from '@/navbar.js';
|
import { navbarItemDef } from '@/navbar.js';
|
||||||
import { store } from '@/store.js';
|
import { store } from '@/store.js';
|
||||||
import { reloadAsk } from '@/utility/reload-ask.js';
|
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
|
|
|
@ -155,13 +155,13 @@ import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { ensureSignin } from '@/i.js';
|
import { ensureSignin } from '@/i.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { reloadAsk } from '@/utility/reload-ask.js';
|
|
||||||
import FormSection from '@/components/form/section.vue';
|
import FormSection from '@/components/form/section.vue';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
import MkRolePreview from '@/components/MkRolePreview.vue';
|
import MkRolePreview from '@/components/MkRolePreview.vue';
|
||||||
import { signout } from '@/signout.js';
|
import { signout } from '@/signout.js';
|
||||||
import { migrateOldSettings } from '@/pref-migrate.js';
|
import { migrateOldSettings } from '@/pref-migrate.js';
|
||||||
import { hideAllTips as _hideAllTips, resetAllTips as _resetAllTips } from '@/tips.js';
|
import { hideAllTips as _hideAllTips, resetAllTips as _resetAllTips } from '@/tips.js';
|
||||||
|
import { suggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const $i = ensureSignin();
|
const $i = ensureSignin();
|
||||||
|
|
||||||
|
@ -172,8 +172,8 @@ const devMode = prefer.model('devMode');
|
||||||
const stackingRouterView = prefer.model('experimental.stackingRouterView');
|
const stackingRouterView = prefer.model('experimental.stackingRouterView');
|
||||||
const enableFolderPageView = prefer.model('experimental.enableFolderPageView');
|
const enableFolderPageView = prefer.model('experimental.enableFolderPageView');
|
||||||
|
|
||||||
watch(skipNoteRender, async () => {
|
watch(skipNoteRender, () => {
|
||||||
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
suggestReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
async function deleteAccount() {
|
async function deleteAccount() {
|
||||||
|
|
|
@ -795,7 +795,6 @@ import MkInfo from '@/components/MkInfo.vue';
|
||||||
import { store } from '@/store.js';
|
import { store } from '@/store.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { misskeyApi } from '@/utility/misskey-api.js';
|
import { misskeyApi } from '@/utility/misskey-api.js';
|
||||||
import { reloadAsk } from '@/utility/reload-ask.js';
|
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
import { definePage } from '@/page.js';
|
import { definePage } from '@/page.js';
|
||||||
import { miLocalStorage } from '@/local-storage.js';
|
import { miLocalStorage } from '@/local-storage.js';
|
||||||
|
@ -807,6 +806,7 @@ import { claimAchievement } from '@/utility/achievements.js';
|
||||||
import { instance } from '@/instance.js';
|
import { instance } from '@/instance.js';
|
||||||
import { ensureSignin } from '@/i.js';
|
import { ensureSignin } from '@/i.js';
|
||||||
import { genId } from '@/utility/id.js';
|
import { genId } from '@/utility/id.js';
|
||||||
|
import { suggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const $i = ensureSignin();
|
const $i = ensureSignin();
|
||||||
|
|
||||||
|
@ -928,8 +928,8 @@ watch([
|
||||||
enablePullToRefresh,
|
enablePullToRefresh,
|
||||||
reduceAnimation,
|
reduceAnimation,
|
||||||
showAvailableReactionsFirstInNote,
|
showAvailableReactionsFirstInNote,
|
||||||
], async () => {
|
], () => {
|
||||||
await reloadAsk({ reason: i18n.ts.reloadToApplySetting, unison: true });
|
suggestReload();
|
||||||
});
|
});
|
||||||
|
|
||||||
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
||||||
|
|
|
@ -48,10 +48,6 @@ function skip() {
|
||||||
.title {
|
.title {
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
|
||||||
&:empty {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.body {
|
.body {
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div :class="$style.root">
|
||||||
|
<span :class="$style.icon">
|
||||||
|
<i class="ti ti-info-circle"></i>
|
||||||
|
</span>
|
||||||
|
<span :class="$style.title">{{ i18n.ts.reloadRequiredToApplySettings }}</span>
|
||||||
|
<span :class="$style.body"><button class="_textButton" style="color: var(--MI_THEME-fgOnAccent);" @click="reload">{{ i18n.ts.reload }}</button> | <button class="_textButton" style="color: var(--MI_THEME-fgOnAccent);" @click="skip">{{ i18n.ts.skip }}</button></span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { i18n } from '@/i18n.js';
|
||||||
|
import { shouldSuggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
import { unisonReload } from '@/utility/unison-reload.js';
|
||||||
|
|
||||||
|
function reload() {
|
||||||
|
unisonReload();
|
||||||
|
}
|
||||||
|
|
||||||
|
function skip() {
|
||||||
|
shouldSuggestReload.value = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.root {
|
||||||
|
--height: 24px;
|
||||||
|
font-size: 0.85em;
|
||||||
|
display: flex;
|
||||||
|
vertical-align: bottom;
|
||||||
|
width: 100%;
|
||||||
|
line-height: var(--height);
|
||||||
|
height: var(--height);
|
||||||
|
overflow: clip;
|
||||||
|
contain: strict;
|
||||||
|
background: var(--MI_THEME-accent);
|
||||||
|
color: var(--MI_THEME-fgOnAccent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
margin-left: 10px;
|
||||||
|
animation: blink 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
padding: 0 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
animation: blink 2s infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.body {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
overflow: clip;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes blink {
|
||||||
|
0% { opacity: 1; }
|
||||||
|
10% { opacity: 1; }
|
||||||
|
50% { opacity: 0; }
|
||||||
|
90% { opacity: 1; }
|
||||||
|
100% { opacity: 1; }
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -13,6 +13,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div :class="[$style.main, { [$style.withWallpaper]: withWallpaper, [$style.withSidebarAndTitlebar]: !isMobile && prefer.r['deck.navbarPosition'].value === 'left' && prefer.r.showTitlebar.value }]" :style="{ backgroundImage: prefer.s['deck.wallpaper'] != null ? `url(${ prefer.s['deck.wallpaper'] })` : null }">
|
<div :class="[$style.main, { [$style.withWallpaper]: withWallpaper, [$style.withSidebarAndTitlebar]: !isMobile && prefer.r['deck.navbarPosition'].value === 'left' && prefer.r.showTitlebar.value }]" :style="{ backgroundImage: prefer.s['deck.wallpaper'] != null ? `url(${ prefer.s['deck.wallpaper'] })` : null }">
|
||||||
<XNavbarH v-if="!isMobile && prefer.r['deck.navbarPosition'].value === 'top'"/>
|
<XNavbarH v-if="!isMobile && prefer.r['deck.navbarPosition'].value === 'top'"/>
|
||||||
|
|
||||||
|
<XReloadSuggest v-if="shouldSuggestReload"/>
|
||||||
|
<XPreferenceRestore v-if="shouldSuggestRestoreBackup"/>
|
||||||
<XAnnouncements v-if="$i"/>
|
<XAnnouncements v-if="$i"/>
|
||||||
<XStatusBars/>
|
<XStatusBars/>
|
||||||
<div :class="$style.columnsWrapper">
|
<div :class="$style.columnsWrapper">
|
||||||
|
@ -81,12 +83,14 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { defineAsyncComponent, ref, useTemplateRef } from 'vue';
|
import { defineAsyncComponent, ref, useTemplateRef } from 'vue';
|
||||||
import { genId } from '@/utility/id.js';
|
|
||||||
import XCommon from './_common_/common.vue';
|
import XCommon from './_common_/common.vue';
|
||||||
|
import { genId } from '@/utility/id.js';
|
||||||
import XSidebar from '@/ui/_common_/navbar.vue';
|
import XSidebar from '@/ui/_common_/navbar.vue';
|
||||||
import XNavbarH from '@/ui/_common_/navbar-h.vue';
|
import XNavbarH from '@/ui/_common_/navbar-h.vue';
|
||||||
import XMobileFooterMenu from '@/ui/_common_/mobile-footer-menu.vue';
|
import XMobileFooterMenu from '@/ui/_common_/mobile-footer-menu.vue';
|
||||||
import XTitlebar from '@/ui/_common_/titlebar.vue';
|
import XTitlebar from '@/ui/_common_/titlebar.vue';
|
||||||
|
import XPreferenceRestore from '@/ui/_common_/PreferenceRestore.vue';
|
||||||
|
import XReloadSuggest from '@/ui/_common_/ReloadSuggest.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { $i } from '@/i.js';
|
import { $i } from '@/i.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
@ -105,6 +109,8 @@ import XRoleTimelineColumn from '@/ui/deck/role-timeline-column.vue';
|
||||||
import XChatColumn from '@/ui/deck/chat-column.vue';
|
import XChatColumn from '@/ui/deck/chat-column.vue';
|
||||||
import { mainRouter } from '@/router.js';
|
import { mainRouter } from '@/router.js';
|
||||||
import { columns, layout, columnTypes, switchProfileMenu, addColumn as addColumnToStore, deleteProfile as deleteProfile_ } from '@/deck.js';
|
import { columns, layout, columnTypes, switchProfileMenu, addColumn as addColumnToStore, deleteProfile as deleteProfile_ } from '@/deck.js';
|
||||||
|
import { shouldSuggestRestoreBackup } from '@/preferences/utility.js';
|
||||||
|
import { shouldSuggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
|
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
|
||||||
const XAnnouncements = defineAsyncComponent(() => import('@/ui/_common_/announcements.vue'));
|
const XAnnouncements = defineAsyncComponent(() => import('@/ui/_common_/announcements.vue'));
|
||||||
|
|
|
@ -12,6 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<div :class="[$style.contents, !isMobile && prefer.r.showTitlebar.value ? $style.withSidebarAndTitlebar : null]" @contextmenu.stop="onContextmenu">
|
<div :class="[$style.contents, !isMobile && prefer.r.showTitlebar.value ? $style.withSidebarAndTitlebar : null]" @contextmenu.stop="onContextmenu">
|
||||||
<div>
|
<div>
|
||||||
|
<XReloadSuggest v-if="shouldSuggestReload"/>
|
||||||
<XPreferenceRestore v-if="shouldSuggestRestoreBackup"/>
|
<XPreferenceRestore v-if="shouldSuggestRestoreBackup"/>
|
||||||
<XAnnouncements v-if="$i"/>
|
<XAnnouncements v-if="$i"/>
|
||||||
<XStatusBars :class="$style.statusbars"/>
|
<XStatusBars :class="$style.statusbars"/>
|
||||||
|
@ -38,6 +39,7 @@ import XCommon from './_common_/common.vue';
|
||||||
import type { PageMetadata } from '@/page.js';
|
import type { PageMetadata } from '@/page.js';
|
||||||
import XMobileFooterMenu from '@/ui/_common_/mobile-footer-menu.vue';
|
import XMobileFooterMenu from '@/ui/_common_/mobile-footer-menu.vue';
|
||||||
import XPreferenceRestore from '@/ui/_common_/PreferenceRestore.vue';
|
import XPreferenceRestore from '@/ui/_common_/PreferenceRestore.vue';
|
||||||
|
import XReloadSuggest from '@/ui/_common_/ReloadSuggest.vue';
|
||||||
import XTitlebar from '@/ui/_common_/titlebar.vue';
|
import XTitlebar from '@/ui/_common_/titlebar.vue';
|
||||||
import XSidebar from '@/ui/_common_/navbar.vue';
|
import XSidebar from '@/ui/_common_/navbar.vue';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
|
@ -50,6 +52,7 @@ import { mainRouter } from '@/router.js';
|
||||||
import { prefer } from '@/preferences.js';
|
import { prefer } from '@/preferences.js';
|
||||||
import { shouldSuggestRestoreBackup } from '@/preferences/utility.js';
|
import { shouldSuggestRestoreBackup } from '@/preferences/utility.js';
|
||||||
import { DI } from '@/di.js';
|
import { DI } from '@/di.js';
|
||||||
|
import { shouldSuggestReload } from '@/utility/reload-suggest.js';
|
||||||
|
|
||||||
const XWidgets = defineAsyncComponent(() => import('./_common_/widgets.vue'));
|
const XWidgets = defineAsyncComponent(() => import('./_common_/widgets.vue'));
|
||||||
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
|
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { i18n } from '@/i18n.js';
|
|
||||||
import * as os from '@/os.js';
|
|
||||||
import { unisonReload } from '@/utility/unison-reload.js';
|
|
||||||
|
|
||||||
let isReloadConfirming = false;
|
|
||||||
|
|
||||||
export async function reloadAsk(opts: {
|
|
||||||
unison?: boolean;
|
|
||||||
reason?: string;
|
|
||||||
}) {
|
|
||||||
if (isReloadConfirming) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
isReloadConfirming = true;
|
|
||||||
|
|
||||||
const { canceled } = await os.confirm(opts.reason == null ? {
|
|
||||||
type: 'info',
|
|
||||||
text: i18n.ts.reloadConfirm,
|
|
||||||
} : {
|
|
||||||
type: 'info',
|
|
||||||
title: i18n.ts.reloadConfirm,
|
|
||||||
text: opts.reason,
|
|
||||||
}).finally(() => {
|
|
||||||
isReloadConfirming = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (canceled) return;
|
|
||||||
|
|
||||||
if (opts.unison) {
|
|
||||||
unisonReload();
|
|
||||||
} else {
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
export const shouldSuggestReload = ref(false);
|
||||||
|
|
||||||
|
export function suggestReload() {
|
||||||
|
shouldSuggestReload.value = true;
|
||||||
|
}
|
Loading…
Reference in New Issue