add button to remove chat
This commit is contained in:
Vendored
+9
-2
@@ -665,6 +665,11 @@
|
||||
this.color.value = newColor;
|
||||
this.chatModel.setColor(newColor);
|
||||
};
|
||||
remove = () => {
|
||||
this.close();
|
||||
this.chatModel.delete();
|
||||
this.chatListViewModel.restoreChats();
|
||||
};
|
||||
// restore
|
||||
restorePageSelection = () => {
|
||||
const path = storageKeys.chatLastUsedPage(this.chatModel.id);
|
||||
@@ -748,6 +753,7 @@
|
||||
};
|
||||
// restore
|
||||
restoreChats = () => {
|
||||
this.chatViewModels.clear();
|
||||
for (const chatModel of this.chatListModel.chatModels.values()) {
|
||||
const chatViewModel = this.createChatViewModel(chatModel);
|
||||
this.chatViewModels.add(chatViewModel);
|
||||
@@ -859,7 +865,8 @@
|
||||
addSecondaryChannelButtonAudioLabel: "add secondary channel",
|
||||
encryptionKeyLabel: "Encryption key",
|
||||
setEncryptionKeyButtonAudioLabel: "set encryption key",
|
||||
showEncryptionKey: "Show encryption key"
|
||||
showEncryptionKey: "Show encryption key",
|
||||
deleteChatButton: "Delete entire chat"
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -971,7 +978,7 @@
|
||||
"on:click": setColor
|
||||
}
|
||||
);
|
||||
}))));
|
||||
})), /* @__PURE__ */ createElement("hr", null), /* @__PURE__ */ createElement("button", { class: "danger width-input flex-no", "on:click": chatViewModel.remove }, translations.chatPage.settings.deleteChatButton, /* @__PURE__ */ createElement("span", { class: "icon" }, "delete_forever"))));
|
||||
}
|
||||
|
||||
// src/View/chatPage.tsx
|
||||
|
||||
Vendored
+4
@@ -798,6 +798,10 @@ header button {
|
||||
max-height: 100% !important;
|
||||
}
|
||||
|
||||
button:not(.tile):not(header *),
|
||||
footer,
|
||||
input:not([type="checkbox"]):not([type="radio"]),
|
||||
select,
|
||||
.modal > div > :is(button, div.flex-row) {
|
||||
min-height: var(--control-height);
|
||||
}
|
||||
|
||||
@@ -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