2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2022-12-22 01:01:58 +01:00
|
|
|
<template>
|
2023-01-06 05:40:17 +01:00
|
|
|
<div class="_gaps_m">
|
2023-01-07 07:09:46 +01:00
|
|
|
<MkSelect v-model="type">
|
2022-12-22 01:01:58 +01:00
|
|
|
<template #label>{{ i18n.ts.sound }}</template>
|
|
|
|
<option v-for="x in soundsTypes" :key="x" :value="x">{{ x == null ? i18n.ts.none : x }}</option>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkSelect>
|
2023-05-19 13:52:15 +02:00
|
|
|
<MkRange v-model="volume" :min="0" :max="1" :step="0.05" :textConverter="(v) => `${Math.floor(v * 100)}%`">
|
2022-12-22 01:01:58 +01:00
|
|
|
<template #label>{{ i18n.ts.volume }}</template>
|
2023-01-07 07:09:46 +01:00
|
|
|
</MkRange>
|
2022-12-22 01:01:58 +01:00
|
|
|
|
2023-01-06 01:41:14 +01:00
|
|
|
<div class="_buttons">
|
|
|
|
<MkButton inline @click="listen"><i class="ti ti-player-play"></i> {{ i18n.ts.listen }}</MkButton>
|
|
|
|
<MkButton inline primary @click="save"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
|
2022-12-22 01:01:58 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
2023-01-06 01:41:14 +01:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
import MkRange from '@/components/MkRange.vue';
|
2022-12-22 01:01:58 +01:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { playFile, soundsTypes } from '@/scripts/sound';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
type: string;
|
|
|
|
volume: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'update', result: { type: string; volume: number; }): void;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
let type = $ref(props.type);
|
|
|
|
let volume = $ref(props.volume);
|
|
|
|
|
|
|
|
function listen() {
|
|
|
|
playFile(type, volume);
|
|
|
|
}
|
|
|
|
|
|
|
|
function save() {
|
|
|
|
emit('update', { type, volume });
|
|
|
|
}
|
|
|
|
</script>
|