better
This commit is contained in:
parent
003f38ea60
commit
f87480e79d
7 changed files with 124 additions and 36 deletions
|
|
@ -31,6 +31,7 @@ export class PagesComponent {
|
|||
readonly showSettings = signal(false);
|
||||
readonly dragHappening = signal(false);
|
||||
readonly showWelcome = signal(false);
|
||||
readonly confirmDeletePageId = signal<string | null>(null);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
|
|
@ -63,6 +64,12 @@ export class PagesComponent {
|
|||
|
||||
readonly selectedPageName = computed(() => this.selectedPage()?.name ?? null);
|
||||
|
||||
readonly confirmDeletePageName = computed(() => {
|
||||
const id = this.confirmDeletePageId();
|
||||
if (!id) return '';
|
||||
return this.store.pages().find((p) => p.id === id)?.name ?? '';
|
||||
});
|
||||
|
||||
readonly selectedPageIndex = computed(() => {
|
||||
const page = this.selectedPage();
|
||||
if (!page) return -1;
|
||||
|
|
@ -94,12 +101,23 @@ export class PagesComponent {
|
|||
}
|
||||
}
|
||||
|
||||
onRemovePage(): void {
|
||||
onRequestRemovePage(): void {
|
||||
const page = this.selectedPage();
|
||||
if (!page) return;
|
||||
this.store.deletePage(page.id);
|
||||
this.confirmDeletePageId.set(page.id);
|
||||
}
|
||||
|
||||
confirmRemovePage(): void {
|
||||
const pageId = this.confirmDeletePageId();
|
||||
if (!pageId) return;
|
||||
this.store.deletePage(pageId);
|
||||
this.selectedPageId.set(null);
|
||||
this.showSettings.set(false);
|
||||
this.confirmDeletePageId.set(null);
|
||||
}
|
||||
|
||||
cancelRemovePage(): void {
|
||||
this.confirmDeletePageId.set(null);
|
||||
}
|
||||
|
||||
onSwitchAccount(token: string): void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue