diff --git a/packages/client/package.json b/packages/client/package.json index 83c8086e2..f1ab23a55 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -77,7 +77,6 @@ "vite": "2.9.10", "vue": "3.2.37", "vue-prism-editor": "2.0.0-alpha.2", - "vue-router": "4.0.16", "vuedraggable": "4.0.1", "websocket": "1.0.34", "ws": "8.8.0" diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index ce4af61f1..2b07dd199 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -1,11 +1,11 @@ -import { del, get, set } from '@/scripts/idb-proxy'; import { defineAsyncComponent, reactive } from 'vue'; import * as misskey from 'misskey-js'; +import { showSuspendedDialog } from './scripts/show-suspended-dialog'; +import { i18n } from './i18n'; +import { del, get, set } from '@/scripts/idb-proxy'; import { apiUrl } from '@/config'; import { waiting, api, popup, popupMenu, success, alert } from '@/os'; import { unisonReload, reloadChannel } from '@/scripts/unison-reload'; -import { showSuspendedDialog } from './scripts/show-suspended-dialog'; -import { i18n } from './i18n'; // TODO: 他のタブと永続化されたstateを同期 @@ -22,13 +22,7 @@ export async function signout() { waiting(); localStorage.removeItem('account'); - //#region Remove account - const accounts = await getAccounts(); - accounts.splice(accounts.findIndex(x => x.id === $i.id), 1); - - if (accounts.length > 0) await set('accounts', accounts); - else await del('accounts'); - //#endregion + await removeAccount($i.id); //#region Remove service worker registration try { @@ -55,7 +49,7 @@ export async function signout() { } catch (err) {} //#endregion - document.cookie = `igi=; path=/`; + document.cookie = 'igi=; path=/'; if (accounts.length > 0) login(accounts[0].token); else unisonReload('/'); @@ -72,14 +66,22 @@ export async function addAccount(id: Account['id'], token: Account['token']) { } } +export async function removeAccount(id: Account['id']) { + const accounts = await getAccounts(); + accounts.splice(accounts.findIndex(x => x.id === id), 1); + + if (accounts.length > 0) await set('accounts', accounts); + else await del('accounts'); +} + function fetchAccount(token: string): Promise { return new Promise((done, fail) => { // Fetch user fetch(`${apiUrl}/i`, { method: 'POST', body: JSON.stringify({ - i: token - }) + i: token, + }), }) .then(res => res.json()) .then(res => { @@ -216,13 +218,13 @@ export async function openAccountMenu(opts: { type: 'link', icon: 'fas fa-users', text: i18n.ts.manageAccounts, - to: `/settings/accounts`, + to: '/settings/accounts', }]], ev.currentTarget ?? ev.target, { - align: 'left' + align: 'left', }); } else { popupMenu([...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises], ev.currentTarget ?? ev.target, { - align: 'left' + align: 'left', }); } } diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue index 4e9c4e587..5e9c2f03b 100644 --- a/packages/client/src/components/chart.vue +++ b/packages/client/src/components/chart.vue @@ -13,7 +13,7 @@ id-denylist violation when setting it. This is causing about 60+ lint issues. As this is part of Chart.js's API it makes sense to disable the check here. */ -import { defineProps, onMounted, ref, watch, PropType, onUnmounted } from 'vue'; +import { onMounted, ref, watch, PropType, onUnmounted } from 'vue'; import { Chart, ArcElement, @@ -53,7 +53,7 @@ const props = defineProps({ limit: { type: Number, required: false, - default: 90 + default: 90, }, span: { type: String as PropType<'hour' | 'day'>, @@ -62,22 +62,22 @@ const props = defineProps({ detailed: { type: Boolean, required: false, - default: false + default: false, }, stacked: { type: Boolean, required: false, - default: false + default: false, }, bar: { type: Boolean, required: false, - default: false + default: false, }, aspectRatio: { type: Number, required: false, - default: null + default: null, }, }); @@ -156,7 +156,7 @@ const getDate = (ago: number) => { const format = (arr) => { return arr.map((v, i) => ({ x: getDate(i).getTime(), - y: v + y: v, })); }; @@ -343,7 +343,7 @@ const render = () => { min: 'original', max: 'original', }, - } + }, } : undefined, //gradient, }, @@ -367,8 +367,8 @@ const render = () => { ctx.stroke(); ctx.restore(); } - } - }] + }, + }], }); }; @@ -433,18 +433,18 @@ const fetchApRequestChart = async (): Promise => { name: 'In', type: 'area', color: '#008FFB', - data: format(raw.inboxReceived) + data: format(raw.inboxReceived), }, { name: 'Out (succ)', type: 'area', color: '#00E396', - data: format(raw.deliverSucceeded) + data: format(raw.deliverSucceeded), }, { name: 'Out (fail)', type: 'area', color: '#FEB019', - data: format(raw.deliverFailed) - }] + data: format(raw.deliverFailed), + }], }; }; @@ -456,7 +456,7 @@ const fetchNotesChart = async (type: string): Promise => { type: 'line', data: format(type === 'combined' ? sum(raw.local.inc, negate(raw.local.dec), raw.remote.inc, negate(raw.remote.dec)) - : sum(raw[type].inc, negate(raw[type].dec)) + : sum(raw[type].inc, negate(raw[type].dec)), ), color: '#888888', }, { @@ -464,7 +464,7 @@ const fetchNotesChart = async (type: string): Promise => { type: 'area', data: format(type === 'combined' ? sum(raw.local.diffs.renote, raw.remote.diffs.renote) - : raw[type].diffs.renote + : raw[type].diffs.renote, ), color: colors.green, }, { @@ -472,7 +472,7 @@ const fetchNotesChart = async (type: string): Promise => { type: 'area', data: format(type === 'combined' ? sum(raw.local.diffs.reply, raw.remote.diffs.reply) - : raw[type].diffs.reply + : raw[type].diffs.reply, ), color: colors.yellow, }, { @@ -480,7 +480,7 @@ const fetchNotesChart = async (type: string): Promise => { type: 'area', data: format(type === 'combined' ? sum(raw.local.diffs.normal, raw.remote.diffs.normal) - : raw[type].diffs.normal + : raw[type].diffs.normal, ), color: colors.blue, }, { @@ -488,7 +488,7 @@ const fetchNotesChart = async (type: string): Promise => { type: 'area', data: format(type === 'combined' ? sum(raw.local.diffs.withFile, raw.remote.diffs.withFile) - : raw[type].diffs.withFile + : raw[type].diffs.withFile, ), color: colors.purple, }], @@ -522,21 +522,21 @@ const fetchUsersChart = async (total: boolean): Promise => { type: 'line', data: format(total ? sum(raw.local.total, raw.remote.total) - : sum(raw.local.inc, negate(raw.local.dec), raw.remote.inc, negate(raw.remote.dec)) + : sum(raw.local.inc, negate(raw.local.dec), raw.remote.inc, negate(raw.remote.dec)), ), }, { name: 'Local', type: 'area', data: format(total ? raw.local.total - : sum(raw.local.inc, negate(raw.local.dec)) + : sum(raw.local.inc, negate(raw.local.dec)), ), }, { name: 'Remote', type: 'area', data: format(total ? raw.remote.total - : sum(raw.remote.inc, negate(raw.remote.dec)) + : sum(raw.remote.inc, negate(raw.remote.dec)), ), }], }; @@ -607,8 +607,8 @@ const fetchDriveChart = async (): Promise => { raw.local.incSize, negate(raw.local.decSize), raw.remote.incSize, - negate(raw.remote.decSize) - ) + negate(raw.remote.decSize), + ), ), }, { name: 'Local +', @@ -642,8 +642,8 @@ const fetchDriveFilesChart = async (): Promise => { raw.local.incCount, negate(raw.local.decCount), raw.remote.incCount, - negate(raw.remote.decCount) - ) + negate(raw.remote.decCount), + ), ), }, { name: 'Local +', @@ -672,18 +672,18 @@ const fetchInstanceRequestsChart = async (): Promise => { name: 'In', type: 'area', color: '#008FFB', - data: format(raw.requests.received) + data: format(raw.requests.received), }, { name: 'Out (succ)', type: 'area', color: '#00E396', - data: format(raw.requests.succeeded) + data: format(raw.requests.succeeded), }, { name: 'Out (fail)', type: 'area', color: '#FEB019', - data: format(raw.requests.failed) - }] + data: format(raw.requests.failed), + }], }; }; @@ -696,9 +696,9 @@ const fetchInstanceUsersChart = async (total: boolean): Promise = color: '#008FFB', data: format(total ? raw.following.total - : sum(raw.following.inc, negate(raw.following.dec)) - ) + : sum(raw.following.inc, negate(raw.following.dec)), + ), }, { name: 'Followers', type: 'area', color: '#00E396', data: format(total ? raw.followers.total - : sum(raw.followers.inc, negate(raw.followers.dec)) - ) - }] + : sum(raw.followers.inc, negate(raw.followers.dec)), + ), + }], }; }; @@ -750,9 +750,9 @@ const fetchInstanceDriveUsageChart = async (total: boolean): Promise { .zdjebgpv { position: relative; display: flex; - background: #e1e1e1; + background: var(--panel); border-radius: 8px; overflow: clip; diff --git a/packages/client/src/components/form/folder.vue b/packages/client/src/components/form/folder.vue index 1b960657d..a9d8bd97b 100644 --- a/packages/client/src/components/form/folder.vue +++ b/packages/client/src/components/form/folder.vue @@ -9,13 +9,13 @@ - +
-
+ diff --git a/packages/client/src/components/global/a.vue b/packages/client/src/components/global/a.vue index 5287d59b3..c7cf12e8c 100644 --- a/packages/client/src/components/global/a.vue +++ b/packages/client/src/components/global/a.vue @@ -5,13 +5,13 @@ diff --git a/packages/client/src/components/global/header.vue b/packages/client/src/components/global/header.vue deleted file mode 100644 index 63db19a52..000000000 --- a/packages/client/src/components/global/header.vue +++ /dev/null @@ -1,361 +0,0 @@ - - - - - diff --git a/packages/client/src/components/global/page-header.vue b/packages/client/src/components/global/page-header.vue new file mode 100644 index 000000000..c01631c6a --- /dev/null +++ b/packages/client/src/components/global/page-header.vue @@ -0,0 +1,300 @@ + + + + + diff --git a/packages/client/src/components/global/router-view.vue b/packages/client/src/components/global/router-view.vue new file mode 100644 index 000000000..393ba30c3 --- /dev/null +++ b/packages/client/src/components/global/router-view.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/client/src/components/index.ts b/packages/client/src/components/index.ts index 26bac6324..aa8a591e5 100644 --- a/packages/client/src/components/index.ts +++ b/packages/client/src/components/index.ts @@ -10,15 +10,17 @@ import MkEllipsis from './global/ellipsis.vue'; import MkTime from './global/time.vue'; import MkUrl from './global/url.vue'; import I18n from './global/i18n'; +import RouterView from './global/router-view.vue'; import MkLoading from './global/loading.vue'; import MkError from './global/error.vue'; import MkAd from './global/ad.vue'; -import MkHeader from './global/header.vue'; +import MkPageHeader from './global/page-header.vue'; import MkSpacer from './global/spacer.vue'; import MkStickyContainer from './global/sticky-container.vue'; export default function(app: App) { app.component('I18n', I18n); + app.component('RouterView', RouterView); app.component('Mfm', Mfm); app.component('MkA', MkA); app.component('MkAcct', MkAcct); @@ -31,7 +33,7 @@ export default function(app: App) { app.component('MkLoading', MkLoading); app.component('MkError', MkError); app.component('MkAd', MkAd); - app.component('MkHeader', MkHeader); + app.component('MkPageHeader', MkPageHeader); app.component('MkSpacer', MkSpacer); app.component('MkStickyContainer', MkStickyContainer); } @@ -39,6 +41,7 @@ export default function(app: App) { declare module '@vue/runtime-core' { export interface GlobalComponents { I18n: typeof I18n; + RouterView: typeof RouterView; Mfm: typeof Mfm; MkA: typeof MkA; MkAcct: typeof MkAcct; @@ -51,7 +54,7 @@ declare module '@vue/runtime-core' { MkLoading: typeof MkLoading; MkError: typeof MkError; MkAd: typeof MkAd; - MkHeader: typeof MkHeader; + MkPageHeader: typeof MkPageHeader; MkSpacer: typeof MkSpacer; MkStickyContainer: typeof MkStickyContainer; } diff --git a/packages/client/src/components/modal-page-window.vue b/packages/client/src/components/modal-page-window.vue index 21bdb657b..aef70f113 100644 --- a/packages/client/src/components/modal-page-window.vue +++ b/packages/client/src/components/modal-page-window.vue @@ -1,163 +1,118 @@ - diff --git a/packages/client/src/pages/admin/abuses.vue b/packages/client/src/pages/admin/abuses.vue index e1d0361c0..2b6dadf7c 100644 --- a/packages/client/src/pages/admin/abuses.vue +++ b/packages/client/src/pages/admin/abuses.vue @@ -1,28 +1,31 @@ diff --git a/packages/client/src/pages/admin/ads.vue b/packages/client/src/pages/admin/ads.vue index b18e08db9..05557469e 100644 --- a/packages/client/src/pages/admin/ads.vue +++ b/packages/client/src/pages/admin/ads.vue @@ -1,21 +1,23 @@ diff --git a/packages/client/src/pages/admin/announcements.vue b/packages/client/src/pages/admin/announcements.vue index 97774975d..025897d09 100644 --- a/packages/client/src/pages/admin/announcements.vue +++ b/packages/client/src/pages/admin/announcements.vue @@ -1,34 +1,40 @@ diff --git a/packages/client/src/pages/admin/bot-protection.vue b/packages/client/src/pages/admin/bot-protection.vue index 30fee5015..d2e7919b4 100644 --- a/packages/client/src/pages/admin/bot-protection.vue +++ b/packages/client/src/pages/admin/bot-protection.vue @@ -51,7 +51,6 @@ import FormButton from '@/components/ui/button.vue'; import FormSuspense from '@/components/form/suspense.vue'; import FormSlot from '@/components/form/slot.vue'; import * as os from '@/os'; -import * as symbols from '@/symbols'; import { fetchInstance } from '@/instance'; const MkCaptcha = defineAsyncComponent(() => import('@/components/captcha.vue')); diff --git a/packages/client/src/pages/admin/database.vue b/packages/client/src/pages/admin/database.vue index d3519922b..b9c5f9e39 100644 --- a/packages/client/src/pages/admin/database.vue +++ b/packages/client/src/pages/admin/database.vue @@ -1,12 +1,13 @@ -