Skip to content

Commit 983ccee

Browse files
committed
feat(client): improve group pages tab
1 parent 99aaca4 commit 983ccee

File tree

4 files changed

+53
-47
lines changed

4 files changed

+53
-47
lines changed

apps/client/components.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ declare module '@vue/runtime-core' {
1515
Combobox: typeof import('./src/components/Combobox.vue')['default']
1616
CopyBtn: typeof import('./src/components/CopyBtn.vue')['default']
1717
CustomDialog: typeof import('./src/components/CustomDialog.vue')['default']
18+
CustomInfiniteScroll: typeof import('./src/components/CustomInfiniteScroll.vue')['default']
1819
DeepBtn: typeof import('./src/components/DeepBtn.vue')['default']
1920
DeepBtnDropdown: typeof import('./src/components/DeepBtnDropdown.vue')['default']
2021
DisplayBtn: typeof import('./src/components/DisplayBtn.vue')['default']
@@ -27,6 +28,7 @@ declare module '@vue/runtime-core' {
2728
MiniSidebarBtn: typeof import('./src/components/MiniSidebarBtn.vue')['default']
2829
PageItem: typeof import('./src/components/PageItem.vue')['default']
2930
PageItemContent: typeof import('./src/components/PageItemContent.vue')['default']
31+
PassthroughComponent: typeof import('./src/components/PassthroughComponent.vue')['default']
3032
PasswordField: typeof import('./src/components/PasswordField.vue')['default']
3133
QMenuHover: typeof import('./src/components/QMenuHover.vue')['default']
3234
Radio: typeof import('./src/components/Radio.vue')['default']
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<template>
2+
<q-infinite-scroll>
3+
<slot></slot>
4+
5+
<template v-slot:loading>
6+
<div class="row justify-center q-my-md">
7+
<q-circular-progress
8+
indeterminate
9+
size="md"
10+
/>
11+
</div>
12+
</template>
13+
</q-infinite-scroll>
14+
</template>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<component
3+
v-if="is != null"
4+
:is="is"
5+
>
6+
<slot></slot>
7+
</component>
8+
9+
<slot v-else></slot>
10+
</template>
11+
12+
<script setup lang="ts">
13+
import type { Component } from 'vue';
14+
15+
defineProps<{
16+
is?: string | Component;
17+
}>();
18+
</script>

apps/client/src/layouts/PagesLayout/RightSidebar/PageProperties/GroupSettingsDialog/PagesTab/PagesTab.vue

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,25 @@
2121

2222
<div style="flex: 1; height: 0; display: flex">
2323
<div style="flex: 1">
24-
<q-list
25-
style="max-height: 100%; border-radius: 10px; background-color: #303030"
24+
<Checklist
25+
:item-ids="finalPageIds"
26+
:items-wrapper="CustomInfiniteScroll"
27+
:wrapper-events="{ load: onLoad }"
28+
:wrapper-props="{ disable: !hasMorePages }"
29+
:selected-item-ids="baseSelectedPageIds"
30+
@select="(pageId) => baseSelectedPageIds.add(pageId)"
31+
@unselect="(pageId) => baseSelectedPageIds.delete(pageId)"
32+
style="max-height: 100%; border-radius: 10px; background-color: #383838"
2633
class="overflow-auto"
2734
>
28-
<q-infinite-scroll
29-
@load="onLoad"
30-
:disable="!hasMorePages"
31-
>
32-
<q-item
33-
v-for="groupPageId in finalPageIds"
34-
:key="groupPageId"
35-
class="text-grey-1"
36-
style="background-color: #424242"
37-
clickable
38-
v-ripple
39-
active-class="bg-grey-7"
40-
:active="baseSelectedPageIds.has(groupPageId)"
41-
@click="select(groupPageId, $event as MouseEvent)"
42-
>
43-
<q-item-section>
44-
<q-item-label>
45-
{{ getPageTitle(groupPageId, { prefer: 'absolute' }).text }}
46-
</q-item-label>
47-
</q-item-section>
48-
</q-item>
49-
50-
<template v-slot:loading>
51-
<div class="row justify-center q-my-md">
52-
<q-circular-progress
53-
indeterminate
54-
size="md"
55-
/>
56-
</div>
57-
</template>
58-
</q-infinite-scroll>
59-
</q-list>
35+
<template #item="{ itemId: groupPageId }">
36+
<q-item-section>
37+
<q-item-label>
38+
{{ getPageTitle(groupPageId, { prefer: 'absolute' }).text }}
39+
</q-item-label>
40+
</q-item-section>
41+
</template>
42+
</Checklist>
6043
</div>
6144

6245
<Gap style="width: 16px" />
@@ -116,7 +99,8 @@ import { deletePage } from 'src/code/api-interface/pages/deletion/delete';
11699
import { movePage } from 'src/code/api-interface/pages/move';
117100
import { getPageTitle } from 'src/code/pages/utils';
118101
import type { RealtimeContext } from 'src/code/realtime/context';
119-
import { asyncDialog, handleError, isCtrlDown } from 'src/code/utils/misc';
102+
import { asyncDialog, handleError } from 'src/code/utils/misc';
103+
import CustomInfiniteScroll from 'src/components/CustomInfiniteScroll.vue';
120104
import type { Ref } from 'vue';
121105
122106
import MovePageDialog from '../../MovePageDialog.vue';
@@ -154,18 +138,6 @@ function deselectAll() {
154138
}
155139
}
156140
157-
function select(id: string, event: MouseEvent) {
158-
if (!isCtrlDown(event)) {
159-
baseSelectedPageIds.value.clear();
160-
}
161-
162-
if (baseSelectedPageIds.value.has(id)) {
163-
baseSelectedPageIds.value.delete(id);
164-
} else {
165-
baseSelectedPageIds.value.add(id);
166-
}
167-
}
168-
169141
async function onLoad(index: number, done: (stop?: boolean) => void) {
170142
try {
171143
const response = await trpcClient.groups.getPages.query({

0 commit comments

Comments
 (0)