♻️ (app)

This commit is contained in:
Julien Calixte
2023-08-14 14:08:10 +02:00
parent 111794a40b
commit c0182c7f57
24 changed files with 4281 additions and 2108 deletions

View File

@@ -2,11 +2,11 @@ import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
import { useNotes } from '@/modules/note/hooks/useNotes'
import { pathToNoteTitle } from '@/utils/noteTitle'
import { useTitle } from '@vueuse/core'
import { computed, watch } from 'vue'
import { computed, Ref, toValue, watch } from 'vue'
export const generateTitle = (titles: string[]) => titles.join(' | ')
export const useTitleNotes = (prefix: string) => {
export const useTitleNotes = (prefix: Ref<string> | string) => {
const { stackedNotes } = useQueryStackedNotes()
const { notes } = useNotes()
const titleNotes = computed(() =>
@@ -15,9 +15,9 @@ export const useTitleNotes = (prefix: string) => {
.map((note) => pathToNoteTitle(note.path ?? ''))
)
const title = useTitle(generateTitle([prefix, ...titleNotes.value]))
const title = useTitle(generateTitle([toValue(prefix), ...titleNotes.value]))
watch(titleNotes, () => {
title.value = generateTitle([prefix, ...titleNotes.value])
title.value = generateTitle([toValue(prefix), ...titleNotes.value])
})
}