finish changes to chat color setting

This commit is contained in:
marlon-erler
2026-09-26 15:27:39 +02:00
parent 64e32a99aa
commit 82d69a48f0
5 changed files with 17 additions and 4 deletions
-1
View File
@@ -92,7 +92,6 @@ export default class ChatModel {
filePaths.chat.reactions(this.id),
);
};
readonly getReactionPath = (id: string): string[] => {
return [...this.getReactionDirPath(), id];
};
-1
View File
@@ -69,7 +69,6 @@ export default class FileModel {
readonly handleFileContent = (fileContent: FileContent<string>): void => {
if (fileContent.type == "chat-info") {
if (checkMatchesObjectStructure(fileContent, ChatInfoReference) == false) return;
console.log("CHANGING");
this.chatModel.handleInfo(fileContent as ChatInfoFileContent);
}
+2 -1
View File
@@ -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}
<span class="icon">check</span>
+6
View File
@@ -211,6 +211,8 @@ const englishTranslations = {
setEncryptionKeyButtonAudioLabel: "set encryption key",
showEncryptionKey: "Show encryption key",
setColorButtonAudioLabel: "set color",
deleteChatButton: "Delete entire chat",
},
@@ -549,6 +551,8 @@ export const allTranslations: {
setEncryptionKeyButtonAudioLabel: "Schlüssel festlegen",
showEncryptionKey: "Schlüssel anzeigen",
setColorButtonAudioLabel: "Farbe festlegen",
deleteChatButton: "Gesamten Chat löschen",
},
@@ -859,6 +863,8 @@ export const allTranslations: {
"establecer clave de encriptación",
showEncryptionKey: "Mostrar clave de encriptación",
setColorButtonAudioLabel: "establecer color",
deleteChatButton: "Eliminar todo el chat",
},
@@ -19,6 +19,7 @@ export default class SettingsPageViewModel extends Context {
);
color: React.State<Colors> = new React.State<any>(Colors.Standard);
appliedColor: React.State<Colors> = new React.State<any>(Colors.Standard);
// guards
cannotSetPrimaryChannel: React.State<boolean> = React.createProxyState(
@@ -27,6 +28,11 @@ export default class SettingsPageViewModel extends Context {
this.nameInput.value == "" ||
this.nameInput.value == this.name.value,
);
cannotSetColor: React.State<boolean> = React.createProxyState(
[this.color, this.appliedColor],
() =>
this.color.value == this.appliedColor.value,
);
cannotAddSecondaryChannel: React.State<boolean> = 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 => {