2023-07-27 07:31:52 +02:00
|
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
-->
|
|
|
|
|
|
2023-01-05 05:59:48 +01:00
|
|
|
|
<template>
|
|
|
|
|
<MkStickyContainer>
|
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 13:52:15 +02:00
|
|
|
|
<MkSpacer :contentMax="700">
|
2023-01-16 02:04:10 +01:00
|
|
|
|
<div class="_gaps">
|
2023-01-05 13:04:56 +01:00
|
|
|
|
<MkInput v-model="title">
|
|
|
|
|
<template #label>{{ i18n.ts._play.title }}</template>
|
|
|
|
|
</MkInput>
|
2024-01-14 07:31:11 +01:00
|
|
|
|
<MkTextarea v-model="summary" :mfmAutocomplete="true" :mfmPreview="true">
|
2023-01-05 13:04:56 +01:00
|
|
|
|
<template #label>{{ i18n.ts._play.summary }}</template>
|
|
|
|
|
</MkTextarea>
|
2023-09-30 21:53:52 +02:00
|
|
|
|
<MkButton primary @click="selectPreset">{{ i18n.ts.selectFromPresets }}<i class="ph-caret-down ph-bold ph-lg"></i></MkButton>
|
2023-12-16 05:18:12 +01:00
|
|
|
|
<MkCodeEditor v-model="script" lang="is">
|
2023-01-05 13:04:56 +01:00
|
|
|
|
<template #label>{{ i18n.ts._play.script }}</template>
|
2023-12-16 05:18:12 +01:00
|
|
|
|
</MkCodeEditor>
|
2023-08-21 13:23:09 +02:00
|
|
|
|
<MkSelect v-model="visibility">
|
|
|
|
|
<template #label>{{ i18n.ts.visibility }}</template>
|
2024-03-15 14:02:57 +01:00
|
|
|
|
<template #caption>{{ i18n.ts._play.visibilityDescription }}</template>
|
2023-08-21 13:23:09 +02:00
|
|
|
|
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
|
|
|
|
|
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
|
|
|
|
|
</MkSelect>
|
2024-03-15 14:02:57 +01:00
|
|
|
|
<div class="_buttons">
|
2024-03-24 12:53:52 +01:00
|
|
|
|
<MkButton primary @click="save"><i class="ph-check ph-bold ph-lg"></i> {{ i18n.ts.save }}</MkButton>
|
|
|
|
|
<MkButton @click="show"><i class="ph-eye ph-bold ph-lg"></i> {{ i18n.ts.show }}</MkButton>
|
|
|
|
|
<MkButton v-if="flash" danger @click="del"><i class="ph-trash ph-bold ph-lg"></i> {{ i18n.ts.delete }}</MkButton>
|
2024-03-15 14:02:57 +01:00
|
|
|
|
</div>
|
2023-01-05 05:59:48 +01:00
|
|
|
|
</div>
|
|
|
|
|
</MkSpacer>
|
|
|
|
|
</MkStickyContainer>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
|
import { computed, ref } from 'vue';
|
2023-12-26 06:19:35 +01:00
|
|
|
|
import * as Misskey from 'misskey-js';
|
2023-01-05 05:59:48 +01:00
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
|
import * as os from '@/os.js';
|
2024-01-04 10:32:46 +01:00
|
|
|
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2023-01-07 07:09:46 +01:00
|
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
2023-12-16 05:18:12 +01:00
|
|
|
|
import MkCodeEditor from '@/components/MkCodeEditor.vue';
|
2023-01-07 07:09:46 +01:00
|
|
|
|
import MkInput from '@/components/MkInput.vue';
|
2023-08-21 13:23:09 +02:00
|
|
|
|
import MkSelect from '@/components/MkSelect.vue';
|
2024-01-30 13:07:34 +01:00
|
|
|
|
import { useRouter } from '@/router/supplier.js';
|
2023-01-05 05:59:48 +01:00
|
|
|
|
|
2023-09-17 09:54:25 +02:00
|
|
|
|
const PRESET_DEFAULT = `/// @ 0.16.0
|
2023-01-05 05:59:48 +01:00
|
|
|
|
|
|
|
|
|
var name = ""
|
|
|
|
|
|
|
|
|
|
Ui:render([
|
|
|
|
|
Ui:C:textInput({
|
|
|
|
|
label: "Your name"
|
|
|
|
|
onInput: @(v) { name = v }
|
|
|
|
|
})
|
|
|
|
|
Ui:C:button({
|
|
|
|
|
text: "Hello"
|
|
|
|
|
onClick: @() {
|
|
|
|
|
Mk:dialog(null \`Hello, {name}!\`)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
])
|
2023-01-16 02:31:30 +01:00
|
|
|
|
`;
|
2023-01-05 05:59:48 +01:00
|
|
|
|
|
2023-09-17 09:54:25 +02:00
|
|
|
|
const PRESET_OMIKUJI = `/// @ 0.16.0
|
2023-01-16 02:04:10 +01:00
|
|
|
|
// ユーザーごとに日替わりのおみくじのプリセット
|
|
|
|
|
|
|
|
|
|
// 選択肢
|
|
|
|
|
let choices = [
|
|
|
|
|
"ギガ吉"
|
|
|
|
|
"大吉"
|
|
|
|
|
"吉"
|
|
|
|
|
"中吉"
|
|
|
|
|
"小吉"
|
|
|
|
|
"末吉"
|
|
|
|
|
"凶"
|
|
|
|
|
"大凶"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
// シードが「ユーザーID+今日の日付」である乱数生成器を用意
|
2023-01-16 02:07:46 +01:00
|
|
|
|
let random = Math:gen_rng(\`{USER_ID}{Date:year()}{Date:month()}{Date:day()}\`)
|
2023-01-16 02:04:10 +01:00
|
|
|
|
|
|
|
|
|
// ランダムに選択肢を選ぶ
|
|
|
|
|
let chosen = choices[random(0 (choices.len - 1))]
|
|
|
|
|
|
|
|
|
|
// 結果のテキスト
|
|
|
|
|
let result = \`今日のあなたの運勢は **{chosen}** です。\`
|
|
|
|
|
|
|
|
|
|
// UIを表示
|
|
|
|
|
Ui:render([
|
|
|
|
|
Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:mfm({ text: result })
|
|
|
|
|
Ui:C:postFormButton({
|
|
|
|
|
text: "投稿する"
|
|
|
|
|
rounded: true
|
|
|
|
|
primary: true
|
|
|
|
|
form: {
|
|
|
|
|
text: \`{result}{Str:lf}{THIS_URL}\`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
])
|
|
|
|
|
`;
|
2023-01-16 02:31:30 +01:00
|
|
|
|
|
2023-09-17 09:54:25 +02:00
|
|
|
|
const PRESET_SHUFFLE = `/// @ 0.16.0
|
2023-01-17 09:10:33 +01:00
|
|
|
|
// 巻き戻し可能な文字シャッフルのプリセット
|
|
|
|
|
|
|
|
|
|
let string = "ペペロンチーノ"
|
|
|
|
|
let length = string.len
|
|
|
|
|
|
|
|
|
|
// 過去の結果を保存しておくやつ
|
|
|
|
|
var results = []
|
|
|
|
|
|
|
|
|
|
// どれだけ巻き戻しているか
|
|
|
|
|
var cursor = 0
|
|
|
|
|
|
|
|
|
|
@do() {
|
|
|
|
|
if (cursor != 0) {
|
|
|
|
|
results = results.slice(0 (cursor + 1))
|
|
|
|
|
cursor = 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let chars = []
|
|
|
|
|
for (let i, length) {
|
|
|
|
|
let r = Math:rnd(0 (length - 1))
|
|
|
|
|
chars.push(string.pick(r))
|
|
|
|
|
}
|
|
|
|
|
let result = chars.join("")
|
|
|
|
|
|
|
|
|
|
results.push(result)
|
|
|
|
|
|
|
|
|
|
// UIを表示
|
|
|
|
|
render(result)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@back() {
|
|
|
|
|
cursor = cursor + 1
|
|
|
|
|
let result = results[results.len - (cursor + 1)]
|
|
|
|
|
render(result)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@forward() {
|
|
|
|
|
cursor = cursor - 1
|
|
|
|
|
let result = results[results.len - (cursor + 1)]
|
|
|
|
|
render(result)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@render(result) {
|
|
|
|
|
Ui:render([
|
|
|
|
|
Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:mfm({ text: result })
|
|
|
|
|
Ui:C:buttons({
|
|
|
|
|
buttons: [{
|
|
|
|
|
text: "←"
|
|
|
|
|
disabled: !(results.len > 1 && (results.len - cursor) > 1)
|
|
|
|
|
onClick: back
|
|
|
|
|
} {
|
|
|
|
|
text: "→"
|
|
|
|
|
disabled: !(results.len > 1 && cursor > 0)
|
|
|
|
|
onClick: forward
|
|
|
|
|
} {
|
|
|
|
|
text: "引き直す"
|
|
|
|
|
onClick: do
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
Ui:C:postFormButton({
|
|
|
|
|
text: "投稿する"
|
|
|
|
|
rounded: true
|
|
|
|
|
primary: true
|
|
|
|
|
form: {
|
|
|
|
|
text: \`{result}{Str:lf}{THIS_URL}\`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do()
|
|
|
|
|
`;
|
|
|
|
|
|
2023-09-17 09:54:25 +02:00
|
|
|
|
const PRESET_QUIZ = `/// @ 0.16.0
|
2023-02-17 06:57:05 +01:00
|
|
|
|
let title = '地理クイズ'
|
|
|
|
|
|
|
|
|
|
let qas = [{
|
|
|
|
|
q: 'オーストラリアの首都は?'
|
|
|
|
|
choices: ['シドニー' 'キャンベラ' 'メルボルン']
|
|
|
|
|
a: 'キャンベラ'
|
|
|
|
|
aDescription: '最大の都市はシドニーですが首都はキャンベラです。'
|
|
|
|
|
} {
|
|
|
|
|
q: '国土面積2番目の国は?'
|
|
|
|
|
choices: ['カナダ' 'アメリカ' '中国']
|
|
|
|
|
a: 'カナダ'
|
|
|
|
|
aDescription: '大きい順にロシア、カナダ、アメリカ、中国です。'
|
|
|
|
|
} {
|
|
|
|
|
q: '二重内陸国ではないのは?'
|
|
|
|
|
choices: ['リヒテンシュタイン' 'ウズベキスタン' 'レソト']
|
|
|
|
|
a: 'レソト'
|
|
|
|
|
aDescription: 'レソトは(一重)内陸国です。'
|
|
|
|
|
} {
|
|
|
|
|
q: '閘門がない運河は?'
|
|
|
|
|
choices: ['キール運河' 'スエズ運河' 'パナマ運河']
|
|
|
|
|
a: 'スエズ運河'
|
|
|
|
|
aDescription: 'スエズ運河は高低差がないので閘門はありません。'
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
let qaEls = [Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:text({
|
|
|
|
|
size: 1.5
|
|
|
|
|
bold: true
|
|
|
|
|
text: title
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})]
|
|
|
|
|
|
|
|
|
|
var qn = 0
|
|
|
|
|
each (let qa, qas) {
|
|
|
|
|
qn += 1
|
|
|
|
|
qa.id = Util:uuid()
|
|
|
|
|
qaEls.push(Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
bgColor: '#000'
|
|
|
|
|
fgColor: '#fff'
|
|
|
|
|
padding: 16
|
|
|
|
|
rounded: true
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:text({
|
|
|
|
|
text: \`Q{qn} {qa.q}\`
|
|
|
|
|
})
|
|
|
|
|
Ui:C:select({
|
|
|
|
|
items: qa.choices.map(@(c) {{ text: c, value: c }})
|
|
|
|
|
onChange: @(v) { qa.userAnswer = v }
|
|
|
|
|
})
|
|
|
|
|
Ui:C:container({
|
|
|
|
|
children: []
|
|
|
|
|
} \`{qa.id}:a\`)
|
|
|
|
|
]
|
|
|
|
|
} qa.id))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@finish() {
|
|
|
|
|
var score = 0
|
|
|
|
|
|
|
|
|
|
each (let qa, qas) {
|
|
|
|
|
let correct = qa.userAnswer == qa.a
|
|
|
|
|
if (correct) score += 1
|
|
|
|
|
let el = Ui:get(\`{qa.id}:a\`)
|
|
|
|
|
el.update({
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:text({
|
|
|
|
|
size: 1.2
|
|
|
|
|
bold: true
|
|
|
|
|
color: if (correct) '#f00' else '#00f'
|
|
|
|
|
text: if (correct) '🎉正解' else '不正解'
|
|
|
|
|
})
|
|
|
|
|
Ui:C:text({
|
|
|
|
|
text: qa.aDescription
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let result = \`{title}の結果は{qas.len}問中{score}問正解でした。\`
|
|
|
|
|
Ui:get('footer').update({
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:postFormButton({
|
|
|
|
|
text: '結果を共有'
|
|
|
|
|
rounded: true
|
|
|
|
|
primary: true
|
|
|
|
|
form: {
|
|
|
|
|
text: \`{result}{Str:lf}{THIS_URL}\`
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qaEls.push(Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:button({
|
|
|
|
|
text: '答え合わせ'
|
|
|
|
|
primary: true
|
|
|
|
|
rounded: true
|
|
|
|
|
onClick: finish
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
} 'footer'))
|
|
|
|
|
|
|
|
|
|
Ui:render(qaEls)
|
|
|
|
|
`;
|
|
|
|
|
|
2023-09-17 09:54:25 +02:00
|
|
|
|
const PRESET_TIMELINE = `/// @ 0.16.0
|
2023-01-16 02:31:30 +01:00
|
|
|
|
// APIリクエストを行いローカルタイムラインを表示するプリセット
|
|
|
|
|
|
|
|
|
|
@fetch() {
|
|
|
|
|
Ui:render([
|
|
|
|
|
Ui:C:container({
|
|
|
|
|
align: 'center'
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:text({ text: "読み込み中..." })
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
// タイムライン取得
|
|
|
|
|
let notes = Mk:api("notes/local-timeline" {})
|
|
|
|
|
|
|
|
|
|
// それぞれのノートごとにUI要素作成
|
|
|
|
|
let noteEls = []
|
|
|
|
|
each (let note, notes) {
|
2023-04-26 07:10:04 +02:00
|
|
|
|
// 表示名を設定していないアカウントはidを表示
|
|
|
|
|
let userName = if Core:type(note.user.name) == "str" note.user.name else note.user.username
|
|
|
|
|
// リノートもしくはメディア・投票のみで本文が無いノートに代替表示文を設定
|
|
|
|
|
let noteText = if Core:type(note.text) == "str" note.text else "(リノートもしくはメディア・投票のみのノート)"
|
|
|
|
|
|
2023-01-16 02:31:30 +01:00
|
|
|
|
let el = Ui:C:container({
|
|
|
|
|
bgColor: "#444"
|
|
|
|
|
fgColor: "#fff"
|
|
|
|
|
padding: 10
|
|
|
|
|
rounded: true
|
|
|
|
|
children: [
|
|
|
|
|
Ui:C:mfm({
|
2023-04-26 07:10:04 +02:00
|
|
|
|
text: userName
|
2023-01-16 02:31:30 +01:00
|
|
|
|
bold: true
|
|
|
|
|
})
|
|
|
|
|
Ui:C:mfm({
|
2023-04-26 07:10:04 +02:00
|
|
|
|
text: noteText
|
2023-01-16 02:31:30 +01:00
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
noteEls.push(el)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// UIを表示
|
|
|
|
|
Ui:render([
|
|
|
|
|
Ui:C:text({ text: "ローカル タイムライン" })
|
|
|
|
|
Ui:C:button({
|
|
|
|
|
text: "更新"
|
|
|
|
|
onClick: @() {
|
|
|
|
|
fetch()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
Ui:C:container({
|
|
|
|
|
children: noteEls
|
|
|
|
|
})
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fetch()
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
id?: string;
|
|
|
|
|
}>();
|
|
|
|
|
|
2023-12-26 06:19:35 +01:00
|
|
|
|
const flash = ref<Misskey.entities.Flash | null>(null);
|
2024-03-15 14:02:57 +01:00
|
|
|
|
const visibility = ref<'private' | 'public'>('public');
|
2023-01-16 02:31:30 +01:00
|
|
|
|
|
|
|
|
|
if (props.id) {
|
2024-01-04 10:32:46 +01:00
|
|
|
|
flash.value = await misskeyApi('flash/show', {
|
2023-01-16 02:31:30 +01:00
|
|
|
|
flashId: props.id,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
|
const title = ref(flash.value?.title ?? 'New Play');
|
|
|
|
|
const summary = ref(flash.value?.summary ?? '');
|
|
|
|
|
const permissions = ref(flash.value?.permissions ?? []);
|
|
|
|
|
const script = ref(flash.value?.script ?? PRESET_DEFAULT);
|
2023-01-16 02:31:30 +01:00
|
|
|
|
|
|
|
|
|
function selectPreset(ev: MouseEvent) {
|
|
|
|
|
os.popupMenu([{
|
|
|
|
|
text: 'Omikuji',
|
|
|
|
|
action: () => {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
script.value = PRESET_OMIKUJI;
|
2023-01-16 02:31:30 +01:00
|
|
|
|
},
|
2023-01-17 09:10:33 +01:00
|
|
|
|
}, {
|
|
|
|
|
text: 'Shuffle',
|
|
|
|
|
action: () => {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
script.value = PRESET_SHUFFLE;
|
2023-01-17 09:10:33 +01:00
|
|
|
|
},
|
2023-02-17 06:57:05 +01:00
|
|
|
|
}, {
|
|
|
|
|
text: 'Quiz',
|
|
|
|
|
action: () => {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
script.value = PRESET_QUIZ;
|
2023-02-17 06:57:05 +01:00
|
|
|
|
},
|
2023-01-16 02:31:30 +01:00
|
|
|
|
}, {
|
|
|
|
|
text: 'Timeline viewer',
|
|
|
|
|
action: () => {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
script.value = PRESET_TIMELINE;
|
2023-01-16 02:04:10 +01:00
|
|
|
|
},
|
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 05:59:48 +01:00
|
|
|
|
async function save() {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
if (flash.value) {
|
2023-01-05 05:59:48 +01:00
|
|
|
|
os.apiWithDialog('flash/update', {
|
|
|
|
|
flashId: props.id,
|
2023-12-07 06:42:09 +01:00
|
|
|
|
title: title.value,
|
|
|
|
|
summary: summary.value,
|
|
|
|
|
permissions: permissions.value,
|
|
|
|
|
script: script.value,
|
|
|
|
|
visibility: visibility.value,
|
2023-01-05 05:59:48 +01:00
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
const created = await os.apiWithDialog('flash/create', {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
title: title.value,
|
|
|
|
|
summary: summary.value,
|
|
|
|
|
permissions: permissions.value,
|
|
|
|
|
script: script.value,
|
2024-03-15 14:02:57 +01:00
|
|
|
|
visibility: visibility.value,
|
2023-01-05 05:59:48 +01:00
|
|
|
|
});
|
|
|
|
|
router.push('/play/' + created.id + '/edit');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function show() {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
if (flash.value == null) {
|
2023-01-05 05:59:48 +01:00
|
|
|
|
os.alert({
|
|
|
|
|
text: 'Please save',
|
|
|
|
|
});
|
|
|
|
|
} else {
|
2023-12-07 06:42:09 +01:00
|
|
|
|
os.pageWindow(`/play/${flash.value.id}`);
|
2023-01-05 05:59:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-17 05:40:27 +01:00
|
|
|
|
async function del() {
|
|
|
|
|
const { canceled } = await os.confirm({
|
|
|
|
|
type: 'warning',
|
2024-01-20 00:11:59 +01:00
|
|
|
|
text: i18n.tsx.deleteAreYouSure({ x: flash.value.title }),
|
2023-01-17 05:40:27 +01:00
|
|
|
|
});
|
|
|
|
|
if (canceled) return;
|
|
|
|
|
|
|
|
|
|
await os.apiWithDialog('flash/delete', {
|
|
|
|
|
flashId: props.id,
|
|
|
|
|
});
|
|
|
|
|
router.push('/play');
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
|
const headerActions = computed(() => []);
|
2023-01-05 05:59:48 +01:00
|
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
|
const headerTabs = computed(() => []);
|
2023-01-05 05:59:48 +01:00
|
|
|
|
|
2024-02-16 08:17:09 +01:00
|
|
|
|
definePageMetadata(() => ({
|
|
|
|
|
title: flash.value ? `${i18n.ts._play.edit}: ${flash.value.title}` : i18n.ts._play.new,
|
2023-01-05 05:59:48 +01:00
|
|
|
|
}));
|
|
|
|
|
</script>
|