diff options
| author | dakkar <dakkar@thenautilus.net> | 2024-08-30 12:08:31 +0100 |
|---|---|---|
| committer | dakkar <dakkar@thenautilus.net> | 2024-08-30 12:08:31 +0100 |
| commit | 6151099f5ba07d14a651aea8f816dd280d74209d (patch) | |
| tree | 4b014a2f4b198facc8bdd92c70b49fec2801d51a /packages/frontend/src/components | |
| parent | merge: thunk the min/max promises (!603) (diff) | |
| parent | Merge pull request #14391 from misskey-dev/develop (diff) | |
| download | sharkey-6151099f5ba07d14a651aea8f816dd280d74209d.tar.gz sharkey-6151099f5ba07d14a651aea8f816dd280d74209d.tar.bz2 sharkey-6151099f5ba07d14a651aea8f816dd280d74209d.zip | |
Merge remote-tracking branch 'misskey/master' into feature/misskey-2024.8
Diffstat (limited to 'packages/frontend/src/components')
8 files changed, 111 insertions, 47 deletions
diff --git a/packages/frontend/src/components/MkAbuseReportWindow.vue b/packages/frontend/src/components/MkAbuseReportWindow.vue index b09c7bb3fb..a634a748e9 100644 --- a/packages/frontend/src/components/MkAbuseReportWindow.vue +++ b/packages/frontend/src/components/MkAbuseReportWindow.vue @@ -39,7 +39,7 @@ import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; const props = defineProps<{ - user: Misskey.entities.UserDetailed; + user: Misskey.entities.UserLite; initialComment?: string; }>(); diff --git a/packages/frontend/src/components/MkFlashPreview.stories.impl.ts b/packages/frontend/src/components/MkFlashPreview.stories.impl.ts new file mode 100644 index 0000000000..fa5288b73d --- /dev/null +++ b/packages/frontend/src/components/MkFlashPreview.stories.impl.ts @@ -0,0 +1,53 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +import { StoryObj } from '@storybook/vue3'; +import MkFlashPreview from './MkFlashPreview.vue'; +import { flash } from './../../.storybook/fakes.js'; +export const Public = { + render(args) { + return { + components: { + MkFlashPreview, + }, + setup() { + return { + args, + }; + }, + computed: { + props() { + return { + ...this.args, + }; + }, + }, + template: '<MkFlashPreview v-bind="props" />', + }; + }, + args: { + flash: { + ...flash(), + visibility: 'public', + }, + }, + parameters: { + layout: 'fullscreen', + }, + decorators: [ + () => ({ + template: '<div style="display: flex; align-items: center; justify-content: center; height: 100vh"><div style="max-width: 700px; width: 100%; margin: 3rem"><story/></div></div>', + }), + ], +} satisfies StoryObj<typeof MkFlashPreview>; +export const Private = { + ...Public, + args: { + flash: { + ...flash(), + visibility: 'private', + }, + }, +} satisfies StoryObj<typeof MkFlashPreview>; diff --git a/packages/frontend/src/components/MkFlashPreview.vue b/packages/frontend/src/components/MkFlashPreview.vue index 6783804cc5..8a2a438624 100644 --- a/packages/frontend/src/components/MkFlashPreview.vue +++ b/packages/frontend/src/components/MkFlashPreview.vue @@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only --> <template> -<MkA :to="`/play/${flash.id}`" class="vhpxefrk _panel"> +<MkA :to="`/play/${flash.id}`" class="vhpxefrk _panel" :class="[{ gray: flash.visibility === 'private' }]"> <article> <header> <h1 :title="flash.title">{{ flash.title }}</h1> @@ -22,11 +22,11 @@ SPDX-License-Identifier: AGPL-3.0-only <script lang="ts" setup> import { } from 'vue'; +import * as Misskey from 'misskey-js'; import { userName } from '@/filters/user.js'; const props = defineProps<{ - //flash: Misskey.entities.Flash; - flash: any; + flash: Misskey.entities.Flash; }>(); </script> @@ -91,6 +91,12 @@ const props = defineProps<{ } } + &:global(.gray) { + --c: var(--bg); + background-image: linear-gradient(45deg, var(--c) 16.67%, transparent 16.67%, transparent 50%, var(--c) 50%, var(--c) 66.67%, transparent 66.67%, transparent 100%); + background-size: 16px 16px; + } + @media (max-width: 700px) { } diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index b33a0ba694..e2f0a4e492 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -234,6 +234,7 @@ import { host } from '@/config.js'; import { isEnabledUrlPreview } from '@/instance.js'; import { type Keymap } from '@/scripts/hotkey.js'; import { focusPrev, focusNext } from '@/scripts/focus.js'; +import { getAppearNote } from '@/scripts/get-appear-note.js'; const props = withDefaults(defineProps<{ note: Misskey.entities.Note; @@ -285,14 +286,7 @@ if (noteViewInterruptors.length > 0) { }); } -const isRenote = ( - note.value.renote != null && - note.value.reply == null && - note.value.text == null && - note.value.cw == null && - note.value.fileIds && note.value.fileIds.length === 0 && - note.value.poll == null -); +const isRenote = Misskey.note.isPureRenote(note.value); const rootEl = shallowRef<HTMLElement>(); const menuButton = shallowRef<HTMLElement>(); @@ -303,7 +297,7 @@ const reactButton = shallowRef<HTMLElement>(); const quoteButton = shallowRef<HTMLElement>(); const clipButton = shallowRef<HTMLElement>(); const likeButton = shallowRef<HTMLElement>(); -const appearNote = computed(() => isRenote ? note.value.renote as Misskey.entities.Note : note.value); +const appearNote = computed(() => getAppearNote(note.value)); const galleryEl = shallowRef<InstanceType<typeof MkMediaList>>(); const isMyRenote = $i && ($i.id === note.value.userId); const showContent = ref(defaultStore.state.uncollapseCW); diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index 33fc6e06d6..64559ef265 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -266,6 +266,7 @@ import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkButton from '@/components/MkButton.vue'; import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js'; import { isEnabledUrlPreview } from '@/instance.js'; +import { getAppearNote } from '@/scripts/get-appear-note.js'; import { type Keymap } from '@/scripts/hotkey.js'; const props = withDefaults(defineProps<{ @@ -299,14 +300,7 @@ if (noteViewInterruptors.length > 0) { }); } -const isRenote = ( - note.value.renote != null && - note.value.reply == null && - note.value.text == null && - note.value.cw == null && - note.value.fileIds && note.value.fileIds.length === 0 && - note.value.poll == null -); +const isRenote = Misskey.note.isPureRenote(note.value); const rootEl = shallowRef<HTMLElement>(); const menuButton = shallowRef<HTMLElement>(); @@ -317,7 +311,7 @@ const reactButton = shallowRef<HTMLElement>(); const quoteButton = shallowRef<HTMLElement>(); const clipButton = shallowRef<HTMLElement>(); const likeButton = shallowRef<HTMLElement>(); -const appearNote = computed(() => isRenote ? note.value.renote as Misskey.entities.Note : note.value); +const appearNote = computed(() => getAppearNote(note.value)); const galleryEl = shallowRef<InstanceType<typeof MkMediaList>>(); const isMyRenote = $i && ($i.id === note.value.userId); const showContent = ref(defaultStore.state.uncollapseCW); diff --git a/packages/frontend/src/components/MkPreview.vue b/packages/frontend/src/components/MkPreview.vue index d950d66c6e..649dee2fdb 100644 --- a/packages/frontend/src/components/MkPreview.vue +++ b/packages/frontend/src/components/MkPreview.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only <template> <div :class="$style.preview"> - <div :class="$style.preview__content1"> + <div> <MkInput v-model="text"> <template #label>Text</template> </MkInput> diff --git a/packages/frontend/src/components/MkRolePreview.vue b/packages/frontend/src/components/MkRolePreview.vue index c1b922198f..ce17ae08e0 100644 --- a/packages/frontend/src/components/MkRolePreview.vue +++ b/packages/frontend/src/components/MkRolePreview.vue @@ -4,25 +4,32 @@ SPDX-License-Identifier: AGPL-3.0-only --> <template> -<MkA v-adaptive-bg :to="forModeration ? `/admin/roles/${role.id}` : `/roles/${role.id}`" class="_panel" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }"> - <div :class="$style.title"> - <span :class="$style.icon"> - <template v-if="role.iconUrl"> - <img :class="$style.badge" :src="role.iconUrl"/> - </template> - <template v-else> - <i v-if="role.isAdministrator" class="ti ti-crown" style="color: var(--accent);"></i> - <i v-else-if="role.isModerator" class="ti ti-shield" style="color: var(--accent);"></i> - <i v-else class="ti ti-user" style="opacity: 0.7;"></i> +<MkA :to="forModeration ? `/admin/roles/${role.id}` : `/roles/${role.id}`" :class="$style.root" tabindex="-1" :style="{ '--color': role.color }"> + <template v-if="forModeration"> + <i v-if="role.isPublic" class="ti ti-world" :class="$style.icon" style="color: var(--success)"></i> + <i v-else class="ti ti-lock" :class="$style.icon" style="color: var(--warn)"></i> + </template> + + <div v-adaptive-bg class="_panel" :class="$style.body"> + <div :class="$style.bodyTitle"> + <span :class="$style.bodyIcon"> + <template v-if="role.iconUrl"> + <img :class="$style.bodyBadge" :src="role.iconUrl"/> + </template> + <template v-else> + <i v-if="role.isAdministrator" class="ti ti-crown" style="color: var(--accent);"></i> + <i v-else-if="role.isModerator" class="ti ti-shield" style="color: var(--accent);"></i> + <i v-else class="ti ti-user" style="opacity: 0.7;"></i> + </template> + </span> + <span :class="$style.bodyName">{{ role.name }}</span> + <template v-if="detailed"> + <span v-if="role.target === 'manual'" :class="$style.bodyUsers">{{ role.usersCount }} users</span> + <span v-else-if="role.target === 'conditional'" :class="$style.bodyUsers">? users</span> </template> - </span> - <span :class="$style.name">{{ role.name }}</span> - <template v-if="detailed"> - <span v-if="role.target === 'manual'" :class="$style.users">{{ role.usersCount }} users</span> - <span v-else-if="role.target === 'conditional'" :class="$style.users">({{ i18n.ts._role.conditional }})</span> - </template> + </div> + <div :class="$style.bodyDescription">{{ role.description }}</div> </div> - <div :class="$style.description">{{ role.description }}</div> </MkA> </template> @@ -42,34 +49,44 @@ const props = withDefaults(defineProps<{ <style lang="scss" module> .root { + display: flex; + align-items: center; +} + +.icon { + margin: 0 12px; +} + +.body { display: block; padding: 16px 20px; + flex: 1; border-left: solid 6px var(--color); } -.title { +.bodyTitle { display: flex; } -.icon { +.bodyIcon { margin-right: 8px; } -.badge { +.bodyBadge { height: 1.3em; vertical-align: -20%; } -.name { +.bodyName { font-weight: bold; } -.users { +.bodyUsers { margin-left: auto; opacity: 0.7; } -.description { +.bodyDescription { opacity: 0.7; font-size: 85%; } diff --git a/packages/frontend/src/components/global/MkAcct.vue b/packages/frontend/src/components/global/MkAcct.vue index 8cb082585b..bbcb070803 100644 --- a/packages/frontend/src/components/global/MkAcct.vue +++ b/packages/frontend/src/components/global/MkAcct.vue @@ -21,7 +21,7 @@ import { host as hostRaw } from '@/config.js'; import { defaultStore } from '@/store.js'; defineProps<{ - user: Misskey.entities.User; + user: Misskey.entities.UserLite; detail?: boolean; }>(); |