Skip to content

Commit

Permalink
enhance(tms): settings/flagsを統合してfeaturesに変更
Browse files Browse the repository at this point in the history
* enh: flagsページをsettingsページに統合する

* change: /tms/settings -> /tms/features

* enh: FormSection -> MkFolder + MkFormFooter
  • Loading branch information
taiyme committed Nov 7, 2024
1 parent 6710607 commit 76664b6
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 413 deletions.
64 changes: 20 additions & 44 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10485,29 +10485,37 @@ export interface Locale extends ILocale {
*/
readonly "aboutTaiyme": string;
/**
* taiyme拡張機能
* taiyme限定機能
*/
readonly "taiymeSettings": string;
readonly "taiymeFeatures": string;
/**
* taiyme実験的機能
* これらの機能はtaiymeで独自実装したものです。
*/
readonly "taiymeFlags": string;
readonly "taiymeFeaturesDescription": string;
/**
* 基本機能
*/
readonly "taiymeBasicFeatures": string;
/**
* 実験的機能
*/
readonly "taiymeExperimentalFeatures": string;
/**
* これらの機能を有効にすると、ページの表示や挙動に深刻な影響を及ぼし、{name}が正常に利用できなくなる可能性があります。
*/
readonly "taiymeExperimentalFeaturesWarning": ParameterizedString<"name">;
/**
* {name}は、Misskeyの派生であるtaiymeを使用したサーバーのひとつです。
*/
readonly "poweredByTaiyme": ParameterizedString<"name">;
/**
* {name}を支援
* {name}を支援する
*/
readonly "supportX": ParameterizedString<"name">;
/**
* コミットハッシュ
*/
readonly "commitHash": string;
/**
* 問題の報告や要望はGitHubで受け付けています。
*/
readonly "reportIssuesToGithub": string;
/**
* センシティブな画像
*/
Expand Down Expand Up @@ -10573,14 +10581,10 @@ export interface Locale extends ILocale {
*/
readonly "updatedX": ParameterizedString<"x">;
readonly "_about": {
/**
* taiymeについて
*/
readonly "title": string;
/**
* taiymeは、Misskeyから派生したオープンソースのソフトウェアです。
*/
readonly "description": string;
readonly "taiymeIsOSS": string;
/**
* プロジェクトメンバー
*/
Expand All @@ -10594,15 +10598,7 @@ export interface Locale extends ILocale {
*/
readonly "patrons": string;
};
readonly "_settings": {
/**
* taiyme拡張機能
*/
readonly "title": string;
/**
* これらの機能はtaiymeで独自実装したものです。
*/
readonly "description": string;
readonly "_basicFeatures": {
readonly "_tickerPosition": {
/**
* ノートのサーバー情報の表示位置
Expand Down Expand Up @@ -10684,27 +10680,7 @@ export interface Locale extends ILocale {
readonly "caption": string;
};
};
readonly "_flags": {
/**
* taiyme実験的機能
*/
readonly "title": string;
/**
* これらの機能はtaiymeで独自実装したものです。
*/
readonly "description": string;
/**
* これらの設定を有効にすると、ページの表示や挙動に深刻な影響を及ぼし、{name}が正常に利用できなくなる可能性があります。
*/
readonly "warning": ParameterizedString<"name">;
/**
* {x}を強制取得
*/
readonly "forceFetchX": ParameterizedString<"x">;
/**
* {x}を開く
*/
readonly "openX": ParameterizedString<"x">;
readonly "_experimentalFeatures": {
readonly "_preventLongPressContextMenu": {
/**
* 長押しによるコンテキストメニューイベントの発行を防ぐ
Expand Down
24 changes: 9 additions & 15 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2794,12 +2794,14 @@ _tms:
taiy: "taiy"
taiyme: "taiyme"
aboutTaiyme: "taiymeについて"
taiymeSettings: "taiyme拡張機能"
taiymeFlags: "taiyme実験的機能"
taiymeFeatures: "taiyme限定機能"
taiymeFeaturesDescription: "これらの機能はtaiymeで独自実装したものです。"
taiymeBasicFeatures: "基本機能"
taiymeExperimentalFeatures: "実験的機能"
taiymeExperimentalFeaturesWarning: "これらの機能を有効にすると、ページの表示や挙動に深刻な影響を及ぼし、{name}が正常に利用できなくなる可能性があります。"
poweredByTaiyme: "{name}は、Misskeyの派生であるtaiymeを使用したサーバーのひとつです。"
supportX: "{name}を支援"
supportX: "{name}を支援する"
commitHash: "コミットハッシュ"
reportIssuesToGithub: "問題の報告や要望はGitHubで受け付けています。"
sensitiveImage: "センシティブな画像"
sensitiveVideo: "センシティブな動画"
sensitiveAudio: "センシティブな音声"
Expand All @@ -2817,14 +2819,11 @@ _tms:
taiymeUpdated: "taiymeが更新されました!"
updatedX: "{x}が更新されました!"
_about:
title: "taiymeについて"
description: "taiymeは、Misskeyから派生したオープンソースのソフトウェアです。"
taiymeIsOSS: "taiymeは、Misskeyから派生したオープンソースのソフトウェアです。"
projectMembers: "プロジェクトメンバー"
contributors: "コントリビューター"
patrons: "支援者"
_settings:
title: "taiyme拡張機能"
description: "これらの機能はtaiymeで独自実装したものです。"
_basicFeatures:
_tickerPosition:
label: "ノートのサーバー情報の表示位置"
default: "デフォルト"
Expand All @@ -2847,12 +2846,7 @@ _tms:
_pullToRefreshAllReload:
label: "「引っ張ってリロード」でページ全体を再読み込みする"
caption: "構成しているページ全体を再読み込みする動作に置き換えます。"
_flags:
title: "taiyme実験的機能"
description: "これらの機能はtaiymeで独自実装したものです。"
warning: "これらの設定を有効にすると、ページの表示や挙動に深刻な影響を及ぼし、{name}が正常に利用できなくなる可能性があります。"
forceFetchX: "{x}を強制取得"
openX: "{x}を開く"
_experimentalFeatures:
_preventLongPressContextMenu:
label: "長押しによるコンテキストメニューイベントの発行を防ぐ"
caption: "長押しを含む操作が中断される問題を解消します。"
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/pages/tms/about.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSpacer :contentMax="600" :marginMin="20">
<div class="_gaps_m">
<TmsNoCache><TmsSoftwareBanner/></TmsNoCache>
<div style="text-align: center;">{{ i18n.ts._tms._about.description }}</div>
<div style="text-align: center;">{{ i18n.ts._tms._about.taiymeIsOSS }}</div>
<FormSection>
<div class="_gaps_s">
<TmsSoftwareRepository/>
Expand Down Expand Up @@ -61,7 +61,7 @@ import TmsSoftwareDonation from '@/components/TmsSoftwareDonation.vue';
import TmsSoftwareRepository from '@/components/TmsSoftwareRepository.vue';

definePageMetadata(() => ({
title: i18n.ts._tms._about.title,
title: i18n.ts._tms.aboutTaiyme,
icon: 'ti ti-info-circle',
}));
</script>
95 changes: 95 additions & 0 deletions packages/frontend/src/pages/tms/features.basic.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div class="_gaps_m">
<div class="_gaps_s">
<MkInfo>{{ i18n.ts._tms.taiymeFeaturesDescription }} <MkA to="/tms/about" class="_link">{{ i18n.ts.learnMore }}</MkA></MkInfo>
</div>
<MkFolder defaultOpen>
<template #icon><i class="ti ti-palette"></i></template>
<template #label>{{ i18n.ts.appearance }}</template>
<template v-if="appearancesForm.modified.value" #footer>
<MkFormFooter :form="appearancesForm"/>
</template>
<div class="_gaps">
<MkSelect v-model="appearancesForm.state.tickerPosition">
<template #label>
<span>{{ i18n.ts._tms._basicFeatures._tickerPosition.label }}</span>
<span v-if="appearancesForm.modifiedStates.tickerPosition" class="_modified">{{ i18n.ts.modified }}</span>
</template>
<option value="default">{{ i18n.ts._tms._basicFeatures._tickerPosition.default }}</option>
<option value="leftVerticalBar">{{ i18n.ts._tms._basicFeatures._tickerPosition.leftVerticalBar }}</option>
<option value="rightVerticalBar">{{ i18n.ts._tms._basicFeatures._tickerPosition.rightVerticalBar }}</option>
<option value="leftWatermark">{{ i18n.ts._tms._basicFeatures._tickerPosition.leftWatermark }}</option>
<option value="rightWatermark">{{ i18n.ts._tms._basicFeatures._tickerPosition.rightWatermark }}</option>
</MkSelect>
<MkSelect v-model="appearancesForm.state.superMenuDisplayMode">
<template #label>
<span>{{ i18n.ts._tms._basicFeatures._superMenuDisplayMode.label }}</span>
<span v-if="appearancesForm.modifiedStates.superMenuDisplayMode" class="_modified">{{ i18n.ts.modified }}</span>
</template>
<template #caption>{{ i18n.ts._tms._basicFeatures._superMenuDisplayMode.caption }}</template>
<option value="default">{{ i18n.ts._tms._basicFeatures._superMenuDisplayMode.default }}</option>
<option value="classic">{{ i18n.ts._tms._basicFeatures._superMenuDisplayMode.classic }}</option>
<option value="forceList">{{ i18n.ts._tms._basicFeatures._superMenuDisplayMode.forceList }}</option>
</MkSelect>
</div>
</MkFolder>
<MkFolder defaultOpen>
<template #icon><i class="ti ti-hand-click"></i></template>
<template #label>{{ i18n.ts.operations }}</template>
<template v-if="operationsForm.modified.value" #footer>
<MkFormFooter :form="operationsForm"/>
</template>
<div class="_gaps">
<MkSelect v-model="operationsForm.state.pullToRefreshSensitivity">
<template #label>
<span>{{ i18n.ts._tms._basicFeatures._pullToRefreshSensitivity.label }}</span>
<span v-if="operationsForm.modifiedStates.pullToRefreshSensitivity" class="_modified">{{ i18n.ts.modified }}</span>
</template>
<template #caption>{{ i18n.ts._tms._basicFeatures._pullToRefreshSensitivity.caption }}</template>
<option value="low">{{ i18n.ts._tms._basicFeatures._pullToRefreshSensitivity.low }}</option>
<option value="middle">{{ i18n.ts._tms._basicFeatures._pullToRefreshSensitivity.middle }}</option>
<option value="high">{{ i18n.ts._tms._basicFeatures._pullToRefreshSensitivity.high }}</option>
</MkSelect>
<MkSwitch v-model="operationsForm.state.pullToRefreshAllReload">
<template #label>
<span>{{ i18n.ts._tms._basicFeatures._pullToRefreshAllReload.label }}</span>
<span v-if="operationsForm.modifiedStates.pullToRefreshAllReload" class="_modified">{{ i18n.ts.modified }}</span>
</template>
<template #caption>{{ i18n.ts._tms._basicFeatures._pullToRefreshAllReload.caption }}</template>
</MkSwitch>
</div>
</MkFolder>
</div>
</template>

<script lang="ts" setup>
import { i18n } from '@/i18n.js';
import { useForm } from '@/scripts/use-form.js';
import { tmsStore } from '@/tms/store.js';
import MkFolder from '@/components/MkFolder.vue';
import MkFormFooter from '@/components/MkFormFooter.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkSelect from '@/components/MkSelect.vue';
import MkSwitch from '@/components/MkSwitch.vue';

const appearancesForm = useForm({
tickerPosition: tmsStore.state.tickerPosition,
superMenuDisplayMode: tmsStore.state.superMenuDisplayMode,
}, async (state) => {
tmsStore.set('tickerPosition', state.tickerPosition);
tmsStore.set('superMenuDisplayMode', state.superMenuDisplayMode);
});

const operationsForm = useForm({
pullToRefreshSensitivity: tmsStore.state.pullToRefreshSensitivity,
pullToRefreshAllReload: tmsStore.state.pullToRefreshAllReload,
}, async (state) => {
tmsStore.set('pullToRefreshSensitivity', state.pullToRefreshSensitivity);
tmsStore.set('pullToRefreshAllReload', state.pullToRefreshAllReload);
});
</script>
47 changes: 47 additions & 0 deletions packages/frontend/src/pages/tms/features.experimental.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<div class="_gaps_m">
<div class="_gaps_s">
<MkInfo>{{ i18n.ts._tms.taiymeFeaturesDescription }} <MkA to="/tms/about" class="_link">{{ i18n.ts.learnMore }}</MkA></MkInfo>
<MkInfo warn>{{ i18n.tsx._tms.taiymeExperimentalFeaturesWarning({ name: instance.name ?? host }) }}</MkInfo>
</div>
<MkFolder defaultOpen>
<template #icon><i class="ti ti-hand-click"></i></template>
<template #label>{{ i18n.ts.operations }}</template>
<template v-if="operationsForm.modified.value" #footer>
<MkFormFooter :form="operationsForm"/>
</template>
<div class="_gaps">
<MkSwitch v-model="operationsForm.state.preventLongPressContextMenu">
<template #label>
<span>{{ i18n.ts._tms._experimentalFeatures._preventLongPressContextMenu.label }}</span>
<span v-if="operationsForm.modifiedStates.preventLongPressContextMenu" class="_modified">{{ i18n.ts.modified }}</span>
</template>
<template #caption>{{ i18n.ts._tms._experimentalFeatures._preventLongPressContextMenu.caption }}</template>
</MkSwitch>
</div>
</MkFolder>
</div>
</template>

<script lang="ts" setup>
import { host } from '@@/js/config.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
import { useForm } from '@/scripts/use-form.js';
import { tmsFlaskStore } from '@/tms/flask-store.js';
import MkFolder from '@/components/MkFolder.vue';
import MkFormFooter from '@/components/MkFormFooter.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkSwitch from '@/components/MkSwitch.vue';

const operationsForm = useForm({
preventLongPressContextMenu: tmsFlaskStore.state.preventLongPressContextMenu,
}, async (state) => {
tmsFlaskStore.set('preventLongPressContextMenu', state.preventLongPressContextMenu);
});
</script>
75 changes: 75 additions & 0 deletions packages/frontend/src/pages/tms/features.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->

<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<template #default>
<MkHorizontalSwipe v-model:tab="tab" :tabs="headerTabs">
<MkSpacer v-if="tab === 'basic'" :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="ready">
<XBasicFeatures/>
</FormSuspense>
</MkSpacer>
<MkSpacer v-else-if="tab === 'experimental'" :contentMax="700" :marginMin="16" :marginMax="32">
<FormSuspense :p="ready">
<XExperimentalFeatures/>
</FormSuspense>
</MkSpacer>
</MkHorizontalSwipe>
</template>
</MkStickyContainer>
</template>

<script lang="ts" setup>
import { computed, defineAsyncComponent, ref } from 'vue';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { tmsFlaskStore } from '@/tms/flask-store.js';
import { tmsStore } from '@/tms/store.js';
import FormSuspense from '@/components/form/suspense.vue';
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';

const props = withDefaults(defineProps<{
initialTab?: string;
}>(), {
initialTab: 'basic',
});

// eslint-disable-next-line vue/no-setup-props-reactivity-loss
const tab = ref(props.initialTab);

const ready = async () => {
await tmsStore.loaded;
await tmsFlaskStore.loaded;
};

const XBasicFeatures = defineAsyncComponent(() => import('@/pages/tms/features.basic.vue'));
const XExperimentalFeatures = defineAsyncComponent(() => import('@/pages/tms/features.experimental.vue'));

const headerActions = computed(() => []);

const headerTabs = computed(() => [{
key: 'basic',
title: i18n.ts._tms.taiymeBasicFeatures,
icon: 'ti ti-settings',
}, {
key: 'experimental',
title: i18n.ts._tms.taiymeExperimentalFeatures,
icon: 'ti ti-flask',
}]);

definePageMetadata(() => ({
title: i18n.ts._tms.taiymeFeatures,
icon: 'ti ti-settings',
}));
</script>

<style lang="scss" module>
.footer {
-webkit-backdrop-filter: var(--MI-blur, blur(15px));
backdrop-filter: var(--MI-blur, blur(15px));
}
</style>
Loading

0 comments on commit 76664b6

Please sign in to comment.