embedのURLパラメータの初期化を共通化

This commit is contained in:
kakkokari-gtyih
2024-06-29 17:47:38 +09:00
parent 237605d6b8
commit 1ed6ed6ef0
8 changed files with 113 additions and 78 deletions

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div>
<MkLoading v-if="loading"/>
<XEmbedTimelineUI v-else-if="clip" :showHeader="normalizedShowHeader">
<XEmbedTimelineUI v-else-if="clip" :showHeader="embedParams.header">
<template #header>
<div :class="$style.clipHeader">
<div :class="$style.headerClipIconRoot">
@@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkNotes
ref="notesEl"
:pagination="pagination"
:disableAutoLoad="!normalizedEnableAutoLoad"
:disableAutoLoad="embedParams.autoload"
:noGap="true"
:ad="false"
/>
@@ -52,11 +52,11 @@ import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{
clipId: string;
showHeader?: string;
enableAutoLoad?: string;
}>();
function redirectIfNotEmbedPage() {
@@ -72,11 +72,7 @@ redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage);
// デフォルト: true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');
// デフォルト: false
const normalizedEnableAutoLoad = computed(() => props.enableAutoLoad === 'true');
const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams);
const clip = ref<Misskey.entities.Clip | null>(null);
const pagination = computed(() => ({

View File

@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div>
<XEmbedTimelineUI v-if="tag" :showHeader="normalizedShowHeader">
<XEmbedTimelineUI v-if="tag" :showHeader="embedParams.header">
<template #header>
<div :class="$style.clipHeader">
<div :class="$style.headerClipIconRoot">
@@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkNotes
ref="notesEl"
:pagination="pagination"
:disableAutoLoad="!normalizedEnableAutoLoad"
:disableAutoLoad="embedParams.autoload"
:noGap="true"
:ad="false"
/>
@@ -49,6 +49,8 @@ import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{
tag: string;
@@ -69,11 +71,7 @@ redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage);
// デフォルト: true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');
// デフォルト: false
const normalizedEnableAutoLoad = computed(() => props.enableAutoLoad === 'true');
const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams);
const pagination = computed(() => ({
endpoint: 'notes/search-by-tag',

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div>
<MkLoading v-if="loading"/>
<XEmbedTimelineUI v-else-if="user" :showHeader="normalizedShowHeader">
<XEmbedTimelineUI v-else-if="user" :showHeader="embedParams.header">
<template #header>
<div :class="$style.userHeader">
<a :href="`/@${user.username}`" target="_blank" rel="noopener noreferrer" :class="$style.avatarLink">
@@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkNotes
ref="notesEl"
:pagination="pagination"
:disableAutoLoad="!normalizedEnableAutoLoad"
:disableAutoLoad="embedParams.autoload"
:noGap="true"
:ad="false"
/>
@@ -58,6 +58,8 @@ import { url, instanceName } from '@/config.js';
import { scrollToTop } from '@/scripts/scroll.js';
import { isLink } from '@/scripts/is-link.js';
import { useRouter } from '@/router/supplier.js';
import { defaultEmbedParams } from '@/scripts/embed-page.js';
import type { ParsedEmbedParams } from '@/scripts/embed-page.js';
const props = defineProps<{
username: string;
@@ -78,11 +80,7 @@ redirectIfNotEmbedPage();
onActivated(redirectIfNotEmbedPage);
// デフォルト: true
const normalizedShowHeader = computed(() => props.showHeader !== 'false');
// デフォルト: false
const normalizedEnableAutoLoad = computed(() => props.enableAutoLoad === 'true');
const embedParams = inject<ParsedEmbedParams>('embedParams', defaultEmbedParams);
const user = ref<Misskey.entities.UserLite | null>(null);
const pagination = computed(() => ({