From 6ebab5f57737842b609688c89a0063f10d247b9a Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 28 Jan 2022 11:19:18 +0900 Subject: [PATCH 01/10] chore(client): improve chart rendering --- packages/client/src/components/chart.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue index 1959271f5..d17c0c9f3 100644 --- a/packages/client/src/components/chart.vue +++ b/packages/client/src/components/chart.vue @@ -143,6 +143,7 @@ export default defineComponent({ } const gridColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'; + const vLineColor = defaultStore.state.darkMode ? 'rgba(255, 255, 255, 0.2)' : 'rgba(0, 0, 0, 0.2)'; // フォントカラー Chart.defaults.color = getComputedStyle(document.documentElement).getPropertyValue('--fg'); @@ -255,6 +256,27 @@ export default defineComponent({ }, }, }, + plugins: [{ + id: 'vLine', + beforeDraw(chart, args, options) { + if (chart.tooltip._active && chart.tooltip._active.length) { + const activePoint = chart.tooltip._active[0]; + const ctx = chart.ctx; + const x = activePoint.element.x; + const topY = chart.scales.y.top; + const bottomY = chart.scales.y.bottom; + + ctx.save(); + ctx.beginPath(); + ctx.moveTo(x, bottomY); + ctx.lineTo(x, topY); + ctx.lineWidth = 1; + ctx.strokeStyle = vLineColor; + ctx.stroke(); + ctx.restore(); + } + } + }] }); }; From 57ec04d9ecc51060225bb15867215c7475685f92 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 28 Jan 2022 11:39:49 +0900 Subject: [PATCH 02/10] refactor(client): i18n.locale -> i18n.ts --- packages/client/src/account.ts | 10 +-- .../src/components/abuse-report-window.vue | 10 +-- .../client/src/components/autocomplete.vue | 2 +- packages/client/src/components/captcha.vue | 2 +- .../src/components/channel-follow-button.vue | 6 +- .../client/src/components/channel-preview.vue | 6 +- packages/client/src/components/cw-button.vue | 4 +- packages/client/src/components/dialog.vue | 4 +- .../src/components/drive-select-dialog.vue | 2 +- .../client/src/components/drive-window.vue | 2 +- packages/client/src/components/drive.file.vue | 26 ++++---- .../client/src/components/drive.folder.vue | 24 +++---- .../src/components/drive.nav-folder.vue | 2 +- packages/client/src/components/drive.vue | 50 +++++++-------- .../client/src/components/emoji-picker.vue | 10 +-- .../client/src/components/follow-button.vue | 12 ++-- .../client/src/components/forgot-password.vue | 14 ++--- packages/client/src/components/global/a.vue | 10 +-- .../client/src/components/global/header.vue | 2 +- .../client/src/components/global/time.vue | 6 +- .../client/src/components/note-detailed.vue | 2 +- packages/client/src/components/note.vue | 16 ++--- packages/client/src/components/post-form.vue | 58 ++++++++--------- .../client/src/components/renote-button.vue | 4 +- .../src/components/user-online-indicator.vue | 8 +-- packages/client/src/init.ts | 8 +-- packages/client/src/menu.ts | 12 ++-- packages/client/src/pages/_error_.vue | 16 ++--- packages/client/src/pages/about-misskey.vue | 18 +++--- packages/client/src/pages/about.vue | 2 +- packages/client/src/pages/admin/emojis.vue | 20 +++--- packages/client/src/pages/admin/index.vue | 62 +++++++++---------- packages/client/src/pages/drive.vue | 2 +- packages/client/src/pages/emojis.emoji.vue | 2 +- packages/client/src/pages/emojis.vue | 6 +- packages/client/src/pages/favorites.vue | 2 +- packages/client/src/pages/featured.vue | 2 +- packages/client/src/pages/federation.vue | 2 +- packages/client/src/pages/follow-requests.vue | 2 +- packages/client/src/pages/mentions.vue | 2 +- packages/client/src/pages/messages.vue | 2 +- .../client/src/pages/my-antennas/create.vue | 2 +- packages/client/src/pages/my-clips/index.vue | 10 +-- packages/client/src/pages/my-lists/index.vue | 4 +- packages/client/src/pages/not-found.vue | 2 +- packages/client/src/pages/notifications.vue | 12 ++-- packages/client/src/pages/preview.vue | 2 +- packages/client/src/pages/reset-password.vue | 6 +- packages/client/src/pages/settings/email.vue | 4 +- .../src/pages/settings/import-export.vue | 6 +- packages/client/src/pages/settings/index.vue | 48 +++++++------- .../client/src/pages/settings/mute-block.vue | 2 +- .../client/src/pages/settings/privacy.vue | 2 +- .../client/src/pages/settings/profile.vue | 50 +++++++-------- .../src/pages/settings/theme.install.vue | 14 ++--- packages/client/src/pages/settings/theme.vue | 2 +- packages/client/src/pages/signup-complete.vue | 6 +- packages/client/src/pages/theme-editor.vue | 26 ++++---- packages/client/src/pages/timeline.vue | 20 +++--- packages/client/src/scripts/get-note-menu.ts | 60 +++++++++--------- .../client/src/scripts/get-note-summary.ts | 6 +- packages/client/src/scripts/get-user-menu.ts | 36 +++++------ packages/client/src/scripts/i18n.ts | 10 +-- packages/client/src/scripts/lookup-user.ts | 4 +- packages/client/src/scripts/please-login.ts | 2 +- packages/client/src/scripts/search.ts | 4 +- packages/client/src/scripts/select-file.ts | 14 ++--- .../src/scripts/show-suspended-dialog.ts | 4 +- .../client/src/scripts/use-leave-guard.ts | 4 +- packages/client/src/ui/deck.vue | 4 +- packages/client/src/ui/deck/deck-store.ts | 4 +- packages/client/src/ui/universal.vue | 4 +- packages/client/src/widgets/calendar.vue | 14 ++--- packages/client/src/widgets/timeline.vue | 8 +-- 74 files changed, 424 insertions(+), 424 deletions(-) diff --git a/packages/client/src/account.ts b/packages/client/src/account.ts index 5a935e1dc..a04d0378c 100644 --- a/packages/client/src/account.ts +++ b/packages/client/src/account.ts @@ -192,25 +192,25 @@ export async function openAccountMenu(opts: { if (opts.withExtraOperation) { popupMenu([...[{ type: 'link', - text: i18n.locale.profile, + text: i18n.ts.profile, to: `/@${ $i.username }`, avatar: $i, }, null, ...(opts.includeCurrentAccount ? [createItem($i)] : []), ...accountItemPromises, { icon: 'fas fa-plus', - text: i18n.locale.addAccount, + text: i18n.ts.addAccount, action: () => { popupMenu([{ - text: i18n.locale.existingAccount, + text: i18n.ts.existingAccount, action: () => { showSigninDialog(); }, }, { - text: i18n.locale.createAccount, + text: i18n.ts.createAccount, action: () => { createAccount(); }, }], ev.currentTarget || ev.target); }, }, { type: 'link', icon: 'fas fa-users', - text: i18n.locale.manageAccounts, + text: i18n.ts.manageAccounts, to: `/settings/accounts`, }]], ev.currentTarget || ev.target, { align: 'left' diff --git a/packages/client/src/components/abuse-report-window.vue b/packages/client/src/components/abuse-report-window.vue index cd04f62bc..f2cb36980 100644 --- a/packages/client/src/components/abuse-report-window.vue +++ b/packages/client/src/components/abuse-report-window.vue @@ -2,7 +2,7 @@ diff --git a/packages/client/src/components/channel-preview.vue b/packages/client/src/components/channel-preview.vue index 8d135a192..dd3794a65 100644 --- a/packages/client/src/components/channel-preview.vue +++ b/packages/client/src/components/channel-preview.vue @@ -6,7 +6,7 @@
- + @@ -14,7 +14,7 @@
- + @@ -27,7 +27,7 @@
- {{ i18n.locale.updatedAt }}: + {{ i18n.ts.updatedAt }}:
diff --git a/packages/client/src/components/cw-button.vue b/packages/client/src/components/cw-button.vue index ccfd11462..e7c9aabe4 100644 --- a/packages/client/src/components/cw-button.vue +++ b/packages/client/src/components/cw-button.vue @@ -1,6 +1,6 @@ @@ -25,7 +25,7 @@ const label = computed(() => { return concat([ props.note.text ? [i18n.t('_cw.chars', { count: length(props.note.text) })] : [], props.note.files && props.note.files.length !== 0 ? [i18n.t('_cw.files', { count: props.note.files.length }) ] : [], - props.note.poll != null ? [i18n.locale.poll] : [] + props.note.poll != null ? [i18n.ts.poll] : [] ] as string[][]).join(' / '); }); diff --git a/packages/client/src/components/dialog.vue b/packages/client/src/components/dialog.vue index b6b649cde..3e106a4f0 100644 --- a/packages/client/src/components/dialog.vue +++ b/packages/client/src/components/dialog.vue @@ -28,8 +28,8 @@
- {{ (showCancelButton || input || select) ? i18n.locale.ok : i18n.locale.gotIt }} - {{ i18n.locale.cancel }} + {{ (showCancelButton || input || select) ? i18n.ts.ok : i18n.ts.gotIt }} + {{ i18n.ts.cancel }}
{{ action.text }} diff --git a/packages/client/src/components/drive-select-dialog.vue b/packages/client/src/components/drive-select-dialog.vue index 6d8451127..f6c59457d 100644 --- a/packages/client/src/components/drive-select-dialog.vue +++ b/packages/client/src/components/drive-select-dialog.vue @@ -10,7 +10,7 @@ @closed="emit('closed')" > diff --git a/packages/client/src/components/drive-window.vue b/packages/client/src/components/drive-window.vue index 8b60bf779..d08c5fb67 100644 --- a/packages/client/src/components/drive-window.vue +++ b/packages/client/src/components/drive-window.vue @@ -6,7 +6,7 @@ @closed="emit('closed')" > diff --git a/packages/client/src/components/drive.file.vue b/packages/client/src/components/drive.file.vue index fd6a81383..669c0d7db 100644 --- a/packages/client/src/components/drive.file.vue +++ b/packages/client/src/components/drive.file.vue @@ -10,15 +10,15 @@ >
-

{{ i18n.locale.avatar }}

+

{{ i18n.ts.avatar }}

-

{{ i18n.locale.banner }}

+

{{ i18n.ts.banner }}

-

{{ i18n.locale.nsfw }}

+

{{ i18n.ts.nsfw }}

@@ -61,30 +61,30 @@ const title = computed(() => `${props.file.name}\n${props.file.type} ${bytes(pro function getMenu() { return [{ - text: i18n.locale.rename, + text: i18n.ts.rename, icon: 'fas fa-i-cursor', action: rename }, { - text: props.file.isSensitive ? i18n.locale.unmarkAsSensitive : i18n.locale.markAsSensitive, + text: props.file.isSensitive ? i18n.ts.unmarkAsSensitive : i18n.ts.markAsSensitive, icon: props.file.isSensitive ? 'fas fa-eye' : 'fas fa-eye-slash', action: toggleSensitive }, { - text: i18n.locale.describeFile, + text: i18n.ts.describeFile, icon: 'fas fa-i-cursor', action: describe }, null, { - text: i18n.locale.copyUrl, + text: i18n.ts.copyUrl, icon: 'fas fa-link', action: copyUrl }, { type: 'a', href: props.file.url, target: '_blank', - text: i18n.locale.download, + text: i18n.ts.download, icon: 'fas fa-download', download: props.file.name }, null, { - text: i18n.locale.delete, + text: i18n.ts.delete, icon: 'fas fa-trash-alt', danger: true, action: deleteFile @@ -120,8 +120,8 @@ function onDragend() { function rename() { os.inputText({ - title: i18n.locale.renameFile, - placeholder: i18n.locale.inputNewFileName, + title: i18n.ts.renameFile, + placeholder: i18n.ts.inputNewFileName, default: props.file.name, }).then(({ canceled, result: name }) => { if (canceled) return; @@ -134,9 +134,9 @@ function rename() { function describe() { os.popup(import('@/components/media-caption.vue'), { - title: i18n.locale.describeFile, + title: i18n.ts.describeFile, input: { - placeholder: i18n.locale.inputNewDescription, + placeholder: i18n.ts.inputNewDescription, default: props.file.comment !== null ? props.file.comment : '', }, image: props.file diff --git a/packages/client/src/components/drive.folder.vue b/packages/client/src/components/drive.folder.vue index 20a6343cf..57621bf09 100644 --- a/packages/client/src/components/drive.folder.vue +++ b/packages/client/src/components/drive.folder.vue @@ -20,7 +20,7 @@ {{ folder.name }}

- {{ i18n.locale.uploadFolder }} + {{ i18n.ts.uploadFolder }}

@@ -146,14 +146,14 @@ function onDrop(ev: DragEvent) { switch (err) { case 'detected-circular-definition': os.alert({ - title: i18n.locale.unableToProcess, - text: i18n.locale.circularReferenceFolder + title: i18n.ts.unableToProcess, + text: i18n.ts.circularReferenceFolder }); break; default: os.alert({ type: 'error', - text: i18n.locale.somethingHappened + text: i18n.ts.somethingHappened }); } }); @@ -184,8 +184,8 @@ function go() { function rename() { os.inputText({ - title: i18n.locale.renameFolder, - placeholder: i18n.locale.inputNewFolderName, + title: i18n.ts.renameFolder, + placeholder: i18n.ts.inputNewFolderName, default: props.folder.name }).then(({ canceled, result: name }) => { if (canceled) return; @@ -208,14 +208,14 @@ function deleteFolder() { case 'b0fc8a17-963c-405d-bfbc-859a487295e1': os.alert({ type: 'error', - title: i18n.locale.unableToDelete, - text: i18n.locale.hasChildFilesOrFolders + title: i18n.ts.unableToDelete, + text: i18n.ts.hasChildFilesOrFolders }); break; default: os.alert({ type: 'error', - text: i18n.locale.unableToDelete + text: i18n.ts.unableToDelete }); } }); @@ -227,7 +227,7 @@ function setAsUploadFolder() { function onContextmenu(ev: MouseEvent) { os.contextMenu([{ - text: i18n.locale.openInWindow, + text: i18n.ts.openInWindow, icon: 'fas fa-window-restore', action: () => { os.popup(import('./drive-window.vue'), { @@ -236,11 +236,11 @@ function onContextmenu(ev: MouseEvent) { }, 'closed'); } }, null, { - text: i18n.locale.rename, + text: i18n.ts.rename, icon: 'fas fa-i-cursor', action: rename, }, null, { - text: i18n.locale.delete, + text: i18n.ts.delete, icon: 'fas fa-trash-alt', danger: true, action: deleteFolder, diff --git a/packages/client/src/components/drive.nav-folder.vue b/packages/client/src/components/drive.nav-folder.vue index 7c35c5d3d..67223267c 100644 --- a/packages/client/src/components/drive.nav-folder.vue +++ b/packages/client/src/components/drive.nav-folder.vue @@ -8,7 +8,7 @@ @drop.stop="onDrop" > - {{ folder == null ? i18n.locale.drive : folder.name }} + {{ folder == null ? i18n.ts.drive : folder.name }}
diff --git a/packages/client/src/components/drive.vue b/packages/client/src/components/drive.vue index e27b0a5fb..b70683954 100644 --- a/packages/client/src/components/drive.vue +++ b/packages/client/src/components/drive.vue @@ -54,7 +54,7 @@ />
- {{ i18n.locale.loadMore }} + {{ i18n.ts.loadMore }}
- {{ i18n.locale.loadMore }} + {{ i18n.ts.loadMore }}

{{ i18n.t('empty-draghover') }}

-

{{ i18n.locale.emptyDrive }}
{{ i18n.t('empty-drive-description') }}

-

{{ i18n.locale.emptyFolder }}

+

{{ i18n.ts.emptyDrive }}
{{ i18n.t('empty-drive-description') }}

+

{{ i18n.ts.emptyFolder }}

@@ -253,14 +253,14 @@ function onDrop(e: DragEvent): any { switch (err) { case 'detected-circular-definition': os.alert({ - title: i18n.locale.unableToProcess, - text: i18n.locale.circularReferenceFolder + title: i18n.ts.unableToProcess, + text: i18n.ts.circularReferenceFolder }); break; default: os.alert({ type: 'error', - text: i18n.locale.somethingHappened + text: i18n.ts.somethingHappened }); } }); @@ -274,9 +274,9 @@ function selectLocalFile() { function urlUpload() { os.inputText({ - title: i18n.locale.uploadFromUrl, + title: i18n.ts.uploadFromUrl, type: 'url', - placeholder: i18n.locale.uploadFromUrlDescription + placeholder: i18n.ts.uploadFromUrlDescription }).then(({ canceled, result: url }) => { if (canceled || !url) return; os.api('drive/files/upload-from-url', { @@ -285,16 +285,16 @@ function urlUpload() { }); os.alert({ - title: i18n.locale.uploadFromUrlRequested, - text: i18n.locale.uploadFromUrlMayTakeTime + title: i18n.ts.uploadFromUrlRequested, + text: i18n.ts.uploadFromUrlMayTakeTime }); }); } function createFolder() { os.inputText({ - title: i18n.locale.createFolder, - placeholder: i18n.locale.folderName + title: i18n.ts.createFolder, + placeholder: i18n.ts.folderName }).then(({ canceled, result: name }) => { if (canceled) return; os.api('drive/folders/create', { @@ -308,8 +308,8 @@ function createFolder() { function renameFolder(folderToRename: Misskey.entities.DriveFolder) { os.inputText({ - title: i18n.locale.renameFolder, - placeholder: i18n.locale.inputNewFolderName, + title: i18n.ts.renameFolder, + placeholder: i18n.ts.inputNewFolderName, default: folderToRename.name }).then(({ canceled, result: name }) => { if (canceled) return; @@ -334,14 +334,14 @@ function deleteFolder(folderToDelete: Misskey.entities.DriveFolder) { case 'b0fc8a17-963c-405d-bfbc-859a487295e1': os.alert({ type: 'error', - title: i18n.locale.unableToDelete, - text: i18n.locale.hasChildFilesOrFolders + title: i18n.ts.unableToDelete, + text: i18n.ts.hasChildFilesOrFolders }); break; default: os.alert({ type: 'error', - text: i18n.locale.unableToDelete + text: i18n.ts.unableToDelete }); } }); @@ -562,29 +562,29 @@ function fetchMoreFiles() { function getMenu() { return [{ - text: i18n.locale.addFile, + text: i18n.ts.addFile, type: 'label' }, { - text: i18n.locale.upload, + text: i18n.ts.upload, icon: 'fas fa-upload', action: () => { selectLocalFile(); } }, { - text: i18n.locale.fromUrl, + text: i18n.ts.fromUrl, icon: 'fas fa-link', action: () => { urlUpload(); } }, null, { - text: folder.value ? folder.value.name : i18n.locale.drive, + text: folder.value ? folder.value.name : i18n.ts.drive, type: 'label' }, folder.value ? { - text: i18n.locale.renameFolder, + text: i18n.ts.renameFolder, icon: 'fas fa-i-cursor', action: () => { renameFolder(folder.value); } } : undefined, folder.value ? { - text: i18n.locale.deleteFolder, + text: i18n.ts.deleteFolder, icon: 'fas fa-trash-alt', action: () => { deleteFolder(folder.value as Misskey.entities.DriveFolder); } } : undefined, { - text: i18n.locale.createFolder, + text: i18n.ts.createFolder, icon: 'fas fa-folder-plus', action: () => { createFolder(); } }]; diff --git a/packages/client/src/components/emoji-picker.vue b/packages/client/src/components/emoji-picker.vue index 96670fa58..f29151055 100644 --- a/packages/client/src/components/emoji-picker.vue +++ b/packages/client/src/components/emoji-picker.vue @@ -1,6 +1,6 @@ diff --git a/packages/client/src/components/forgot-password.vue b/packages/client/src/components/forgot-password.vue index c74e1ac75..46cbf6bd7 100644 --- a/packages/client/src/components/forgot-password.vue +++ b/packages/client/src/components/forgot-password.vue @@ -5,28 +5,28 @@ @close="dialog.close()" @closed="emit('closed')" > - +
- + - - + + - {{ i18n.locale.send }} + {{ i18n.ts.send }}
- {{ i18n.locale._forgotPassword.ifNoEmail }} + {{ i18n.ts._forgotPassword.ifNoEmail }}
- {{ i18n.locale._forgotPassword.contactAdmin }} + {{ i18n.ts._forgotPassword.contactAdmin }}
diff --git a/packages/client/src/components/global/a.vue b/packages/client/src/components/global/a.vue index cf7385ca2..b1b6a0cda 100644 --- a/packages/client/src/components/global/a.vue +++ b/packages/client/src/components/global/a.vue @@ -43,31 +43,31 @@ function onContextmenu(ev) { text: props.to, }, { icon: 'fas fa-window-maximize', - text: i18n.locale.openInWindow, + text: i18n.ts.openInWindow, action: () => { os.pageWindow(props.to); } }, sideViewHook ? { icon: 'fas fa-columns', - text: i18n.locale.openInSideView, + text: i18n.ts.openInSideView, action: () => { sideViewHook(props.to); } } : undefined, { icon: 'fas fa-expand-alt', - text: i18n.locale.showInPage, + text: i18n.ts.showInPage, action: () => { router.push(props.to); } }, null, { icon: 'fas fa-external-link-alt', - text: i18n.locale.openInNewTab, + text: i18n.ts.openInNewTab, action: () => { window.open(props.to, '_blank'); } }, { icon: 'fas fa-link', - text: i18n.locale.copyLink, + text: i18n.ts.copyLink, action: () => { copyToClipboard(`${url}${props.to}`); } diff --git a/packages/client/src/components/global/header.vue b/packages/client/src/components/global/header.vue index a241ece40..02598d95b 100644 --- a/packages/client/src/components/global/header.vue +++ b/packages/client/src/components/global/header.vue @@ -104,7 +104,7 @@ export default defineComponent({ if (props.info.share) { if (menu.length > 0) menu.push(null); menu.push({ - text: i18n.locale.share, + text: i18n.ts.share, icon: 'fas fa-share-alt', action: share }); diff --git a/packages/client/src/components/global/time.vue b/packages/client/src/components/global/time.vue index d2788264c..19199fd40 100644 --- a/packages/client/src/components/global/time.vue +++ b/packages/client/src/components/global/time.vue @@ -31,9 +31,9 @@ const relative = $computed(() => { ago >= 3600 ? i18n.t('_ago.hoursAgo', { n: (~~(ago / 3600)).toString() }) : ago >= 60 ? i18n.t('_ago.minutesAgo', { n: (~~(ago / 60)).toString() }) : ago >= 10 ? i18n.t('_ago.secondsAgo', { n: (~~(ago % 60)).toString() }) : - ago >= -1 ? i18n.locale._ago.justNow : - ago < -1 ? i18n.locale._ago.future : - i18n.locale._ago.unknown); + ago >= -1 ? i18n.ts._ago.justNow : + ago < -1 ? i18n.ts._ago.future : + i18n.ts._ago.unknown); }); function tick() { diff --git a/packages/client/src/components/note-detailed.vue b/packages/client/src/components/note-detailed.vue index a3b30f726..5fc3a0f33 100644 --- a/packages/client/src/components/note-detailed.vue +++ b/packages/client/src/components/note-detailed.vue @@ -250,7 +250,7 @@ function menu(viaKeyboard = false): void { function showRenoteMenu(viaKeyboard = false): void { if (!isMyRenote) return; os.popupMenu([{ - text: i18n.locale.unrenote, + text: i18n.ts.unrenote, icon: 'fas fa-trash-alt', danger: true, action: () => { diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index fc89c2777..6c596fb60 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -10,13 +10,13 @@ :class="{ renote: isRenote }" > -
{{ i18n.locale.pinnedNote }}
-
{{ i18n.locale.promotion }}
-
{{ i18n.locale.featured }}
+
{{ i18n.ts.pinnedNote }}
+
{{ i18n.ts.promotion }}
+
{{ i18n.ts.featured }}
- +