1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 21:35:38 +02:00

refactor(frontend): anyを除去2 (#17092)

* wip

* fix types

* fix
This commit is contained in:
かっこかり
2026-01-14 14:45:45 +09:00
committed by GitHub
parent d8318c02a1
commit bd81a6c8ad
32 changed files with 164 additions and 93 deletions

View File

@@ -16,7 +16,7 @@ import { i18n } from '@/i18n.js';
import type { WidgetComponentProps, WidgetComponentEmits, WidgetComponentExpose } from './widget.js';
import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
const name = 'ai';
const name = 'aichan';
const widgetPropsDef = {
transparent: {

View File

@@ -93,12 +93,12 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
const menuOpened = ref(false);
const headerTitle = computed<string>(() => {
if (widgetProps.src === 'list' && widgetProps.list != null) {
return widgetProps.list.name;
} else if (widgetProps.src === 'antenna' && widgetProps.antenna != null) {
return widgetProps.antenna.name;
if (widgetProps.src === 'list') {
return widgetProps.list != null ? widgetProps.list.name : '?';
} else if (widgetProps.src === 'antenna') {
return widgetProps.antenna != null ? widgetProps.antenna.name : '?';
} else {
return (i18n.ts._timelines as any)[widgetProps.src] ?? '?';
return i18n.ts._timelines[widgetProps.src] ?? '?';
}
});

View File

@@ -36,7 +36,7 @@ import { misskeyApiGet } from '@/utility/misskey-api.js';
import { i18n } from '@/i18n.js';
import { prefer } from '@/preferences.js';
const name = 'hashtags';
const name = 'trends';
const widgetPropsDef = {
showHeader: {

View File

@@ -75,3 +75,5 @@ export const widgets = [
...federationWidgets,
] as const;
export type WidgetName = typeof widgets[number];

View File

@@ -10,6 +10,7 @@ import type { FormWithDefault, GetFormResultType } from '@/utility/form.js';
import { getDefaultFormValues } from '@/utility/form.js';
import * as os from '@/os.js';
import { deepClone } from '@/utility/clone.js';
import type { WidgetName } from './index.js';
export type Widget<P extends Record<string, unknown>> = {
id: string;
@@ -31,7 +32,7 @@ export type WidgetComponentExpose = {
};
export const useWidgetPropsManager = <F extends FormWithDefault>(
name: string,
name: WidgetName,
propsDef: F,
props: Readonly<WidgetComponentProps<GetFormResultType<F>>>,
emit: WidgetComponentEmits<GetFormResultType<F>>,