add button to remove chat
This commit is contained in:
Vendored
+9
-2
@@ -665,6 +665,11 @@
|
|||||||
this.color.value = newColor;
|
this.color.value = newColor;
|
||||||
this.chatModel.setColor(newColor);
|
this.chatModel.setColor(newColor);
|
||||||
};
|
};
|
||||||
|
remove = () => {
|
||||||
|
this.close();
|
||||||
|
this.chatModel.delete();
|
||||||
|
this.chatListViewModel.restoreChats();
|
||||||
|
};
|
||||||
// restore
|
// restore
|
||||||
restorePageSelection = () => {
|
restorePageSelection = () => {
|
||||||
const path = storageKeys.chatLastUsedPage(this.chatModel.id);
|
const path = storageKeys.chatLastUsedPage(this.chatModel.id);
|
||||||
@@ -748,6 +753,7 @@
|
|||||||
};
|
};
|
||||||
// restore
|
// restore
|
||||||
restoreChats = () => {
|
restoreChats = () => {
|
||||||
|
this.chatViewModels.clear();
|
||||||
for (const chatModel of this.chatListModel.chatModels.values()) {
|
for (const chatModel of this.chatListModel.chatModels.values()) {
|
||||||
const chatViewModel = this.createChatViewModel(chatModel);
|
const chatViewModel = this.createChatViewModel(chatModel);
|
||||||
this.chatViewModels.add(chatViewModel);
|
this.chatViewModels.add(chatViewModel);
|
||||||
@@ -859,7 +865,8 @@
|
|||||||
addSecondaryChannelButtonAudioLabel: "add secondary channel",
|
addSecondaryChannelButtonAudioLabel: "add secondary channel",
|
||||||
encryptionKeyLabel: "Encryption key",
|
encryptionKeyLabel: "Encryption key",
|
||||||
setEncryptionKeyButtonAudioLabel: "set 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
|
"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
|
// src/View/chatPage.tsx
|
||||||
|
|||||||
Vendored
+4
@@ -798,6 +798,10 @@ header button {
|
|||||||
max-height: 100% !important;
|
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) {
|
.modal > div > :is(button, div.flex-row) {
|
||||||
min-height: var(--control-height);
|
min-height: var(--control-height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,13 @@ export function SettingsPage(chatViewModel: ChatViewModel) {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ const englishTranslations = {
|
|||||||
encryptionKeyLabel: "Encryption key",
|
encryptionKeyLabel: "Encryption key",
|
||||||
setEncryptionKeyButtonAudioLabel: "set encryption key",
|
setEncryptionKeyButtonAudioLabel: "set encryption key",
|
||||||
showEncryptionKey: "Show encryption key",
|
showEncryptionKey: "Show encryption key",
|
||||||
|
|
||||||
|
deleteChatButton: "Delete entire chat",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export default class ChatListViewModel {
|
|||||||
|
|
||||||
// restore
|
// restore
|
||||||
restoreChats = (): void => {
|
restoreChats = (): void => {
|
||||||
|
this.chatViewModels.clear();
|
||||||
for (const chatModel of this.chatListModel.chatModels.values()) {
|
for (const chatModel of this.chatListModel.chatModels.values()) {
|
||||||
const chatViewModel = this.createChatViewModel(chatModel);
|
const chatViewModel = this.createChatViewModel(chatModel);
|
||||||
this.chatViewModels.add(chatViewModel);
|
this.chatViewModels.add(chatViewModel);
|
||||||
|
|||||||
@@ -96,6 +96,12 @@ export default class ChatViewModel {
|
|||||||
this.chatModel.setColor(newColor);
|
this.chatModel.setColor(newColor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
remove = (): void => {
|
||||||
|
this.close();
|
||||||
|
this.chatModel.delete();
|
||||||
|
this.chatListViewModel.restoreChats();
|
||||||
|
}
|
||||||
|
|
||||||
// restore
|
// restore
|
||||||
restorePageSelection = (): void => {
|
restorePageSelection = (): void => {
|
||||||
const path: string[] = storageKeys.chatLastUsedPage(this.chatModel.id);
|
const path: string[] = storageKeys.chatLastUsedPage(this.chatModel.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user