refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
This commit is contained in:
parent
e42c91dee7
commit
406b4bdbe7
277 changed files with 3353 additions and 3441 deletions
|
@ -90,22 +90,22 @@ const props = defineProps<{
|
|||
channelId?: string;
|
||||
}>();
|
||||
|
||||
let channel = $ref(null);
|
||||
let name = $ref(null);
|
||||
let description = $ref(null);
|
||||
let bannerUrl = $ref<string | null>(null);
|
||||
let bannerId = $ref<string | null>(null);
|
||||
let color = $ref('#000');
|
||||
let isSensitive = $ref(false);
|
||||
let allowRenoteToExternal = $ref(true);
|
||||
const channel = ref(null);
|
||||
const name = ref(null);
|
||||
const description = ref(null);
|
||||
const bannerUrl = ref<string | null>(null);
|
||||
const bannerId = ref<string | null>(null);
|
||||
const color = ref('#000');
|
||||
const isSensitive = ref(false);
|
||||
const allowRenoteToExternal = ref(true);
|
||||
const pinnedNotes = ref([]);
|
||||
|
||||
watch(() => bannerId, async () => {
|
||||
if (bannerId == null) {
|
||||
bannerUrl = null;
|
||||
watch(() => bannerId.value, async () => {
|
||||
if (bannerId.value == null) {
|
||||
bannerUrl.value = null;
|
||||
} else {
|
||||
bannerUrl = (await os.api('drive/files/show', {
|
||||
fileId: bannerId,
|
||||
bannerUrl.value = (await os.api('drive/files/show', {
|
||||
fileId: bannerId.value,
|
||||
})).url;
|
||||
}
|
||||
});
|
||||
|
@ -113,20 +113,20 @@ watch(() => bannerId, async () => {
|
|||
async function fetchChannel() {
|
||||
if (props.channelId == null) return;
|
||||
|
||||
channel = await os.api('channels/show', {
|
||||
channel.value = await os.api('channels/show', {
|
||||
channelId: props.channelId,
|
||||
});
|
||||
|
||||
name = channel.name;
|
||||
description = channel.description;
|
||||
bannerId = channel.bannerId;
|
||||
bannerUrl = channel.bannerUrl;
|
||||
isSensitive = channel.isSensitive;
|
||||
pinnedNotes.value = channel.pinnedNoteIds.map(id => ({
|
||||
name.value = channel.value.name;
|
||||
description.value = channel.value.description;
|
||||
bannerId.value = channel.value.bannerId;
|
||||
bannerUrl.value = channel.value.bannerUrl;
|
||||
isSensitive.value = channel.value.isSensitive;
|
||||
pinnedNotes.value = channel.value.pinnedNoteIds.map(id => ({
|
||||
id,
|
||||
}));
|
||||
color = channel.color;
|
||||
allowRenoteToExternal = channel.allowRenoteToExternal;
|
||||
color.value = channel.value.color;
|
||||
allowRenoteToExternal.value = channel.value.allowRenoteToExternal;
|
||||
}
|
||||
|
||||
fetchChannel();
|
||||
|
@ -150,13 +150,13 @@ function removePinnedNote(index: number) {
|
|||
|
||||
function save() {
|
||||
const params = {
|
||||
name: name,
|
||||
description: description,
|
||||
bannerId: bannerId,
|
||||
name: name.value,
|
||||
description: description.value,
|
||||
bannerId: bannerId.value,
|
||||
pinnedNoteIds: pinnedNotes.value.map(x => x.id),
|
||||
color: color,
|
||||
isSensitive: isSensitive,
|
||||
allowRenoteToExternal: allowRenoteToExternal,
|
||||
color: color.value,
|
||||
isSensitive: isSensitive.value,
|
||||
allowRenoteToExternal: allowRenoteToExternal.value,
|
||||
};
|
||||
|
||||
if (props.channelId) {
|
||||
|
@ -172,7 +172,7 @@ function save() {
|
|||
async function archive() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
title: i18n.t('channelArchiveConfirmTitle', { name: name }),
|
||||
title: i18n.t('channelArchiveConfirmTitle', { name: name.value }),
|
||||
text: i18n.ts.channelArchiveConfirmDescription,
|
||||
});
|
||||
|
||||
|
@ -188,17 +188,17 @@ async function archive() {
|
|||
|
||||
function setBannerImage(evt) {
|
||||
selectFile(evt.currentTarget ?? evt.target, null).then(file => {
|
||||
bannerId = file.id;
|
||||
bannerId.value = file.id;
|
||||
});
|
||||
}
|
||||
|
||||
function removeBannerImage() {
|
||||
bannerId = null;
|
||||
bannerId.value = null;
|
||||
}
|
||||
|
||||
const headerActions = $computed(() => []);
|
||||
const headerActions = computed(() => []);
|
||||
|
||||
const headerTabs = $computed(() => []);
|
||||
const headerTabs = computed(() => []);
|
||||
|
||||
definePageMetadata(computed(() => props.channelId ? {
|
||||
title: i18n.ts._channel.edit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue