widgetにゲーミングのオンオフを追加

This commit is contained in:
mattyatea 2023-09-25 02:56:53 +09:00
parent 235df532ef
commit 8154d86a9d
3 changed files with 48 additions and 0 deletions

3
locales/index.d.ts vendored
View File

@ -828,6 +828,8 @@ export interface Locale {
"high": string;
"middle": string;
"low": string;
"GamingSpeedChange": string;
"GamingSpeedChangeInfo": string;
"emailNotConfiguredWarning": string;
"ratio": string;
"previewNoteText": string;
@ -1946,6 +1948,7 @@ export interface Locale {
"instanceInfo": string;
"memo": string;
"notifications": string;
"gamingMode": string;
"timeline": string;
"calendar": string;
"trends": string;

View File

@ -0,0 +1,43 @@
<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div>
<MkSwitch v-model="enableGamingMode">{{ i18n.ts.gamingMode }} <template #caption>{{ i18n.ts.gamingModeInfo }} </template></MkSwitch>
</div>
</template>
<script lang="ts" setup>
import { Interpreter, Parser } from '@syuilo/aiscript';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import { GetFormResultType } from '@/scripts/form.js';
import MkButton from '@/components/MkButton.vue';
import {i18n} from "@/i18n.js";
import MkSwitch from "@/components/MkSwitch.vue";
import {computed} from "vue";
import {defaultStore} from "@/store.js";
const enableGamingMode = computed(defaultStore.makeGetterSetter('gamingMode'));
const name = 'gamingMode';
const widgetPropsDef = {
};
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
const props = defineProps<WidgetComponentProps<WidgetProps>>();
const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const { widgetProps, configure } = useWidgetPropsManager(name,
widgetPropsDef,
props,
emit,
);
defineExpose<WidgetComponentExpose>({
name,
configure,
id: props.widget ? props.widget.id : null,
});
</script>

View File

@ -10,6 +10,7 @@ export default function(app: App) {
app.component('WidgetInstanceInfo', defineAsyncComponent(() => import('./WidgetInstanceInfo.vue')));
app.component('WidgetMemo', defineAsyncComponent(() => import('./WidgetMemo.vue')));
app.component('WidgetNotifications', defineAsyncComponent(() => import('./WidgetNotifications.vue')));
app.component('WidgetGamingMode', defineAsyncComponent(() => import('./WidgetGamingMode.vue')));
app.component('WidgetTimeline', defineAsyncComponent(() => import('./WidgetTimeline.vue')));
app.component('WidgetCalendar', defineAsyncComponent(() => import('./WidgetCalendar.vue')));
app.component('WidgetRss', defineAsyncComponent(() => import('./WidgetRss.vue')));
@ -40,6 +41,7 @@ export const widgets = [
'instanceInfo',
'memo',
'notifications',
'gamingMode',
'timeline',
'calendar',
'rss',