Repository navigation
feat(calls): アクティビティの土台を絵チャから分離 #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
packages/frontend/src/components/calls/MkCallsActivities.stories.impl.ts
This file contains hidden or 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,15 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: syuilo and misskey-project | ||
| * SPDX-License-Identifier: AGPL-3.0-only | ||
| */ | ||
|
|
||
| import MkCallsActivities from './MkCallsActivities.vue'; | ||
| import type { StoryObj } from '@storybook/vue3'; | ||
| import { i18n } from '@/i18n.js'; | ||
|
|
||
| export const Default = { | ||
| render(args) { return { components: { MkCallsActivities }, setup: () => ({ args }), template: '<MkCallsActivities v-bind="args" style="width: min(600px, 100%); box-sizing: border-box;"><template #default="{ activity }"><p>{{ activity }}</p></template></MkCallsActivities>' }; }, | ||
| args: { activities: [{ id: 'sample', title: i18n.ts._calls.activities, description: i18n.ts._calls.title, icon: 'ti ti-device-gamepad-2' }] }, | ||
| } satisfies StoryObj<typeof MkCallsActivities>; | ||
|
|
||
| export const Empty = { ...Default, args: { activities: [] } } satisfies StoryObj<typeof MkCallsActivities>; |
54 changes: 54 additions & 0 deletions
54
packages/frontend/src/components/calls/MkCallsActivities.vue
This file contains hidden or 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,54 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: syuilo and misskey-project | ||
| SPDX-License-Identifier: AGPL-3.0-only | ||
| --> | ||
|
|
||
| <template> | ||
| <section class="_panel" :class="$style.root" :aria-label="i18n.ts._calls.activities"> | ||
| <header :class="$style.header"> | ||
| <button v-if="activity != null" type="button" class="_button" :class="$style.iconButton" :aria-label="i18n.ts._calls.backToActivities" @click="activity = null"><i class="ti ti-arrow-left" aria-hidden="true"></i></button> | ||
| <h2 :class="$style.title">{{ activity?.title ?? i18n.ts._calls.activities }}</h2> | ||
| <button type="button" class="_button" :class="$style.iconButton" :aria-label="i18n.ts.close" @click="emit('close')"><i class="ti ti-x" aria-hidden="true"></i></button> | ||
| </header> | ||
| <slot v-if="activity != null" :activity="activity.id"></slot> | ||
| <div v-else class="_gaps_s"> | ||
| <p v-if="activities.length === 0">{{ i18n.ts._calls.noActivities }}</p> | ||
| <button v-for="choice in activities" :key="choice.id" type="button" class="_button" :class="$style.choice" @click="activity = choice"> | ||
| <i :class="[choice.icon, $style.choiceIcon]" aria-hidden="true"></i> | ||
| <span><strong>{{ choice.title }}</strong><small>{{ choice.description }}</small></span> | ||
| <i class="ti ti-chevron-right" aria-hidden="true"></i> | ||
| </button> | ||
| </div> | ||
| </section> | ||
| </template> | ||
|
|
||
| <script lang="ts"> | ||
| export type CallsActivity = { | ||
| id: string; | ||
| title: string; | ||
| description: string; | ||
| icon: string; | ||
| }; | ||
| </script> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { shallowRef } from 'vue'; | ||
| import { i18n } from '@/i18n.js'; | ||
|
|
||
| defineProps<{ activities: CallsActivity[] }>(); | ||
| const emit = defineEmits<{ (ev: 'close'): void }>(); | ||
| const activity = shallowRef<CallsActivity | null>(null); | ||
| </script> | ||
|
|
||
| <style lang="scss" module> | ||
| .root { padding: 16px; } | ||
| .header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; } | ||
| .title { flex: 1; margin: 0; font-size: 1rem; } | ||
| .iconButton { flex: 0 0 32px; height: 32px; border-radius: var(--MI-radius); } | ||
| .choice { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px; box-sizing: border-box; text-align: left; border-radius: var(--MI-radius); background: var(--MI_THEME-buttonBg); } | ||
| .choice:hover { background: var(--MI_THEME-buttonHoverBg); } | ||
| .choiceIcon { font-size: 28px; color: var(--MI_THEME-accent); } | ||
| .choice > span { flex: 1; min-width: 0; overflow-wrap: anywhere; } | ||
| .choice strong, .choice small { display: block; } | ||
| .choice small { margin-top: 4px; color: var(--MI_THEME-fgTransparentWeak); } | ||
| </style> |
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * SPDX-FileCopyrightText: syuilo and misskey-project | ||
| * SPDX-License-Identifier: AGPL-3.0-only | ||
| */ | ||
|
|
||
| import { afterEach, expect, test } from 'vitest'; | ||
| import { cleanup, fireEvent, render } from '@testing-library/vue'; | ||
| import { h } from 'vue'; | ||
| import MkCallsActivities from '@/components/calls/MkCallsActivities.vue'; | ||
| import { i18n } from '@/i18n.js'; | ||
|
|
||
| afterEach(cleanup); | ||
|
|
||
| test('selects supplied activities, renders their content, and returns to the list', async () => { | ||
| const view = render(MkCallsActivities, { | ||
| props: { activities: [ | ||
| { id: 'first', title: 'First activity', description: 'First description', icon: 'ti ti-device-gamepad-2' }, | ||
| { id: 'second', title: 'Second activity', description: 'Second description', icon: 'ti ti-device-gamepad-2' }, | ||
| ] }, | ||
| slots: { default: ({ activity }: { activity: string }) => h('p', `Content: ${activity}`) }, | ||
| }); | ||
| await fireEvent.click(view.getByRole('button', { name: 'First activity First description' })); | ||
| expect(view.getByRole('heading', { name: 'First activity' })).toBeTruthy(); | ||
| expect(view.getByText('Content: first')).toBeTruthy(); | ||
| await fireEvent.click(view.getByRole('button', { name: i18n.ts._calls.backToActivities })); | ||
| expect(view.queryByText('Content: first')).toBeNull(); | ||
| await fireEvent.click(view.getByRole('button', { name: 'Second activity Second description' })); | ||
| expect(view.getByText('Content: second')).toBeTruthy(); | ||
| await fireEvent.click(view.getByRole('button', { name: i18n.ts.close })); | ||
| expect(view.emitted().close).toHaveLength(1); | ||
| }); |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
終了後のアクティビティパネルに最小高さを確保してください。
画面が低い場合、終了サマリーの下にある
.endedLayoutは、高さゼロまで縮む可能性があります。.activityStageは内容を切り取るため、開いたパネルをスクロールして表示できません。.endedLayoutに必要な最小高さを設定し、.endedBodyのスクロールで両方を見られるようにすることを提案します。🤖 Prompt for AI Agents