diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2024-06-15 10:32:51 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 10:32:51 +0900 |
| commit | d4e2be68eeae69b758f1c9154ee7c1c68ae16b43 (patch) | |
| tree | 851b5bc2a667e0e2c88cffc5bc9e5733632b2a79 /packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts | |
| parent | refactor(backend): get column names from metadata (#13943) (diff) | |
| download | sharkey-d4e2be68eeae69b758f1c9154ee7c1c68ae16b43.tar.gz sharkey-d4e2be68eeae69b758f1c9154ee7c1c68ae16b43.tar.bz2 sharkey-d4e2be68eeae69b758f1c9154ee7c1c68ae16b43.zip | |
fix(frontend): chart in `MkInstanceCardMini` is no longer displayed (#13932)
* fix(frontend): chart in `MkInstanceCardMini` is no longer displayed
* Update CHANGELOG.md
* test: add `MkInstanceCardMini` story
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts')
| -rw-r--r-- | packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts b/packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts new file mode 100644 index 0000000000..a069a0eb8e --- /dev/null +++ b/packages/frontend/src/components/MkInstanceCardMini.stories.impl.ts @@ -0,0 +1,64 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +import { StoryObj } from '@storybook/vue3'; +import { HttpResponse, http } from 'msw'; +import { federationInstance } from '../../.storybook/fakes.js'; +import { commonHandlers } from '../../.storybook/mocks.js'; +import MkInstanceCardMini from './MkInstanceCardMini.vue'; +import { getChartResolver } from './MkChart.stories.impl.js'; +export const Default = { + render(args) { + return { + components: { + MkInstanceCardMini, + }, + setup() { + return { + args, + }; + }, + computed: { + props() { + return { + ...this.args, + }; + }, + }, + template: '<MkInstanceCardMini v-bind="props" />', + }; + }, + args: { + instance: federationInstance(), + }, + parameters: { + layout: 'centered', + msw: { + handlers: [ + ...commonHandlers, + http.get('/undefined/preview.webp', async ({ request }) => { + const urlStr = new URL(request.url).searchParams.get('url'); + if (urlStr == null) { + return new HttpResponse(null, { status: 404 }); + } + const url = new URL(urlStr); + + if (url.href.startsWith('https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/')) { + const image = await (await fetch(`client-assets/${url.pathname.split('/').pop()}`)).blob(); + return new HttpResponse(image, { + headers: { + 'Content-Type': 'image/jpeg', + }, + }); + } else { + return new HttpResponse(null, { status: 404 }); + } + }), + http.get('/api/charts/instance', getChartResolver(['requests.received'])), + ], + }, + }, +} satisfies StoryObj<typeof MkInstanceCardMini>; |