mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 02:23:08 +02:00
tweal c;iemy
This commit is contained in:
parent
357da2ce3a
commit
5490d82e3b
3 changed files with 63 additions and 2 deletions
|
@ -830,7 +830,7 @@ auto: "自動"
|
||||||
themeColor: "テーマカラー"
|
themeColor: "テーマカラー"
|
||||||
size: "サイズ"
|
size: "サイズ"
|
||||||
numberOfColumn: "列の数"
|
numberOfColumn: "列の数"
|
||||||
searchByGoogle: "ググる"
|
searchByGoogle: "検索"
|
||||||
instanceDefaultLightTheme: "インスタンスデフォルトのライトテーマ"
|
instanceDefaultLightTheme: "インスタンスデフォルトのライトテーマ"
|
||||||
instanceDefaultDarkTheme: "インスタンスデフォルトのダークテーマ"
|
instanceDefaultDarkTheme: "インスタンスデフォルトのダークテーマ"
|
||||||
instanceDefaultThemeDescription: "オブジェクト形式のテーマコードを記入します。"
|
instanceDefaultThemeDescription: "オブジェクト形式のテーマコードを記入します。"
|
||||||
|
|
|
@ -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 fetchPerUserDriveChart = async (): Promise<typeof data> => {
|
||||||
const raw = await os.api('charts/user/drive', { userId: props.args.user.id, limit: props.limit, span: props.span });
|
const raw = await os.api('charts/user/drive', { userId: props.args.user.id, limit: props.limit, span: props.span });
|
||||||
return {
|
return {
|
||||||
|
@ -838,6 +868,8 @@ export default defineComponent({
|
||||||
case 'instance-drive-files-total': return fetchInstanceDriveFilesChart(true);
|
case 'instance-drive-files-total': return fetchInstanceDriveFilesChart(true);
|
||||||
|
|
||||||
case 'per-user-notes': return fetchPerUserNotesChart();
|
case 'per-user-notes': return fetchPerUserNotesChart();
|
||||||
|
case 'per-user-following': return fetchPerUserFollowingChart();
|
||||||
|
case 'per-user-followers': return fetchPerUserFollowersChart();
|
||||||
case 'per-user-drive': return fetchPerUserDriveChart();
|
case 'per-user-drive': return fetchPerUserDriveChart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<MkContainer>
|
<MkContainer>
|
||||||
<template #header><i class="fas fa-chart-bar" style="margin-right: 0.5em;"></i>{{ $ts.activity }}</template>
|
<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;">
|
<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>
|
</div>
|
||||||
</MkContainer>
|
</MkContainer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -13,6 +18,8 @@ import { } from 'vue';
|
||||||
import * as misskey from 'misskey-js';
|
import * as misskey from 'misskey-js';
|
||||||
import MkContainer from '@/components/ui/container.vue';
|
import MkContainer from '@/components/ui/container.vue';
|
||||||
import MkChart from '@/components/chart.vue';
|
import MkChart from '@/components/chart.vue';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
user: misskey.entities.User;
|
user: misskey.entities.User;
|
||||||
|
@ -20,4 +27,26 @@ const props = withDefaults(defineProps<{
|
||||||
}>(), {
|
}>(), {
|
||||||
limit: 50,
|
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>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue