Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix bugs in command center: the scroll of background, mobile no scroll, close on toggle, no result display

Smaug6739e465ec9bbbce
diff --git a/frontend/app/components/CommandCenter/AdvancedSearchTab.vue b/frontend/app/components/CommandCenter/AdvancedSearchTab.vue
index 6383aea3..bae27982 100644
--- a/frontend/app/components/CommandCenter/AdvancedSearchTab.vue
+++ b/frontend/app/components/CommandCenter/AdvancedSearchTab.vue
@@ -100,6 +100,7 @@
<SearchResultsList
:items="flattenedItems"
:selected-index="selectedIndex"
+ :query="query"
empty-text="No documents match your filters"
empty-icon="search"
@update-selected-index="$emit('updateSelectedIndex', $event)"
@@ -239,7 +240,6 @@ defineExpose({ flattenedItems });
display: flex;
height: 100%;
flex-direction: column;
- overflow: hidden;
}
.search-filters {
@@ -497,8 +497,6 @@ defineExpose({ flattenedItems });
position: relative;
min-height: 0;
flex: 1;
- -webkit-overflow-scrolling: touch;
- overflow-y: auto;
overscroll-behavior: contain;
}
@@ -510,10 +508,4 @@ defineExpose({ flattenedItems });
color: white;
background: var(--primary);
}
-
-.navigate-icon {
- width: 16px;
- height: 16px;
- flex-shrink: 0;
-}
</style>
diff --git a/frontend/app/components/CommandCenter/QuickSearchTab.vue b/frontend/app/components/CommandCenter/QuickSearchTab.vue
index 6e4bf94b..0467acf6 100644
--- a/frontend/app/components/CommandCenter/QuickSearchTab.vue
+++ b/frontend/app/components/CommandCenter/QuickSearchTab.vue
@@ -3,7 +3,7 @@
<SearchResultsList
:items="flattenedItems"
:selected-index="selectedIndex"
- empty-text='No results found for "{{ searchQuery }}"'
+ :query="searchQuery"
empty-icon="search"
@update-selected-index="$emit('updateSelectedIndex', $event)"
/>
@@ -116,6 +116,5 @@ defineExpose({ flattenedItems });
display: flex;
height: 100%;
flex-direction: column;
- overflow: hidden;
}
</style>
diff --git a/frontend/app/components/CommandCenter/SearchResultsList.vue b/frontend/app/components/CommandCenter/SearchResultsList.vue
index b4604461..e76c1f70 100644
--- a/frontend/app/components/CommandCenter/SearchResultsList.vue
+++ b/frontend/app/components/CommandCenter/SearchResultsList.vue
@@ -2,7 +2,7 @@
<div>
<div v-if="items.length === 0" class="no-results">
<Icon :name="emptyIcon" class="no-results-icon" fill="var(--font-color)" />
- <p>{{ emptyText }}</p>
+ <p>No results found for "{{ query }}"</p>
</div>
<div v-else class="search-results-list">
<div v-for="(group, section) in groupedItems" :key="section" class="section">
@@ -35,7 +35,7 @@ import type { Item } from './types';
const props = defineProps<{
items: Item[];
selectedIndex: number;
- emptyText: string;
+ query: string;
emptyIcon: string;
}>();
@@ -52,15 +52,6 @@ const groupedItems = computed(() => {
</script>
<style scoped lang="scss">
-.search-results {
- position: relative;
- min-height: 0;
- flex: 1;
- -webkit-overflow-scrolling: touch;
- overflow-y: auto;
- overscroll-behavior: contain;
-}
-
.search-results-list {
max-height: 100%;
padding: 8px 0;
diff --git a/frontend/app/components/CommandCenter/index.vue b/frontend/app/components/CommandCenter/index.vue
index 1d5f648c..4cecfda6 100644
--- a/frontend/app/components/CommandCenter/index.vue
+++ b/frontend/app/components/CommandCenter/index.vue
@@ -13,7 +13,7 @@
placeholder="Search for a page, action, or document..."
class="search-input"
@keydown="handleSearchKeydown"
- />
+ /><tag yellow style="height: fit-content">Beta</tag>
</div>
<button class="close-btn" @click="closeSearch">
<Icon name="close" />
@@ -97,22 +97,13 @@ onMounted(() => {
}
};
- const handleTouchMove = (e: TouchEvent) => {
- if (isOpen.value) {
- e.preventDefault();
- e.stopPropagation();
- }
- };
-
document.addEventListener('keydown', handleGlobalKeydown);
- document.addEventListener('touchmove', handleTouchMove, { passive: false });
const openListener = () => openSearch();
window.addEventListener('command-center-open', openListener as EventListener);
onUnmounted(() => {
document.removeEventListener('keydown', handleGlobalKeydown);
document.removeEventListener('wheel', handleWheel);
- document.removeEventListener('touchmove', handleTouchMove);
window.removeEventListener('command-center-open', openListener as EventListener);
});
});
@@ -124,6 +115,7 @@ function openSearch() {
searchQuery.value = '';
activeTab.value = 'quick';
nextTick(() => searchInput.value?.focus());
+ document.body.classList.add('modal-open');
}
function closeSearch(e?: MouseEvent) {
@@ -135,10 +127,11 @@ function closeSearch(e?: MouseEvent) {
!(e.target as Element).closest('.search-results-list')
)
return;
+
isOpen.value = false;
searchQuery.value = '';
selectedIndex.value = 0;
- document.body.style.overflow = '';
+ document.body.classList.remove('modal-open');
}
function changeTab(tabId: string) {
@@ -195,15 +188,13 @@ function handleSearchKeydown(e: KeyboardEvent) {
defineExpose({ openSearch, closeSearch });
-watch(searchQuery, () => {
- selectedIndex.value = 0;
-});
+watch(searchQuery, () => (selectedIndex.value = 0));
</script>
<style scoped lang="scss">
.command-center-overlay {
position: fixed;
- z-index: 1000;
+ z-index: 500;
display: flex;
background: rgb(0 0 0 / 50%);
align-items: flex-start;
@@ -226,6 +217,7 @@ watch(searchQuery, () => {
animation: slide-in 0.2s ease-out;
flex-direction: column;
overflow: auto;
+ z-index: 1000;
}
.search-header {
@@ -239,6 +231,8 @@ watch(searchQuery, () => {
.search-input-wrapper {
position: relative;
+ align-items: center;
+ display: flex;
flex: 1;
}
@@ -252,7 +246,7 @@ watch(searchQuery, () => {
}
.search-input {
- width: 100%;
+ flex: 1;
padding: 12px 12px 12px 44px;
border: none;
font-size: 16px;
diff --git a/frontend/app/components/Icon.vue b/frontend/app/components/Icon.vue
index 6235af44..46807ed1 100644
--- a/frontend/app/components/Icon.vue
+++ b/frontend/app/components/Icon.vue
@@ -31,7 +31,10 @@ const icon = computed(() => useIcon(props.name as IconName) || props.name);
.fill:deep(svg) > path {
fill: inherit !important;
}
-
+.icon :deep(svg),
+.icon :deep(svg) * {
+ pointer-events: none;
+}
.small {
width: 18px;
height: 18px;
diff --git a/frontend/app/styles/main.scss b/frontend/app/styles/main.scss
index 55fba326..1b2b6bdb 100644
--- a/frontend/app/styles/main.scss
+++ b/frontend/app/styles/main.scss
@@ -64,6 +64,11 @@ body {
transition: background-color $transition-duration;
}
+body.modal-open {
+ overflow: hidden;
+ touch-action: none;
+}
+
:root {
--padding: calc((100vw - 1700px) / 2);
}
@@ -88,6 +93,7 @@ form {
}
@media print {
+
header,
footer,
nav,