-
-
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.
enhance(frontend): デッキのアンテナ・リスト選択画面からそれぞれを新規作成できるように (#14104)
* enhance(frontend): デッキのアンテナ・リスト選択画面からそれぞれを新規作成できるように * Update Changelog * fix * fix * lint * add story * typo ねぼけていた * Update antenna-column.vue --------- Co-authored-by: syuilo <[email protected]>
- Loading branch information
1 parent
de3ddb5
commit 738b3ea
Showing
22 changed files
with
409 additions
and
113 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
62 changes: 62 additions & 0 deletions
62
packages/frontend/src/components/MkAntennaEditor.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,62 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
import { action } from '@storybook/addon-actions'; | ||
import { StoryObj } from '@storybook/vue3'; | ||
import { HttpResponse, http } from 'msw'; | ||
import { commonHandlers } from '../../.storybook/mocks.js'; | ||
import MkAntennaEditor from './MkAntennaEditor.vue'; | ||
export const Default = { | ||
render(args) { | ||
return { | ||
components: { | ||
MkAntennaEditor, | ||
}, | ||
setup() { | ||
return { | ||
args, | ||
}; | ||
}, | ||
computed: { | ||
props() { | ||
return { | ||
...this.args, | ||
}; | ||
}, | ||
events() { | ||
return { | ||
created: action('created'), | ||
updated: action('updated'), | ||
deleted: action('deleted'), | ||
}; | ||
}, | ||
}, | ||
template: '<MkAntennaEditor v-bind="props" v-on="events" />', | ||
}; | ||
}, | ||
args: { | ||
}, | ||
parameters: { | ||
layout: 'fullscreen', | ||
msw: { | ||
handlers: [ | ||
...commonHandlers, | ||
http.post('/api/antennas/create', async ({ request }) => { | ||
action('POST /api/antennas/create')(await request.json()); | ||
return HttpResponse.json({}); | ||
}), | ||
http.post('/api/antennas/update', async ({ request }) => { | ||
action('POST /api/antennas/update')(await request.json()); | ||
return HttpResponse.json({}); | ||
}), | ||
http.post('/api/antennas/delete', async ({ request }) => { | ||
action('POST /api/antennas/delete')(await request.json()); | ||
return HttpResponse.json(); | ||
}), | ||
], | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof MkAntennaEditor>; |
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
63 changes: 63 additions & 0 deletions
63
packages/frontend/src/components/MkAntennaEditorDialog.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,63 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
/* eslint-disable @typescript-eslint/explicit-function-return-type */ | ||
import { action } from '@storybook/addon-actions'; | ||
import { StoryObj } from '@storybook/vue3'; | ||
import { HttpResponse, http } from 'msw'; | ||
import { commonHandlers } from '../../.storybook/mocks.js'; | ||
import MkAntennaEditorDialog from './MkAntennaEditorDialog.vue'; | ||
export const Default = { | ||
render(args) { | ||
return { | ||
components: { | ||
MkAntennaEditorDialog, | ||
}, | ||
setup() { | ||
return { | ||
args, | ||
}; | ||
}, | ||
computed: { | ||
props() { | ||
return { | ||
...this.args, | ||
}; | ||
}, | ||
events() { | ||
return { | ||
created: action('created'), | ||
updated: action('updated'), | ||
deleted: action('deleted'), | ||
closed: action('closed'), | ||
}; | ||
}, | ||
}, | ||
template: '<MkAntennaEditorDialog v-bind="props" v-on="events" />', | ||
}; | ||
}, | ||
args: { | ||
}, | ||
parameters: { | ||
layout: 'centered', | ||
msw: { | ||
handlers: [ | ||
...commonHandlers, | ||
http.post('/api/antennas/create', async ({ request }) => { | ||
action('POST /api/antennas/create')(await request.json()); | ||
return HttpResponse.json({}); | ||
}), | ||
http.post('/api/antennas/update', async ({ request }) => { | ||
action('POST /api/antennas/update')(await request.json()); | ||
return HttpResponse.json({}); | ||
}), | ||
http.post('/api/antennas/delete', async ({ request }) => { | ||
action('POST /api/antennas/delete')(await request.json()); | ||
return HttpResponse.json(); | ||
}), | ||
], | ||
}, | ||
}, | ||
} satisfies StoryObj<typeof MkAntennaEditorDialog>; |
63 changes: 63 additions & 0 deletions
63
packages/frontend/src/components/MkAntennaEditorDialog.vue
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,63 @@ | ||
<!-- | ||
SPDX-FileCopyrightText: syuilo and misskey-project | ||
SPDX-License-Identifier: AGPL-3.0-only | ||
--> | ||
|
||
<template> | ||
<MkModalWindow | ||
ref="dialog" | ||
:withOkButton="false" | ||
:width="500" | ||
:height="550" | ||
@close="close()" | ||
@closed="emit('closed')" | ||
> | ||
<template #header>{{ antenna == null ? i18n.ts.createAntenna : i18n.ts.editAntenna }}</template> | ||
<XAntennaEditor | ||
:antenna="antenna" | ||
@created="onAntennaCreated" | ||
@updated="onAntennaUpdated" | ||
@deleted="onAntennaDeleted" | ||
/> | ||
</MkModalWindow> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { shallowRef } from 'vue'; | ||
import * as Misskey from 'misskey-js'; | ||
import MkModalWindow from '@/components/MkModalWindow.vue'; | ||
import XAntennaEditor from '@/components/MkAntennaEditor.vue'; | ||
import { i18n } from '@/i18n.js'; | ||
|
||
defineProps<{ | ||
antenna?: Misskey.entities.Antenna; | ||
}>(); | ||
|
||
const emit = defineEmits<{ | ||
(ev: 'created', newAntenna: Misskey.entities.Antenna): void, | ||
(ev: 'updated', editedAntenna: Misskey.entities.Antenna): void, | ||
(ev: 'deleted'): void, | ||
(ev: 'closed'): void, | ||
}>(); | ||
|
||
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); | ||
|
||
function onAntennaCreated(newAntenna: Misskey.entities.Antenna) { | ||
emit('created', newAntenna); | ||
dialog.value?.close(); | ||
} | ||
|
||
function onAntennaUpdated(editedAntenna: Misskey.entities.Antenna) { | ||
emit('updated', editedAntenna); | ||
dialog.value?.close(); | ||
} | ||
|
||
function onAntennaDeleted() { | ||
emit('deleted'); | ||
dialog.value?.close(); | ||
} | ||
|
||
function close() { | ||
dialog.value?.close(); | ||
} | ||
</script> |
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.