From 5490d82e3bb2165086f758f59206136a88df6a12 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 11 Mar 2022 18:55:47 +0900 Subject: [PATCH] tweal c;iemy --- locales/ja-JP.yml | 2 +- packages/client/src/components/chart.vue | 32 +++++++++++++++++++ .../client/src/pages/user/index.activity.vue | 31 +++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 13f9efe9b4..e2cf11b49d 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -830,7 +830,7 @@ auto: "自動" themeColor: "テーマカラー" size: "サイズ" numberOfColumn: "列の数" -searchByGoogle: "ググる" +searchByGoogle: "検索" instanceDefaultLightTheme: "インスタンスデフォルトのライトテーマ" instanceDefaultDarkTheme: "インスタンスデフォルトのダークテーマ" instanceDefaultThemeDescription: "オブジェクト形式のテーマコードを記入します。" diff --git a/packages/client/src/components/chart.vue b/packages/client/src/components/chart.vue index 13ca60efa8..a7870de39d 100644 --- a/packages/client/src/components/chart.vue +++ b/packages/client/src/components/chart.vue @@ -795,6 +795,36 @@ export default defineComponent({ }; }; + const fetchPerUserFollowingChart = async (): Promise => { + const raw = await os.api('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span }); + return { + series: [{ + name: 'Local', + type: 'area', + data: format(raw.local.followings.total), + }, { + name: 'Remote', + type: 'area', + data: format(raw.remote.followings.total), + }], + }; + }; + + const fetchPerUserFollowersChart = async (): Promise => { + const raw = await os.api('charts/user/following', { userId: props.args.user.id, limit: props.limit, span: props.span }); + return { + series: [{ + name: 'Local', + type: 'area', + data: format(raw.local.followers.total), + }, { + name: 'Remote', + type: 'area', + data: format(raw.remote.followers.total), + }], + }; + }; + const fetchPerUserDriveChart = async (): Promise => { const raw = await os.api('charts/user/drive', { userId: props.args.user.id, limit: props.limit, span: props.span }); return { @@ -838,6 +868,8 @@ export default defineComponent({ case 'instance-drive-files-total': return fetchInstanceDriveFilesChart(true); case 'per-user-notes': return fetchPerUserNotesChart(); + case 'per-user-following': return fetchPerUserFollowingChart(); + case 'per-user-followers': return fetchPerUserFollowersChart(); case 'per-user-drive': return fetchPerUserDriveChart(); } }; diff --git a/packages/client/src/pages/user/index.activity.vue b/packages/client/src/pages/user/index.activity.vue index f64e9d5b60..aecd25d6b0 100644 --- a/packages/client/src/pages/user/index.activity.vue +++ b/packages/client/src/pages/user/index.activity.vue @@ -1,9 +1,14 @@ @@ -13,6 +18,8 @@ import { } from 'vue'; import * as misskey from 'misskey-js'; import MkContainer from '@/components/ui/container.vue'; import MkChart from '@/components/chart.vue'; +import * as os from '@/os'; +import { i18n } from '@/i18n'; const props = withDefaults(defineProps<{ user: misskey.entities.User; @@ -20,4 +27,26 @@ const props = withDefaults(defineProps<{ }>(), { limit: 50, }); + +let chartSrc = $ref('per-user-notes'); + +function showMenu(ev: MouseEvent) { + os.popupMenu([{ + text: i18n.ts.notes, + active: true, + action: () => { + chartSrc = 'per-user-notes'; + } + }/*, { + text: i18n.ts.following, + action: () => { + chartSrc = 'per-user-following'; + } + }, { + text: i18n.ts.followers, + action: () => { + chartSrc = 'per-user-followers'; + } + }*/], ev.currentTarget ?? ev.target); +}