mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 21:35:38 +02:00
@@ -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: {
|
||||
|
||||
@@ -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] ?? '?';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -75,3 +75,5 @@ export const widgets = [
|
||||
|
||||
...federationWidgets,
|
||||
] as const;
|
||||
|
||||
export type WidgetName = typeof widgets[number];
|
||||
|
||||
@@ -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>>,
|
||||
|
||||
Reference in New Issue
Block a user