-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathGeneralSettingsModule.ts
More file actions
51 lines (46 loc) · 1.46 KB
/
GeneralSettingsModule.ts
File metadata and controls
51 lines (46 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// src/controls/modules/GeneralSettingsModule.ts
// FULL FILE
import { type ControlModule } from "@/types/litechat/control";
import { type LiteChatModApi } from "@/types/litechat/modding";
import { SettingsGeneral } from "@/controls/components/general-settings/SettingsGeneral";
import i18next from 'i18next';
import type { ControlModuleConstructor } from '@/types/litechat/control';
export class GeneralSettingsModule implements ControlModule {
readonly id = "core-settings-general";
private unregisterCallback: (() => void) | null = null;
async initialize(_modApi: LiteChatModApi): Promise<void> {
// console.log(`[${this.id}] Initialized.`);
}
register(modApi: LiteChatModApi): void {
if (this.unregisterCallback) {
console.warn(`[${this.id}] Already registered. Skipping.`);
return;
}
this.unregisterCallback = modApi.registerSettingsTab({
id: "general",
title: i18next.t("controls:settings.tabs.general"),
component: SettingsGeneral,
order: 10,
});
// console.log(`[${this.id}] Settings tab registered.`);
}
destroy(): void {
if (this.unregisterCallback) {
this.unregisterCallback();
this.unregisterCallback = null;
}
console.log(`[${this.id}] Destroyed.`);
}
}
(GeneralSettingsModule as ControlModuleConstructor).translations = {
en: {
controls: {
"settings.tabs.general": "General"
}
},
fr: {
controls: {
"settings.tabs.general": "Général"
}
}
};