summaryrefslogtreecommitdiff
path: root/packages/client
diff options
context:
space:
mode:
Diffstat (limited to 'packages/client')
-rw-r--r--packages/client/src/components/chart.vue32
-rw-r--r--packages/client/src/pages/user/index.activity.vue31
2 files changed, 62 insertions, 1 deletions
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<typeof data> => {
+ 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<typeof data> => {
+ 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<typeof data> => {
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 @@
<template>
<MkContainer>
<template #header><i class="fas fa-chart-bar" style="margin-right: 0.5em;"></i>{{ $ts.activity }}</template>
+ <template #func>
+ <button class="_button" @click="showMenu">
+ <i class="fas fa-ellipsis-h"></i>
+ </button>
+ </template>
<div style="padding: 8px;">
- <MkChart src="per-user-notes" :args="{ user, withoutAll: true }" span="day" :limit="limit" :bar="true" :stacked="true" :detailed="false" :aspect-ratio="5"/>
+ <MkChart :src="chartSrc" :args="{ user, withoutAll: true }" span="day" :limit="limit" :bar="true" :stacked="true" :detailed="false" :aspect-ratio="5"/>
</div>
</MkContainer>
</template>
@@ -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);
+}
</script>