iceshrimp/packages/client/src/pages/settings/migration.vue

79 lines
2.0 KiB
Vue
Raw Normal View History

<template>
2023-04-08 09:01:42 +09:00
<div class="_formRoot">
<FormSection>
<template #label>{{ i18n.ts.moveTo }}</template>
<FormInput v-model="moveToAccount" class="_formBlock">
<template #prefix
><i class="ph-airplane-takeoff ph-bold ph-lg"></i
></template>
<template #label>{{ i18n.ts.moveToLabel }}</template>
</FormInput>
<FormButton primary danger @click="move(moveToAccount)">
{{ i18n.ts.moveAccount }}
</FormButton>
<div class="description">{{ i18n.ts.moveAccountDescription }}</div>
</FormSection>
2023-04-08 09:01:42 +09:00
<FormSection>
<template #label>{{ i18n.ts.moveFrom }}</template>
<FormInput v-model="accountAlias" class="_formBlock">
<template #prefix
><i class="ph-airplane-landing ph-bold ph-lg"></i
></template>
<template #label>{{ i18n.ts.moveFromLabel }}</template>
</FormInput>
<FormButton
class="button"
inline
primary
@click="save(accountAlias.toString())"
>
<i class="ph-floppy-disk-back ph-bold ph-lg"></i>
{{ i18n.ts.save }}
</FormButton>
<div class="description">{{ i18n.ts.moveFromDescription }}</div>
</FormSection>
</div>
</template>
<script lang="ts" setup>
2023-04-08 09:01:42 +09:00
import FormSection from "@/components/form/section.vue";
import FormInput from "@/components/form/input.vue";
import FormButton from "@/components/MkButton.vue";
import * as os from "@/os";
import { i18n } from "@/i18n";
import { definePageMetadata } from "@/scripts/page-metadata";
2023-04-08 09:01:42 +09:00
let moveToAccount = $ref("");
let accountAlias = $ref("");
2022-12-12 10:33:45 +09:00
async function save(account): Promise<void> {
2023-04-08 09:01:42 +09:00
os.apiWithDialog("i/known-as", {
2022-12-12 10:33:45 +09:00
alsoKnownAs: account,
2022-12-12 09:42:40 +09:00
});
}
2022-12-12 10:33:45 +09:00
async function move(account): Promise<void> {
2022-12-12 10:28:11 +09:00
const confirm = await os.confirm({
2023-04-08 09:01:42 +09:00
type: "warning",
text: i18n.t("migrationConfirm", { account: account.toString() }),
2022-12-12 10:28:11 +09:00
});
if (confirm.canceled) return;
2023-04-08 09:01:42 +09:00
os.apiWithDialog("i/move", {
2022-12-12 10:33:45 +09:00
moveToAccount: account,
});
}
definePageMetadata({
title: i18n.ts.security,
2023-04-08 09:01:42 +09:00
icon: "ph-lock ph-bold ph-lg",
});
</script>
2022-12-12 11:00:39 +09:00
<style lang="scss">
.description {
2023-04-08 09:01:42 +09:00
font-size: 0.85em;
2022-12-12 11:00:39 +09:00
padding: 1rem;
}
</style>