feat(navigation): show favorite projects on top
This commit is contained in:
parent
3ba5f531bb
commit
be2a38b48e
@ -8,12 +8,13 @@
|
|||||||
handle=".handle"
|
handle=".handle"
|
||||||
tag="ul"
|
tag="ul"
|
||||||
item-key="id"
|
item-key="id"
|
||||||
|
:disabled="!allowDrag"
|
||||||
:component-data="{
|
:component-data="{
|
||||||
type: 'transition-group',
|
type: 'transition-group',
|
||||||
name: !drag ? 'flip-list' : null,
|
name: !drag ? 'flip-list' : null,
|
||||||
class: [
|
class: [
|
||||||
'menu-list can-be-hidden',
|
'menu-list can-be-hidden',
|
||||||
{ 'dragging-disabled': false }
|
{ 'dragging-disabled': !allowDrag }
|
||||||
]
|
]
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
@ -67,6 +68,7 @@
|
|||||||
<ProjectsNavigation
|
<ProjectsNavigation
|
||||||
v-if="!collapsedProjects[p.id]"
|
v-if="!collapsedProjects[p.id]"
|
||||||
v-model="p.childProjects"
|
v-model="p.childProjects"
|
||||||
|
:allow-drag="true"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
@ -92,6 +94,7 @@ import {useProjectStore} from '@/stores/projects'
|
|||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
modelValue: IProject[],
|
modelValue: IProject[],
|
||||||
|
allowDrag: boolean,
|
||||||
}>()
|
}>()
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
|
@ -48,8 +48,12 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
<nav class="menu" v-if="favoriteProjects">
|
||||||
|
<ProjectsNavigation v-model="favoriteProjects" :allow-drag="false"/>
|
||||||
|
</nav>
|
||||||
|
|
||||||
<nav class="menu">
|
<nav class="menu">
|
||||||
<ProjectsNavigation v-model="projects"/>
|
<ProjectsNavigation v-model="projects" :allow-drag="true"/>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<PoweredByLink/>
|
<PoweredByLink/>
|
||||||
@ -78,6 +82,13 @@ onBeforeMount(async () => {
|
|||||||
const projects = computed(() => Object.values(projectStore.projects)
|
const projects = computed(() => Object.values(projectStore.projects)
|
||||||
.filter(p => p.parentProjectId === 0 && !p.isArchived)
|
.filter(p => p.parentProjectId === 0 && !p.isArchived)
|
||||||
.sort((a, b) => a.position < b.position ? -1 : 1))
|
.sort((a, b) => a.position < b.position ? -1 : 1))
|
||||||
|
const favoriteProjects = computed(() => Object.values(projectStore.projects)
|
||||||
|
.filter(p => !p.isArchived && p.isFavorite)
|
||||||
|
.map(p => ({
|
||||||
|
...p,
|
||||||
|
childProjects: [],
|
||||||
|
}))
|
||||||
|
.sort((a, b) => a.position < b.position ? -1 : 1))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user