refactor: standardize module tool bar
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -11,6 +11,7 @@ const entitiesStore = useEntitiesStore()
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
selectedCollection?: CollectionObject | null
|
selectedCollection?: CollectionObject | null
|
||||||
selectedEntity?: EntityObject | null
|
selectedEntity?: EntityObject | null
|
||||||
|
search?: string | null
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
// Emits
|
// Emits
|
||||||
@@ -21,7 +22,6 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
// State
|
// State
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const searchQuery = ref('')
|
|
||||||
|
|
||||||
// Entities belonging to the selected collection, sourced live from the manager store
|
// Entities belonging to the selected collection, sourced live from the manager store
|
||||||
const collectionEntities = computed<EntityObject[]>(() => {
|
const collectionEntities = computed<EntityObject[]>(() => {
|
||||||
@@ -34,10 +34,10 @@ const collectionEntities = computed<EntityObject[]>(() => {
|
|||||||
|
|
||||||
// Computed
|
// Computed
|
||||||
const filteredEntities = computed(() => {
|
const filteredEntities = computed(() => {
|
||||||
if (!searchQuery.value) {
|
const query = (props.search ?? '').trim().toLowerCase()
|
||||||
|
if (!query) {
|
||||||
return collectionEntities.value
|
return collectionEntities.value
|
||||||
}
|
}
|
||||||
const query = searchQuery.value.toLowerCase()
|
|
||||||
return collectionEntities.value.filter(entity => {
|
return collectionEntities.value.filter(entity => {
|
||||||
const props = (entity.properties as any)
|
const props = (entity.properties as any)
|
||||||
const given = props?.names?.given || ''
|
const given = props?.names?.given || ''
|
||||||
@@ -163,18 +163,6 @@ function entityAvatarColor(entity: EntityObject): string {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="person-list-container">
|
<div class="person-list-container">
|
||||||
<div class="person-list-header pa-4">
|
|
||||||
<v-text-field
|
|
||||||
v-model="searchQuery"
|
|
||||||
density="compact"
|
|
||||||
variant="outlined"
|
|
||||||
label="Search contacts"
|
|
||||||
prepend-inner-icon="mdi-magnify"
|
|
||||||
clearable
|
|
||||||
hide-details
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="pa-0 person-list-content">
|
<div class="pa-0 person-list-content">
|
||||||
<v-progress-linear v-if="loading" indeterminate color="primary" />
|
<v-progress-linear v-if="loading" indeterminate color="primary" />
|
||||||
|
|
||||||
@@ -251,13 +239,6 @@ function entityAvatarColor(entity: EntityObject): string {
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.person-list-header {
|
|
||||||
min-height: 72px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
border-bottom: 1px solid rgb(var(--v-border-color));
|
|
||||||
}
|
|
||||||
|
|
||||||
.person-list-content {
|
.person-list-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
@@ -267,10 +248,6 @@ function entityAvatarColor(entity: EntityObject): string {
|
|||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.person-list-container :deep(.v-field) {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.v-list-item {
|
.v-list-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import ImportDialog from '@/components/ImportDialog.vue'
|
|||||||
|
|
||||||
// Vuetify display
|
// Vuetify display
|
||||||
const display = useDisplay()
|
const display = useDisplay()
|
||||||
|
const isMobile = computed(() => display.mdAndDown.value)
|
||||||
|
|
||||||
// Check if people manager is available
|
// Check if people manager is available
|
||||||
const moduleStore = useModuleStore()
|
const moduleStore = useModuleStore()
|
||||||
@@ -53,6 +54,9 @@ const {
|
|||||||
closeImport,
|
closeImport,
|
||||||
} = peopleStore
|
} = peopleStore
|
||||||
|
|
||||||
|
// Contact search (filters the person list)
|
||||||
|
const searchQuery = ref('')
|
||||||
|
|
||||||
// VCF import file picker
|
// VCF import file picker
|
||||||
const fileInputRef = ref<HTMLInputElement | null>(null)
|
const fileInputRef = ref<HTMLInputElement | null>(null)
|
||||||
|
|
||||||
@@ -81,7 +85,7 @@ onMounted(async () => {
|
|||||||
<template>
|
<template>
|
||||||
<div class="people-container">
|
<div class="people-container">
|
||||||
<!-- Top Navigation Bar -->
|
<!-- Top Navigation Bar -->
|
||||||
<v-toolbar elevation="0" class="people-toolbar border-b">
|
<v-toolbar elevation="0" density="compact" class="people-toolbar">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<v-btn
|
<v-btn
|
||||||
icon="mdi-menu"
|
icon="mdi-menu"
|
||||||
@@ -91,11 +95,24 @@ onMounted(async () => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<v-toolbar-title class="d-flex align-center">
|
<v-toolbar-title class="d-flex align-center">
|
||||||
<v-icon size="28" color="primary" class="mr-2">mdi-account-multiple</v-icon>
|
<v-icon size="24" color="primary" class="mr-2">mdi-account-multiple</v-icon>
|
||||||
<span class="text-h6 font-weight-bold">People Manager</span>
|
<span class="text-subtitle-1 font-weight-bold">People</span>
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
|
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
|
||||||
|
<!-- Search -->
|
||||||
|
<v-text-field
|
||||||
|
v-model="searchQuery"
|
||||||
|
density="compact"
|
||||||
|
variant="outlined"
|
||||||
|
placeholder="Search contacts..."
|
||||||
|
prepend-inner-icon="mdi-magnify"
|
||||||
|
hide-details
|
||||||
|
single-line
|
||||||
|
clearable
|
||||||
|
class="people-toolbar-search mx-4"
|
||||||
|
/>
|
||||||
</v-toolbar>
|
</v-toolbar>
|
||||||
|
|
||||||
<!-- Main Content Area -->
|
<!-- Main Content Area -->
|
||||||
@@ -104,8 +121,8 @@ onMounted(async () => {
|
|||||||
<v-navigation-drawer
|
<v-navigation-drawer
|
||||||
v-model="sidebarVisible"
|
v-model="sidebarVisible"
|
||||||
contained
|
contained
|
||||||
:permanent="display.mdAndUp.value"
|
:permanent="sidebarVisible && !isMobile"
|
||||||
:temporary="display.smAndDown.value"
|
:temporary="isMobile"
|
||||||
width="280"
|
width="280"
|
||||||
class="people-sidebar"
|
class="people-sidebar"
|
||||||
>
|
>
|
||||||
@@ -227,6 +244,7 @@ onMounted(async () => {
|
|||||||
<PersonList
|
<PersonList
|
||||||
:selected-collection="selectedCollection"
|
:selected-collection="selectedCollection"
|
||||||
:selected-entity="selectedEntity"
|
:selected-entity="selectedEntity"
|
||||||
|
:search="searchQuery"
|
||||||
@select="selectEntity"
|
@select="selectEntity"
|
||||||
@fresh="createEntity"
|
@fresh="createEntity"
|
||||||
/>
|
/>
|
||||||
@@ -275,9 +293,21 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.people-toolbar {
|
.people-toolbar {
|
||||||
|
flex-shrink: 0;
|
||||||
border-bottom: 1px solid rgb(var(--v-border-color)) !important;
|
border-bottom: 1px solid rgb(var(--v-border-color)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.people-toolbar-search {
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 960px) {
|
||||||
|
.people-toolbar-search {
|
||||||
|
max-width: 180px;
|
||||||
|
margin-inline: 8px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.people-content {
|
.people-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user