summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/MkChart.stories.impl.ts
diff options
context:
space:
mode:
authormisskey-release-bot[bot] <157398866+misskey-release-bot[bot]@users.noreply.github.com>2024-07-31 11:20:31 +0000
committerGitHub <noreply@github.com>2024-07-31 11:20:31 +0000
commite98f66db51aabef925ea1a8faee6c37f67071107 (patch)
tree168fcc9219f7511bbf9bc198568406bd49fc31bb /packages/frontend/src/components/MkChart.stories.impl.ts
parentfix: remove unreleased section (#14246) (diff)
parentRelease: 2024.7.0 (diff)
downloadsharkey-e98f66db51aabef925ea1a8faee6c37f67071107.tar.gz
sharkey-e98f66db51aabef925ea1a8faee6c37f67071107.tar.bz2
sharkey-e98f66db51aabef925ea1a8faee6c37f67071107.zip
Merge pull request #14233 from misskey-dev/develop
Release: 2024.7.0
Diffstat (limited to 'packages/frontend/src/components/MkChart.stories.impl.ts')
-rw-r--r--packages/frontend/src/components/MkChart.stories.impl.ts80
1 files changed, 80 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkChart.stories.impl.ts b/packages/frontend/src/components/MkChart.stories.impl.ts
new file mode 100644
index 0000000000..1bcb9c30d8
--- /dev/null
+++ b/packages/frontend/src/components/MkChart.stories.impl.ts
@@ -0,0 +1,80 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+/* eslint-disable @typescript-eslint/explicit-function-return-type */
+/* eslint-disable import/no-default-export */
+import { StoryObj } from '@storybook/vue3';
+import { http } from 'msw';
+import { commonHandlers } from '../../.storybook/mocks.js';
+import { getChartResolver } from '../../.storybook/charts.js';
+import MkChart from './MkChart.vue';
+
+const Base = {
+ render(args) {
+ return {
+ components: {
+ MkChart,
+ },
+ setup() {
+ return {
+ args,
+ };
+ },
+ computed: {
+ props() {
+ return {
+ ...this.args,
+ };
+ },
+ },
+ template: '<MkChart v-bind="props" />',
+ };
+ },
+ args: {
+ src: 'federation',
+ span: 'hour',
+ nowForChromatic: 1716263640000,
+ },
+ parameters: {
+ layout: 'centered',
+ msw: {
+ handlers: [
+ ...commonHandlers,
+ http.get('/api/charts/federation', getChartResolver(
+ ['deliveredInstances', 'inboxInstances', 'stalled', 'sub', 'pub', 'pubsub', 'subActive', 'pubActive'],
+ )),
+ http.get('/api/charts/notes', getChartResolver(
+ ['local.total', 'remote.total'],
+ { accumulate: true },
+ )),
+ http.get('/api/charts/drive', getChartResolver(
+ ['local.incSize', 'local.decSize', 'remote.incSize', 'remote.decSize'],
+ { mulMap: { 'local.incSize': 1e7, 'local.decSize': 5e6, 'remote.incSize': 1e6, 'remote.decSize': 5e5 } },
+ )),
+ ],
+ },
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const FederationChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'federation',
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const NotesTotalChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'notes-total',
+ },
+} satisfies StoryObj<typeof MkChart>;
+export const DriveChart = {
+ ...Base,
+ args: {
+ ...Base.args,
+ src: 'drive',
+ },
+} satisfies StoryObj<typeof MkChart>;