This commit is contained in:
marlon-erler
2024-07-23 13:48:17 +02:00
parent 0874ed956a
commit a06e4498b9
5 changed files with 33 additions and 11 deletions
+13 -5
View File
@@ -1352,8 +1352,7 @@
); );
this.encryptionKeyInput.callSubscriptions(); this.encryptionKeyInput.callSubscriptions();
}; };
setColor = (newColor) => { applyColor = (newColor) => {
this.color.value = newColor;
this.chatViewModel.setColor(newColor); this.chatViewModel.setColor(newColor);
}; };
remove = () => { remove = () => {
@@ -1386,7 +1385,7 @@
() => this.encryptionKeyInput.value == this.chatViewModel.chatModel.info.encryptionKey () => this.encryptionKeyInput.value == this.chatViewModel.chatModel.info.encryptionKey
); );
this.color.subscribe((newColor) => { this.color.subscribe((newColor) => {
this.setColor(newColor); this.applyColor(newColor);
}); });
} }
}; };
@@ -1423,6 +1422,9 @@
); );
this.taskPageViewModel.updateBoard(newBoardInfoFileContent); this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
}; };
applyColor = (newColor) => {
this.taskPageViewModel.chatViewModel.setDisplayedColor(newColor);
};
// load // load
loadListRelevantData = () => { loadListRelevantData = () => {
this.name.value = this.boardInfo.name; this.name.value = this.boardInfo.name;
@@ -1439,6 +1441,9 @@
[this.taskPageViewModel.selectedBoard], [this.taskPageViewModel.selectedBoard],
() => this.taskPageViewModel.selectedBoard.value == this () => this.taskPageViewModel.selectedBoard.value == this
); );
this.color.subscribeSilent((newColor) => {
this.applyColor(newColor);
});
} }
}; };
@@ -1534,9 +1539,12 @@
this.taskPageViewModel.closeBoard(); this.taskPageViewModel.closeBoard();
}; };
setColor = (color) => { setColor = (color) => {
this.displayedColor.value = color; this.setDisplayedColor(color);
this.chatModel.setColor(color); this.chatModel.setColor(color);
}; };
setDisplayedColor = (color) => {
this.displayedColor.value = color;
};
resetColor = () => { resetColor = () => {
this.displayedColor.value = this.settingsPageViewModel.color.value; this.displayedColor.value = this.settingsPageViewModel.color.value;
}; };
@@ -2049,7 +2057,7 @@
"on:enter": boardViewModel.saveSettings, "on:enter": boardViewModel.saveSettings,
"bind:value": boardViewModel.name "bind:value": boardViewModel.name
} }
)))), /* @__PURE__ */ createElement("button", { "on:click": boardViewModel.hideSettings }, translations.general.closeButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "close")))); ))), ColorPicker(boardViewModel.color)), /* @__PURE__ */ createElement("button", { "on:click": boardViewModel.hideSettings }, translations.general.closeButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "close"))));
} }
// src/View/ChatPages/boardPage.tsx // src/View/ChatPages/boardPage.tsx
+3
View File
@@ -1,6 +1,7 @@
import * as React from "bloatless-react"; import * as React from "bloatless-react";
import BoardViewModel from "../../ViewModel/Pages/boardViewModel"; import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
import { ColorPicker } from "../Components/colorPicker";
import { translations } from "../translations"; import { translations } from "../translations";
export function BoardSettingsModal(boardViewModel: BoardViewModel) { export function BoardSettingsModal(boardViewModel: BoardViewModel) {
@@ -20,6 +21,8 @@ export function BoardSettingsModal(boardViewModel: BoardViewModel) {
></input> ></input>
</div> </div>
</label> </label>
{ColorPicker(boardViewModel.color)}
</main> </main>
<button on:click={boardViewModel.hideSettings}> <button on:click={boardViewModel.hideSettings}>
{translations.general.closeButton} {translations.general.closeButton}
+7 -3
View File
@@ -39,12 +39,16 @@ export default class ChatViewModel {
closeSubPages = (): void => { closeSubPages = (): void => {
this.taskPageViewModel.closeBoard(); this.taskPageViewModel.closeBoard();
} };
setColor = (color: Color): void => { setColor = (color: Color): void => {
this.displayedColor.value = color; this.setDisplayedColor(color);
this.chatModel.setColor(color); this.chatModel.setColor(color);
} };
setDisplayedColor = (color: Color): void => {
this.displayedColor.value = color;
};
resetColor = (): void => { resetColor = (): void => {
this.displayedColor.value = this.settingsPageViewModel.color.value; this.displayedColor.value = this.settingsPageViewModel.color.value;
+8
View File
@@ -46,6 +46,10 @@ export default class BoardViewModel {
this.taskPageViewModel.updateBoard(newBoardInfoFileContent); this.taskPageViewModel.updateBoard(newBoardInfoFileContent);
}; };
applyColor = (newColor: Color): void => {
this.taskPageViewModel.chatViewModel.setDisplayedColor(newColor);
};
// load // load
loadListRelevantData = (): void => { loadListRelevantData = (): void => {
this.name.value = this.boardInfo.name; this.name.value = this.boardInfo.name;
@@ -68,5 +72,9 @@ export default class BoardViewModel {
[this.taskPageViewModel.selectedBoard], [this.taskPageViewModel.selectedBoard],
() => this.taskPageViewModel.selectedBoard.value == this () => this.taskPageViewModel.selectedBoard.value == this
); );
this.color.subscribeSilent((newColor) => {
this.applyColor(newColor);
});
} }
} }
+2 -3
View File
@@ -71,8 +71,7 @@ export default class SettingsPageViewModel {
this.encryptionKeyInput.callSubscriptions(); this.encryptionKeyInput.callSubscriptions();
}; };
setColor = (newColor: Color): void => { applyColor = (newColor: Color): void => {
this.color.value = newColor;
this.chatViewModel.setColor(newColor); this.chatViewModel.setColor(newColor);
}; };
@@ -121,7 +120,7 @@ export default class SettingsPageViewModel {
); );
this.color.subscribe((newColor) => { this.color.subscribe((newColor) => {
this.setColor(newColor); this.applyColor(newColor);
}); });
} }
} }