2023-07-27 08:31:52 +03:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-04-13 06:20:39 +03:00
|
|
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
|
|
import { StoryObj } from '@storybook/vue3';
|
|
|
|
import { rest } from 'msw';
|
2023-12-24 09:16:58 +02:00
|
|
|
import { userDetailed } from '../../.storybook/fakes.js';
|
|
|
|
import { commonHandlers } from '../../.storybook/mocks.js';
|
2023-04-13 06:20:39 +03:00
|
|
|
import MkAchievements from './MkAchievements.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { ACHIEVEMENT_TYPES } from '@/scripts/achievements.js';
|
2023-04-13 06:20:39 +03:00
|
|
|
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>;
|