-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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 e649b1b. * test: flaky snapshots * style: import
- Loading branch information
1 parent
2a7ba37
commit 9bb6c53
Showing
21 changed files
with
617 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,16 @@ export const onUnhandledRequest = ((req, print) => { | |
}) satisfies SharedOptions['onUnhandledRequest']; | ||
|
||
export const commonHandlers = [ | ||
rest.get('/fluent-emoji/:codepoints.png', async (req, res, ctx) => { | ||
const { codepoints } = req.params; | ||
const value = await fetch(`https://raw.githubusercontent.com/misskey-dev/emojis/main/dist/${codepoints}.png`).then((response) => response.blob()); | ||
return res(ctx.set('Content-Type', 'image/png'), ctx.body(value)); | ||
}), | ||
rest.get('/fluent-emojis/:codepoints.png', async (req, res, ctx) => { | ||
const { codepoints } = req.params; | ||
const value = await fetch(`https://raw.githubusercontent.com/misskey-dev/emojis/main/dist/${codepoints}.png`).then((response) => response.blob()); | ||
return res(ctx.set('Content-Type', 'image/png'), ctx.body(value)); | ||
}), | ||
rest.get('/twemoji/:codepoints.svg', async (req, res, ctx) => { | ||
const { codepoints } = req.params; | ||
const value = await fetch(`https://unpkg.com/@discordapp/[email protected]/dist/svg/${codepoints}.svg`).then((response) => response.blob()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/about-icon.png?raw=true" as="image" type="image/png" crossorigin="anonymous"> | ||
<link rel="preload" href="https://github.com/misskey-dev/misskey/blob/master/packages/frontend/assets/fedi.jpg?raw=true" as="image" type="image/jpeg" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://unpkg.com/@tabler/[email protected]/tabler-icons.min.css"> | ||
<link rel="stylesheet" href="https://unpkg.com/@fontsource/m-plus-rounded-1c/index.css"> | ||
<style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{ | ||
"Storybook Story Impl File": { | ||
"scope": "typescript", | ||
"prefix": "storyimpl", | ||
"body": [ | ||
"/* eslint-disable @typescript-eslint/explicit-function-return-type */", | ||
"import { StoryObj } from '@storybook/vue3';", | ||
"import $1 from './$1.vue';", | ||
"export const Default = {", | ||
"\trender(args) {", | ||
"\t\treturn {", | ||
"\t\t\tcomponents: {", | ||
"\t\t\t\t$1,", | ||
"\t\t\t},", | ||
"\t\t\tsetup() {", | ||
"\t\t\t\treturn {", | ||
"\t\t\t\t\targs,", | ||
"\t\t\t\t};", | ||
"\t\t\t},", | ||
"\t\t\tcomputed: {", | ||
"\t\t\t\tprops() {", | ||
"\t\t\t\t\treturn {", | ||
"\t\t\t\t\t\t...this.args,", | ||
"\t\t\t\t\t};", | ||
"\t\t\t\t},", | ||
"\t\t\t},", | ||
"\t\t\ttemplate: '<$1 v-bind=\"props\" />',", | ||
"\t\t};", | ||
"\t},", | ||
"\targs: {", | ||
"\t\t$2", | ||
"\t},", | ||
"\tparameters: {", | ||
"\t\tlayout: 'centered',", | ||
"\t},", | ||
"} satisfies StoryObj<typeof $1>;", | ||
"" | ||
] | ||
}, | ||
"Storybook Story Impl File (w/ events)": { | ||
"scope": "typescript", | ||
"prefix": "storyimplevent", | ||
"body": [ | ||
"/* eslint-disable @typescript-eslint/explicit-function-return-type */", | ||
"import { action } from '@storybook/addon-actions';", | ||
"import { StoryObj } from '@storybook/vue3';", | ||
"import $1 from './$1.vue';", | ||
"export const Default = {", | ||
"\trender(args) {", | ||
"\t\treturn {", | ||
"\t\t\tcomponents: {", | ||
"\t\t\t\t$1,", | ||
"\t\t\t},", | ||
"\t\t\tsetup() {", | ||
"\t\t\t\treturn {", | ||
"\t\t\t\t\targs,", | ||
"\t\t\t\t};", | ||
"\t\t\t},", | ||
"\t\t\tcomputed: {", | ||
"\t\t\t\tprops() {", | ||
"\t\t\t\t\treturn {", | ||
"\t\t\t\t\t\t...this.args,", | ||
"\t\t\t\t\t};", | ||
"\t\t\t\t},", | ||
"\t\t\t\tevents() {", | ||
"\t\t\t\t\treturn {", | ||
"\t\t\t\t\t\t$3", | ||
"\t\t\t\t\t};", | ||
"\t\t\t\t},", | ||
"\t\t\t},", | ||
"\t\t\ttemplate: '<$1 v-bind=\"props\" v-on=\"events\" />',", | ||
"\t\t};", | ||
"\t},", | ||
"\targs: {", | ||
"\t\t$2", | ||
"\t},", | ||
"\tparameters: {", | ||
"\t\tlayout: 'centered',", | ||
"\t},", | ||
"} satisfies StoryObj<typeof $1>;", | ||
"" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/frontend/src/components/MkAbuseReport.stories.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
import { action } from '@storybook/addon-actions'; | ||
import { StoryObj } from '@storybook/vue3'; | ||
import { rest } from 'msw'; | ||
import { abuseUserReport } from '../../.storybook/fakes'; | ||
import { commonHandlers } from '../../.storybook/mocks'; | ||
import MkAbuseReport from './MkAbuseReport.vue'; | ||
export const Default = { | ||
render(args) { | ||
return { | ||
components: { | ||
MkAbuseReport, | ||
}, | ||
setup() { | ||
return { | ||
args, | ||
}; | ||
}, | ||
computed: { | ||
props() { | ||
return { | ||
...this.args, | ||
}; | ||
}, | ||
events() { | ||
return { | ||
resolved: action('resolved'), | ||
}; | ||
}, | ||
}, | ||
template: '<MkAbuseReport v-bind="props" v-on="events" />', | ||
}; | ||
}, | ||
args: { | ||
report: abuseUserReport(), | ||
}, | ||
parameters: { | ||
layout: 'fullscreen', | ||
msw: { | ||
handlers: [ | ||
...commonHandlers, | ||
rest.post('/api/admin/resolve-abuse-user-report', async (req, res, ctx) => { | ||
action('POST /api/admin/resolve-abuse-user-report')(await req.json()); | ||
return res(ctx.json({})); | ||
}), | ||
], | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof MkAbuseReport>; |
49 changes: 49 additions & 0 deletions
49
packages/frontend/src/components/MkAbuseReportWindow.stories.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
import { action } from '@storybook/addon-actions'; | ||
import { StoryObj } from '@storybook/vue3'; | ||
import { rest } from 'msw'; | ||
import { userDetailed } from '../../.storybook/fakes'; | ||
import { commonHandlers } from '../../.storybook/mocks'; | ||
import MkAbuseReportWindow from './MkAbuseReportWindow.vue'; | ||
export const Default = { | ||
render(args) { | ||
return { | ||
components: { | ||
MkAbuseReportWindow, | ||
}, | ||
setup() { | ||
return { | ||
args, | ||
}; | ||
}, | ||
computed: { | ||
props() { | ||
return { | ||
...this.args, | ||
}; | ||
}, | ||
events() { | ||
return { | ||
'closed': action('closed'), | ||
}; | ||
}, | ||
}, | ||
template: '<MkAbuseReportWindow v-bind="props" v-on="events" />', | ||
}; | ||
}, | ||
args: { | ||
user: userDetailed(), | ||
}, | ||
parameters: { | ||
layout: 'centered', | ||
msw: { | ||
handlers: [ | ||
...commonHandlers, | ||
rest.post('/api/users/report-abuse', async (req, res, ctx) => { | ||
action('POST /api/users/report-abuse')(await req.json()); | ||
return res(ctx.json({})); | ||
}), | ||
], | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof MkAbuseReportWindow>; |
33 changes: 33 additions & 0 deletions
33
packages/frontend/src/components/MkAccountMoved.stories.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
import { StoryObj } from '@storybook/vue3'; | ||
import { userDetailed } from '../../.storybook/fakes'; | ||
import MkAccountMoved from './MkAccountMoved.vue'; | ||
export const Default = { | ||
render(args) { | ||
return { | ||
components: { | ||
MkAccountMoved, | ||
}, | ||
setup() { | ||
return { | ||
args, | ||
}; | ||
}, | ||
computed: { | ||
props() { | ||
return { | ||
...this.args, | ||
}; | ||
}, | ||
}, | ||
template: '<MkAccountMoved v-bind="props" />', | ||
}; | ||
}, | ||
args: { | ||
username: userDetailed().username, | ||
host: userDetailed().host, | ||
}, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
} satisfies StoryObj<typeof MkAccountMoved>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/frontend/src/components/MkAchievements.stories.impl.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* 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>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.