Skip to content

Commit 2111610

Browse files
committed
ui(pages): add menus to backlinks
1 parent 3da7ec5 commit 2111610

File tree

2 files changed

+49
-14
lines changed

2 files changed

+49
-14
lines changed

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/PageBacklinks.vue

+47-14
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,43 @@
3636
/>
3737

3838
<DeepBtn
39-
class="delete-btn"
40-
icon="mdi-close"
39+
class="menu-btn"
40+
icon="mdi-dots-vertical"
4141
round
4242
flat
43-
style="min-width: 32px; min-height: 32px; width: 32px; height: 32px"
44-
title="Remove backlink"
45-
@click.stop="deleteBacklink(backlinkPageId)"
46-
/>
43+
style="min-width: 0; min-height: 0; width: 32px; height: 32px"
44+
>
45+
<q-menu>
46+
<q-list>
47+
<q-item
48+
clickable
49+
v-ripple
50+
@click="addToSelection(backlinkPageId)"
51+
>
52+
<q-item-section avatar>
53+
<q-icon name="mdi-selection-multiple" />
54+
</q-item-section>
55+
56+
<q-item-section>
57+
<q-item-label>Add to selection</q-item-label>
58+
</q-item-section>
59+
</q-item>
60+
<q-item
61+
clickable
62+
v-ripple
63+
@click="deleteBacklink(backlinkPageId)"
64+
>
65+
<q-item-section avatar>
66+
<q-icon name="mdi-trash-can" />
67+
</q-item-section>
68+
69+
<q-item-section>
70+
<q-item-label>Delete backlink</q-item-label>
71+
</q-item-section>
72+
</q-item>
73+
</q-list>
74+
</q-menu>
75+
</DeepBtn>
4776
</div>
4877
</q-list>
4978
</div>
@@ -52,6 +81,7 @@
5281
<script setup lang="ts">
5382
import type { Page } from 'src/code/pages/page/page';
5483
import { handleError } from 'src/code/utils/misc';
84+
import { pageSelectionStore } from 'src/stores/page-selection';
5585
import type { Ref } from 'vue';
5686
5787
const page = inject<Ref<Page>>('page')!;
@@ -61,6 +91,16 @@ const backlinks = computed(
6191
page.value.realtimeCtx.hget('page-backlinks', page.value.id, 'list') ?? [],
6292
);
6393
94+
function addToSelection(pageId: string) {
95+
pageSelectionStore().selectedPages.add(pageId);
96+
97+
$quasar().notify({
98+
message: 'Page added to selection.',
99+
color: 'positive',
100+
timeout: 1000,
101+
});
102+
}
103+
64104
async function deleteBacklink(backlinkPageId: string) {
65105
try {
66106
await trpcClient.pages.backlinks.delete.mutate({
@@ -86,7 +126,7 @@ async function deleteBacklink(backlinkPageId: string) {
86126
.backlink {
87127
position: relative;
88128
89-
> .delete-btn {
129+
> .menu-btn {
90130
position: absolute;
91131
92132
top: 50%;
@@ -98,13 +138,6 @@ async function deleteBacklink(backlinkPageId: string) {
98138
min-height: 30px;
99139
width: 30px;
100140
height: 30px;
101-
102-
opacity: 0;
103-
transition: opacity 0.2s;
104141
}
105142
}
106-
107-
.backlink:hover > .delete-btn {
108-
opacity: 1;
109-
}
110143
</style>

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/PageSelection.vue

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function selectPage() {
3131
$quasar().notify({
3232
message: 'Page added to selection.',
3333
color: 'positive',
34+
timeout: 1000,
3435
});
3536
}
3637
@@ -62,6 +63,7 @@ function selectLinkedPages() {
6263
$quasar().notify({
6364
message: 'Linked pages added to selection.',
6465
color: 'positive',
66+
timeout: 1000,
6567
});
6668
}
6769
</script>

0 commit comments

Comments
 (0)