summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 09:39:23 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 09:39:23 +0900
commitdbb6c71c5c7098c33824b6070b6526416d3bdd69 (patch)
tree56a647059e9f18b62d71a4a774ac66be347e194e
parentrefactor (diff)
downloadmisskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.tar.gz
misskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.tar.bz2
misskey-dbb6c71c5c7098c33824b6070b6526416d3bdd69.zip
refactor
-rw-r--r--packages/frontend/src/pages/channel-editor.vue37
-rw-r--r--packages/frontend/src/pages/gallery/edit.vue6
-rw-r--r--packages/frontend/src/pages/registry.vue2
-rw-r--r--packages/frontend/src/pages/settings/privacy.vue28
-rw-r--r--packages/frontend/src/pages/tag.vue2
-rw-r--r--packages/frontend/src/utility/chart-vline.ts5
-rw-r--r--packages/frontend/src/utility/popout.ts4
-rw-r--r--packages/frontend/src/utility/sticky-sidebar.ts2
8 files changed, 51 insertions, 35 deletions
diff --git a/packages/frontend/src/pages/channel-editor.vue b/packages/frontend/src/pages/channel-editor.vue
index 80dfb8e84e..ce26a26109 100644
--- a/packages/frontend/src/pages/channel-editor.vue
+++ b/packages/frontend/src/pages/channel-editor.vue
@@ -92,7 +92,7 @@ const props = defineProps<{
}>();
const channel = ref<Misskey.entities.Channel | null>(null);
-const name = ref<string | null>(null);
+const name = ref<string>('');
const description = ref<string | null>(null);
const bannerUrl = ref<string | null>(null);
const bannerId = ref<string | null>(null);
@@ -114,20 +114,22 @@ watch(() => bannerId.value, async () => {
async function fetchChannel() {
if (props.channelId == null) return;
- channel.value = await misskeyApi('channels/show', {
+ const result = await misskeyApi('channels/show', {
channelId: props.channelId,
});
- 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 => ({
+ name.value = result.name;
+ description.value = result.description;
+ bannerId.value = result.bannerId;
+ bannerUrl.value = result.bannerUrl;
+ isSensitive.value = result.isSensitive;
+ pinnedNotes.value = result.pinnedNoteIds.map(id => ({
id,
}));
- color.value = channel.value.color;
- allowRenoteToExternal.value = channel.value.allowRenoteToExternal;
+ color.value = result.color;
+ allowRenoteToExternal.value = result.allowRenoteToExternal;
+
+ channel.value = result;
}
fetchChannel();
@@ -154,15 +156,17 @@ function save() {
name: name.value,
description: description.value,
bannerId: bannerId.value,
- pinnedNoteIds: pinnedNotes.value.map(x => x.id),
color: color.value,
isSensitive: isSensitive.value,
allowRenoteToExternal: allowRenoteToExternal.value,
- };
+ } satisfies Misskey.entities.ChannelsCreateRequest;
- if (props.channelId) {
- params.channelId = props.channelId;
- os.apiWithDialog('channels/update', params);
+ if (props.channelId != null) {
+ os.apiWithDialog('channels/update', {
+ ...params,
+ channelId: props.channelId,
+ pinnedNoteIds: pinnedNotes.value.map(x => x.id),
+ });
} else {
os.apiWithDialog('channels/create', params).then(created => {
router.push('/channels/:channelId', {
@@ -175,12 +179,13 @@ function save() {
}
async function archive() {
+ if (props.channelId == null) return;
+
const { canceled } = await os.confirm({
type: 'warning',
title: i18n.tsx.channelArchiveConfirmTitle({ name: name.value }),
text: i18n.ts.channelArchiveConfirmDescription,
});
-
if (canceled) return;
misskeyApi('channels/update', {
diff --git a/packages/frontend/src/pages/gallery/edit.vue b/packages/frontend/src/pages/gallery/edit.vue
index cf0d700962..3fd462e0b9 100644
--- a/packages/frontend/src/pages/gallery/edit.vue
+++ b/packages/frontend/src/pages/gallery/edit.vue
@@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkTextarea>
<div class="_gaps_s">
- <div v-for="file in files" :key="file.id" class="wqugxsfx" :style="{ backgroundImage: file ? `url(${ file.thumbnailUrl })` : null }">
+ <div v-for="file in files" :key="file.id" class="wqugxsfx" :style="{ backgroundImage: file ? `url(${ file.thumbnailUrl })` : '' }">
<div class="name">{{ file.name }}</div>
<button v-tooltip="i18n.ts.remove" class="remove _button" @click="remove(file)"><i class="ti ti-x"></i></button>
</div>
@@ -88,7 +88,7 @@ async function save() {
router.push('/gallery/:postId', {
params: {
postId: props.postId,
- }
+ },
});
} else {
const created = await os.apiWithDialog('gallery/posts/create', {
@@ -100,7 +100,7 @@ async function save() {
router.push('/gallery/:postId', {
params: {
postId: created.id,
- }
+ },
});
}
}
diff --git a/packages/frontend/src/pages/registry.vue b/packages/frontend/src/pages/registry.vue
index 3762dadd12..389438242e 100644
--- a/packages/frontend/src/pages/registry.vue
+++ b/packages/frontend/src/pages/registry.vue
@@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton primary @click="createKey">{{ i18n.ts._registry.createKey }}</MkButton>
<div v-if="scopesWithDomain" class="_gaps_m">
- <FormSection v-for="domain in scopesWithDomain" :key="domain.domain">
+ <FormSection v-for="domain in scopesWithDomain" :key="domain.domain ?? 'system'">
<template #label>{{ domain.domain ? domain.domain.toUpperCase() : i18n.ts.system }}</template>
<div class="_gaps_s">
<FormLink v-for="scope in domain.scopes" :to="`/registry/keys/${domain.domain ?? '@'}/${scope.join('/')}`" class="_monospace">{{ scope.length === 0 ? '(root)' : scope.join('/') }}</FormLink>
diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue
index ab012841dc..54a6c0af82 100644
--- a/packages/frontend/src/pages/settings/privacy.vue
+++ b/packages/frontend/src/pages/settings/privacy.vue
@@ -160,10 +160,18 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label><SearchLabel>{{ i18n.ts._accountSettings.makeNotesHiddenBefore }}</SearchLabel></template>
<div class="_gaps_s">
- <MkSelect :modelValue="makeNotesHiddenBefore_type" @update:modelValue="makeNotesHiddenBefore = $event === 'relative' ? -604800 : $event === 'absolute' ? Math.floor(Date.now() / 1000) : null">
- <option :value="null">{{ i18n.ts.none }}</option>
- <option value="relative">{{ i18n.ts._accountSettings.notesHavePassedSpecifiedPeriod }}</option>
- <option value="absolute">{{ i18n.ts._accountSettings.notesOlderThanSpecifiedDateAndTime }}</option>
+ <MkSelect
+ :items="[{
+ value: null,
+ label: i18n.ts.none
+ }, {
+ value: 'relative',
+ label: i18n.ts._accountSettings.notesHavePassedSpecifiedPeriod
+ }, {
+ value: 'absolute',
+ label: i18n.ts._accountSettings.notesOlderThanSpecifiedDateAndTime
+ }] as const" :modelValue="makeNotesHiddenBefore_type" @update:modelValue="makeNotesHiddenBefore = $event === 'relative' ? -604800 : $event === 'absolute' ? Math.floor(Date.now() / 1000) : null"
+ >
</MkSelect>
<MkSelect v-if="makeNotesHiddenBefore_type === 'relative'" v-model="makeNotesHiddenBefore_selection">
@@ -262,7 +270,7 @@ const makeNotesFollowersOnlyBefore_presets = [
const makeNotesFollowersOnlyBefore_isCustomMode = ref(
makeNotesFollowersOnlyBefore.value != null &&
makeNotesFollowersOnlyBefore.value < 0 &&
- !makeNotesFollowersOnlyBefore_presets.some((preset) => preset.value === makeNotesFollowersOnlyBefore.value)
+ !makeNotesFollowersOnlyBefore_presets.some((preset) => preset.value === makeNotesFollowersOnlyBefore.value),
);
const makeNotesFollowersOnlyBefore_selection = computed({
@@ -270,14 +278,14 @@ const makeNotesFollowersOnlyBefore_selection = computed({
set(value) {
makeNotesFollowersOnlyBefore_isCustomMode.value = value === 'custom';
if (value !== 'custom') makeNotesFollowersOnlyBefore.value = value;
- }
+ },
});
const makeNotesFollowersOnlyBefore_customMonths = computed({
get: () => makeNotesFollowersOnlyBefore.value ? Math.abs(makeNotesFollowersOnlyBefore.value) / (30 * 24 * 60 * 60) : null,
set(value) {
if (value != null && value > 0) makeNotesFollowersOnlyBefore.value = -Math.abs(Math.floor(Number(value))) * 30 * 24 * 60 * 60;
- }
+ },
});
const makeNotesHiddenBefore_type = computed(() => {
@@ -303,7 +311,7 @@ const makeNotesHiddenBefore_presets = [
const makeNotesHiddenBefore_isCustomMode = ref(
makeNotesHiddenBefore.value != null &&
makeNotesHiddenBefore.value < 0 &&
- !makeNotesHiddenBefore_presets.some((preset) => preset.value === makeNotesHiddenBefore.value)
+ !makeNotesHiddenBefore_presets.some((preset) => preset.value === makeNotesHiddenBefore.value),
);
const makeNotesHiddenBefore_selection = computed({
@@ -311,14 +319,14 @@ const makeNotesHiddenBefore_selection = computed({
set(value) {
makeNotesHiddenBefore_isCustomMode.value = value === 'custom';
if (value !== 'custom') makeNotesHiddenBefore.value = value;
- }
+ },
});
const makeNotesHiddenBefore_customMonths = computed({
get: () => makeNotesHiddenBefore.value ? Math.abs(makeNotesHiddenBefore.value) / (30 * 24 * 60 * 60) : null,
set(value) {
if (value != null && value > 0) makeNotesHiddenBefore.value = -Math.abs(Math.floor(Number(value))) * 30 * 24 * 60 * 60;
- }
+ },
});
watch([makeNotesFollowersOnlyBefore, makeNotesHiddenBefore], () => {
diff --git a/packages/frontend/src/pages/tag.vue b/packages/frontend/src/pages/tag.vue
index b5a4503b68..047e68f583 100644
--- a/packages/frontend/src/pages/tag.vue
+++ b/packages/frontend/src/pages/tag.vue
@@ -52,7 +52,7 @@ async function post() {
const headerActions = computed(() => [{
icon: 'ti ti-dots',
- label: i18n.ts.more,
+ text: i18n.ts.more,
handler: (ev: MouseEvent) => {
os.popupMenu([{
text: i18n.ts.embed,
diff --git a/packages/frontend/src/utility/chart-vline.ts b/packages/frontend/src/utility/chart-vline.ts
index 465ca591c6..2fe4bdb83b 100644
--- a/packages/frontend/src/utility/chart-vline.ts
+++ b/packages/frontend/src/utility/chart-vline.ts
@@ -8,9 +8,10 @@ import type { Plugin } from 'chart.js';
export const chartVLine = (vLineColor: string) => ({
id: 'vLine',
beforeDraw(chart, args, options) {
- if (chart.tooltip?._active?.length) {
+ const tooltip = chart.tooltip as any;
+ if (tooltip?._active?.length) {
const ctx = chart.ctx;
- const xs = chart.tooltip._active.map(a => a.element.x);
+ const xs = tooltip._active.map(a => a.element.x);
const x = xs.reduce((a, b) => a + b, 0) / xs.length;
const topY = chart.scales.y.top;
const bottomY = chart.scales.y.bottom;
diff --git a/packages/frontend/src/utility/popout.ts b/packages/frontend/src/utility/popout.ts
index 5b141222e8..7e0222c459 100644
--- a/packages/frontend/src/utility/popout.ts
+++ b/packages/frontend/src/utility/popout.ts
@@ -20,8 +20,8 @@ export function popout(path: string, w?: HTMLElement) {
} else {
const width = 400;
const height = 500;
- const x = window.top.outerHeight / 2 + window.top.screenY - (height / 2);
- const y = window.top.outerWidth / 2 + window.top.screenX - (width / 2);
+ const x = window.top == null ? 0 : window.top.outerHeight / 2 + window.top.screenY - (height / 2);
+ const y = window.top == null ? 0 : window.top.outerWidth / 2 + window.top.screenX - (width / 2);
window.open(url, url,
`width=${width}, height=${height}, top=${x}, left=${y}`);
}
diff --git a/packages/frontend/src/utility/sticky-sidebar.ts b/packages/frontend/src/utility/sticky-sidebar.ts
index 867c9b8324..435555896f 100644
--- a/packages/frontend/src/utility/sticky-sidebar.ts
+++ b/packages/frontend/src/utility/sticky-sidebar.ts
@@ -3,6 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+/*
export class StickySidebar {
private lastScrollTop = 0;
private container: HTMLElement;
@@ -53,3 +54,4 @@ export class StickySidebar {
this.lastScrollTop = scrollTop <= 0 ? 0 : scrollTop;
}
}
+*/