diff --git a/src/Model/Chat/chatModel.ts b/src/Model/Chat/chatModel.ts index 4b2ea0bd..bceda67c 100644 --- a/src/Model/Chat/chatModel.ts +++ b/src/Model/Chat/chatModel.ts @@ -92,7 +92,6 @@ export default class ChatModel { filePaths.chat.reactions(this.id), ); }; - readonly getReactionPath = (id: string): string[] => { return [...this.getReactionDirPath(), id]; }; diff --git a/src/Model/Files/fileModel.ts b/src/Model/Files/fileModel.ts index fd41a47f..05685df5 100644 --- a/src/Model/Files/fileModel.ts +++ b/src/Model/Files/fileModel.ts @@ -69,7 +69,6 @@ export default class FileModel { readonly handleFileContent = (fileContent: FileContent): void => { if (fileContent.type == "chat-info") { if (checkMatchesObjectStructure(fileContent, ChatInfoReference) == false) return; - console.log("CHANGING"); this.chatModel.handleInfo(fileContent as ChatInfoFileContent); } diff --git a/src/View/ChatPages/settingsPage.tsx b/src/View/ChatPages/settingsPage.tsx index 96dd2e36..f378ef88 100644 --- a/src/View/ChatPages/settingsPage.tsx +++ b/src/View/ChatPages/settingsPage.tsx @@ -184,11 +184,12 @@ export function SettingsPage( class="width-50" aria-label={ coreViewModel.translations.chatPage.settings - .setNameButtonAudioLabel + .setColorButtonAudioLabel } on:click={ settingsPageViewModel.applyColor - } + } + toggle:disabled={settingsPageViewModel.cannotSetColor} > {coreViewModel.translations.general.setButton} check diff --git a/src/View/translations.ts b/src/View/translations.ts index fada0815..fd6f579f 100644 --- a/src/View/translations.ts +++ b/src/View/translations.ts @@ -211,6 +211,8 @@ const englishTranslations = { setEncryptionKeyButtonAudioLabel: "set encryption key", showEncryptionKey: "Show encryption key", + setColorButtonAudioLabel: "set color", + deleteChatButton: "Delete entire chat", }, @@ -548,6 +550,8 @@ export const allTranslations: { encryptionKeyLabel: "Schlüssel", setEncryptionKeyButtonAudioLabel: "Schlüssel festlegen", showEncryptionKey: "Schlüssel anzeigen", + + setColorButtonAudioLabel: "Farbe festlegen", deleteChatButton: "Gesamten Chat löschen", }, @@ -858,6 +862,8 @@ export const allTranslations: { setEncryptionKeyButtonAudioLabel: "establecer clave de encriptación", showEncryptionKey: "Mostrar clave de encriptación", + + setColorButtonAudioLabel: "establecer color", deleteChatButton: "Eliminar todo el chat", }, diff --git a/src/ViewModel/Pages/settingsPageViewModel.ts b/src/ViewModel/Pages/settingsPageViewModel.ts index 61968c63..c93d2d32 100644 --- a/src/ViewModel/Pages/settingsPageViewModel.ts +++ b/src/ViewModel/Pages/settingsPageViewModel.ts @@ -19,6 +19,7 @@ export default class SettingsPageViewModel extends Context { ); color: React.State = new React.State(Colors.Standard); + appliedColor: React.State = new React.State(Colors.Standard); // guards cannotSetPrimaryChannel: React.State = React.createProxyState( @@ -27,6 +28,11 @@ export default class SettingsPageViewModel extends Context { this.nameInput.value == "" || this.nameInput.value == this.name.value, ); + cannotSetColor: React.State = React.createProxyState( + [this.color, this.appliedColor], + () => + this.color.value == this.appliedColor.value, + ); cannotAddSecondaryChannel: React.State = React.createProxyState( [this.newSecondaryChannelInput], () => this.newSecondaryChannelInput.value == "", @@ -73,6 +79,7 @@ export default class SettingsPageViewModel extends Context { applyColor = (): void => { this.chatViewModel.setColor(this.color.value); + this.appliedColor.value = this.color.value; }; remove = (): void => { @@ -87,6 +94,7 @@ export default class SettingsPageViewModel extends Context { this.chatViewModel.chatModel.info.name; this.color.value = this.chatViewModel.chatModel.color; + this.appliedColor.value = this.color.value; }; updateData = (): void => {