Skip to content

Commit

Permalink
fix(frontend): ページデザインの修正 (#13642)
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Mar 31, 2024
1 parent efafa02 commit 61978cb
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 2 deletions.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8830,6 +8830,14 @@ export interface Locale extends ILocale {
* ボタン
*/
"button": string;
/**
* 動的ブロック
*/
"dynamic": string;
/**
* このブロックは廃止されています。今後は{play}を利用してください。
*/
"dynamicDescription": ParameterizedString<"play">;
/**
* ノート埋め込み
*/
Expand Down
3 changes: 2 additions & 1 deletion locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2331,6 +2331,8 @@ _pages:
section: "セクション"
image: "画像"
button: "ボタン"
dynamic: "動的ブロック"
dynamicDescription: "このブロックは廃止されています。今後は{play}を利用してください。"

note: "ノート埋め込み"
_note:
Expand Down Expand Up @@ -2625,4 +2627,3 @@ _mediaControls:
pip: "ピクチャインピクチャ"
playbackRate: "再生速度"
loop: "ループ再生"

15 changes: 15 additions & 0 deletions packages/frontend/src/components/page/page.block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,28 @@ import XText from './page.text.vue';
import XSection from './page.section.vue';
import XImage from './page.image.vue';
import XNote from './page.note.vue';
import XDynamic from './page.dynamic.vue';
function getComponent(type: string) {
switch (type) {
case 'text': return XText;
case 'section': return XSection;
case 'image': return XImage;
case 'note': return XNote;
// 動的ページの代替用ブロック
case 'button':
case 'if':
case 'textarea':
case 'post':
case 'canvas':
case 'numberInput':
case 'textInput':
case 'switch':
case 'radioButton':
case 'counter':
return XDynamic;
default: return null;
}
}
Expand Down
43 changes: 43 additions & 0 deletions packages/frontend/src/components/page/page.dynamic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<!-- 動的ページのブロックの代替。利用できないということを表示する -->
<template>
<div :class="$style.root">
<div :class="$style.heading"><i class="ti ti-dice-5"></i> {{ i18n.ts._pages.blocks.dynamic }}</div>
<I18n :src="i18n.ts._pages.blocks.dynamicDescription" tag="div" :class="$style.text">
<template #play>
<MkA to="/play" class="_link">Play</MkA>
</template>
</I18n>
</div>
</template>

<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
block: Misskey.entities.PageBlock,
page: Misskey.entities.Page,
}>();
</script>

<style lang="scss" module>
.root {
border: 1px solid var(--divider);
border-radius: var(--radius);
padding: var(--margin);
text-align: center;
}
.heading {
font-weight: 700;
}
.text {
font-size: 90%;
}
</style>
2 changes: 1 addition & 1 deletion packages/frontend/src/components/page/page.text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div class="_gaps" :class="$style.textRoot">
<Mfm :text="block.text ?? ''" :isNote="false"/>
<div v-if="isEnabledUrlPreview">
<div v-if="isEnabledUrlPreview" class="_gaps_s">
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
</div>
</div>
Expand Down

1 comment on commit 61978cb

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chromatic detects changes. Please review the changes on Chromatic.

Please sign in to comment.