mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 07:03:09 +02:00
9bb6c536c0
* chore(#10336): register snippets * test(#10336): add `components/Mk[A-B].*` stories * build: desynced lockfile * ci(#10336): preload assets * ci(#10336): use pull_request * build: update lockfile * fix: reactivity transform * chore: track upstream changes * refactor: avoid temporary previous tapping declarations * revert: avoid temporary previous tapping declarations This reverts commit e649b1b1e6771bee674f2dfb044e0efd72d0be5d. * test: flaky snapshots * style: import
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
import { StoryObj } from '@storybook/vue3';
|
|
import { rest } from 'msw';
|
|
import { userDetailed } from '../../.storybook/fakes';
|
|
import { commonHandlers } from '../../.storybook/mocks';
|
|
import MkAchievements from './MkAchievements.vue';
|
|
import { ACHIEVEMENT_TYPES } from '@/scripts/achievements';
|
|
export const Empty = {
|
|
render(args) {
|
|
return {
|
|
components: {
|
|
MkAchievements,
|
|
},
|
|
setup() {
|
|
return {
|
|
args,
|
|
};
|
|
},
|
|
computed: {
|
|
props() {
|
|
return {
|
|
...this.args,
|
|
};
|
|
},
|
|
},
|
|
template: '<MkAchievements v-bind="props" />',
|
|
};
|
|
},
|
|
args: {
|
|
user: userDetailed(),
|
|
},
|
|
parameters: {
|
|
layout: 'fullscreen',
|
|
msw: {
|
|
handlers: [
|
|
...commonHandlers,
|
|
rest.post('/api/users/achievements', (req, res, ctx) => {
|
|
return res(ctx.json([]));
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
} satisfies StoryObj<typeof MkAchievements>;
|
|
export const All = {
|
|
...Empty,
|
|
parameters: {
|
|
msw: {
|
|
handlers: [
|
|
...commonHandlers,
|
|
rest.post('/api/users/achievements', (req, res, ctx) => {
|
|
return res(ctx.json(ACHIEVEMENT_TYPES.map((name) => ({ name, unlockedAt: 0 }))));
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
} satisfies StoryObj<typeof MkAchievements>;
|