mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 23:44:01 +02:00
refactor(frontend): MkRadiosの指定をpropsから行うように (#16597)
* refactor(frontend): MkRadiosの指定をpropsから行うように * spdx * fix lint * fix: mkradiosを動的slotsに対応させる * fix: remove comment [ci skip] * fix lint * fix lint * migrate * rename * fix * fix * fix types * remove unused imports * fix * wip --------- Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
@@ -35,22 +35,28 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<MkFolder :defaultOpen="true">
|
||||
<template #label>{{ i18n.ts._reversi.blackOrWhite }}</template>
|
||||
|
||||
<MkRadios v-model="game.bw">
|
||||
<option value="random">{{ i18n.ts.random }}</option>
|
||||
<option :value="'1'">
|
||||
<MkRadios
|
||||
v-model="game.bw"
|
||||
:options="[
|
||||
{ value: 'random', label: i18n.ts.random },
|
||||
{ value: '1', slotId: 'user1' },
|
||||
{ value: '2', slotId: 'user2' },
|
||||
]"
|
||||
>
|
||||
<template #option-user1>
|
||||
<I18n :src="i18n.ts._reversi.blackIs" tag="span">
|
||||
<template #name>
|
||||
<b><MkUserName :user="game.user1"/></b>
|
||||
</template>
|
||||
</I18n>
|
||||
</option>
|
||||
<option :value="'2'">
|
||||
</template>
|
||||
<template #option-user2>
|
||||
<I18n :src="i18n.ts._reversi.blackIs" tag="span">
|
||||
<template #name>
|
||||
<b><MkUserName :user="game.user2"/></b>
|
||||
</template>
|
||||
</I18n>
|
||||
</option>
|
||||
</template>
|
||||
</MkRadios>
|
||||
</MkFolder>
|
||||
|
||||
@@ -58,15 +64,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
<template #label>{{ i18n.ts._reversi.timeLimitForEachTurn }}</template>
|
||||
<template #suffix>{{ game.timeLimitForEachTurn }}{{ i18n.ts._time.second }}</template>
|
||||
|
||||
<MkRadios v-model="game.timeLimitForEachTurn">
|
||||
<option :value="5">5{{ i18n.ts._time.second }}</option>
|
||||
<option :value="10">10{{ i18n.ts._time.second }}</option>
|
||||
<option :value="30">30{{ i18n.ts._time.second }}</option>
|
||||
<option :value="60">60{{ i18n.ts._time.second }}</option>
|
||||
<option :value="90">90{{ i18n.ts._time.second }}</option>
|
||||
<option :value="120">120{{ i18n.ts._time.second }}</option>
|
||||
<option :value="180">180{{ i18n.ts._time.second }}</option>
|
||||
<option :value="3600">3600{{ i18n.ts._time.second }}</option>
|
||||
<MkRadios
|
||||
v-model="game.timeLimitForEachTurn"
|
||||
:options="gameTurnOptionsDef"
|
||||
>
|
||||
</MkRadios>
|
||||
</MkFolder>
|
||||
|
||||
@@ -110,7 +111,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, watch, ref, onMounted, shallowRef, onUnmounted } from 'vue';
|
||||
import { computed, watch, ref, onUnmounted } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Reversi from 'misskey-reversi';
|
||||
import type { MenuItem } from '@/types/menu.js';
|
||||
@@ -122,6 +123,7 @@ import MkRadios from '@/components/MkRadios.vue';
|
||||
import MkSwitch from '@/components/MkSwitch.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import * as os from '@/os.js';
|
||||
import type { MkRadiosOption } from '@/components/MkRadios.vue';
|
||||
import { useRouter } from '@/router.js';
|
||||
|
||||
const $i = ensureSignin();
|
||||
@@ -139,6 +141,17 @@ const shareWhenStart = defineModel<boolean>('shareWhenStart', { default: false }
|
||||
|
||||
const game = ref<Misskey.entities.ReversiGameDetailed>(deepClone(props.game));
|
||||
|
||||
const gameTurnOptionsDef = [
|
||||
{ value: 5, label: '5' + i18n.ts._time.second },
|
||||
{ value: 10, label: '10' + i18n.ts._time.second },
|
||||
{ value: 30, label: '30' + i18n.ts._time.second },
|
||||
{ value: 60, label: '60' + i18n.ts._time.second },
|
||||
{ value: 90, label: '90' + i18n.ts._time.second },
|
||||
{ value: 120, label: '120' + i18n.ts._time.second },
|
||||
{ value: 180, label: '180' + i18n.ts._time.second },
|
||||
{ value: 3600, label: '3600' + i18n.ts._time.second },
|
||||
] as MkRadiosOption<number>[];
|
||||
|
||||
const mapName = computed(() => {
|
||||
if (game.value.map == null) return 'Random';
|
||||
const found = Object.values(Reversi.maps).find(x => x.data.join('') === game.value.map.join(''));
|
||||
|
||||
Reference in New Issue
Block a user