add button to remove chat
This commit is contained in:
@@ -135,6 +135,13 @@ export function SettingsPage(chatViewModel: ChatViewModel) {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<hr></hr>
|
||||
|
||||
<button class="danger width-input flex-no" on:click={chatViewModel.remove}>
|
||||
{translations.chatPage.settings.deleteChatButton}
|
||||
<span class="icon">delete_forever</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -95,6 +95,8 @@ const englishTranslations = {
|
||||
encryptionKeyLabel: "Encryption key",
|
||||
setEncryptionKeyButtonAudioLabel: "set encryption key",
|
||||
showEncryptionKey: "Show encryption key",
|
||||
|
||||
deleteChatButton: "Delete entire chat",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -63,6 +63,7 @@ export default class ChatListViewModel {
|
||||
|
||||
// restore
|
||||
restoreChats = (): void => {
|
||||
this.chatViewModels.clear();
|
||||
for (const chatModel of this.chatListModel.chatModels.values()) {
|
||||
const chatViewModel = this.createChatViewModel(chatModel);
|
||||
this.chatViewModels.add(chatViewModel);
|
||||
|
||||
@@ -96,6 +96,12 @@ export default class ChatViewModel {
|
||||
this.chatModel.setColor(newColor);
|
||||
};
|
||||
|
||||
remove = (): void => {
|
||||
this.close();
|
||||
this.chatModel.delete();
|
||||
this.chatListViewModel.restoreChats();
|
||||
}
|
||||
|
||||
// restore
|
||||
restorePageSelection = (): void => {
|
||||
const path: string[] = storageKeys.chatLastUsedPage(this.chatModel.id);
|
||||
|
||||
Reference in New Issue
Block a user