This commit is contained in:
2023-12-08 22:42:48 +01:00
parent aee6ecfbfe
commit 10c0387eb0
16 changed files with 38 additions and 32 deletions

View File

@@ -1,2 +1,11 @@
pretty: pretty:
npx prettier --write "./src/**/*.(ts|vue)" npx prettier --write "./src/**/*.(ts|vue)"
check:
npm run type-check && npm run lint
local: check
npm run local
deploy: check
npm run deploy

View File

@@ -9,7 +9,7 @@
"preview": "vite preview", "preview": "vite preview",
"build-only": "vite build", "build-only": "vite build",
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false", "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", "lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/", "format": "prettier --write src/",
"local": "npm run build && firebase serve --only hosting", "local": "npm run build && firebase serve --only hosting",
"deploy": "npm run build && firebase deploy --only hosting:contexted-v3" "deploy": "npm run build && firebase deploy --only hosting:contexted-v3"

View File

@@ -111,7 +111,7 @@ const topBarHeightWithSafeArea = computed(() => `calc(${topBarHeight}px + var(--
</div> </div>
</main> </main>
</div> </div>
<UIModal :open="passphraseRequired" :persistent="true"> <UIModal :open="passphraseRequired" persistent>
<template #title>Enter your passphrase</template> <template #title>Enter your passphrase</template>
<template #default="{ close }"> <template #default="{ close }">
<div> <div>

View File

@@ -45,7 +45,7 @@ const handleKeypress = (event: { [key: string]: number }) => {
defineExpose({ handleKeypress }) defineExpose({ handleKeypress })
</script> </script>
<template> <template>
<UIMenu class="border-[1px] p-2 text-[0.875rem] text-black shadow-md" :compact="true"> <UIMenu class="border-[1px] p-2 text-[0.875rem] text-black shadow-md" compact>
<UIMenuItem :active="!activeResult" @click="emit('createLink', props.autocompleteText)"> <UIMenuItem :active="!activeResult" @click="emit('createLink', props.autocompleteText)">
<span class="flex-grow">{{ props.autocompleteText }}</span> <span class="flex-grow">{{ props.autocompleteText }}</span>
<i class="fas fa-plus-circle ml-auto text-white" /> <i class="fas fa-plus-circle ml-auto text-white" />

View File

@@ -6,7 +6,7 @@ const props = defineProps<{
</script> </script>
<template> <template>
<UIMenu class="mt-3 rounded-xl border-[1px] px-3 py-3" v-if="props.references.length > 0"> <UIMenu class="mt-3 rounded-xl border-[1px] px-3 py-3" v-if="props.references.length > 0">
<UIMenuItem :title="true"> <UIMenuItem title>
<span>References</span> <span>References</span>
<UIBadge variant="outline" class="ml-2">{{ props.references.length }}</UIBadge> <UIBadge variant="outline" class="ml-2">{{ props.references.length }}</UIBadge>
</UIMenuItem> </UIMenuItem>

View File

@@ -38,7 +38,7 @@ const confirmModals: ModalOptions[] = [
] ]
const emit = defineEmits<{ const emit = defineEmits<{
execute: [actionType: ActionKey, close?: () => void] execute: [actionType: ActionKey, close?: () => Promise<void>]
}>() }>()
const openModal = async (open: () => void, modal: ModalOptions) => { const openModal = async (open: () => void, modal: ModalOptions) => {
@@ -58,12 +58,7 @@ const openModal = async (open: () => void, modal: ModalOptions) => {
<UIButtonGroup class="flex items-center" v-if="!props.note.isRoot"> <UIButtonGroup class="flex items-center" v-if="!props.note.isRoot">
<UIModal v-for="confirmModal in confirmModals" :key="confirmModal.key"> <UIModal v-for="confirmModal in confirmModals" :key="confirmModal.key">
<template #activator="{ open }"> <template #activator="{ open }">
<UIButton <UIButton size="sm" @click="openModal(open, confirmModal)" @mousedown="vibrate" join>
size="sm"
@click="openModal(open, confirmModal)"
:join="true"
@mousedown="vibrate"
>
<i :class="confirmModal.icon" /> <i :class="confirmModal.icon" />
</UIButton> </UIButton>
</template> </template>

View File

@@ -66,7 +66,7 @@ const resultsRefs = ref<InstanceType<typeof SearchResult>[]>([])
@keydown="handleKeydown" @keydown="handleKeydown"
/> />
<div class="z-1000 absolute left-0 right-0 top-[100%]" v-if="active"> <div class="z-1000 absolute left-0 right-0 top-[100%]" v-if="active">
<UIMenu :compact="true" class="mt-1 w-full rounded-md bg-base-100 p-2 text-black shadow"> <UIMenu compact class="mt-1 w-full rounded-md bg-base-100 p-2 text-black shadow">
<div class="max-h-[320px] w-full overflow-y-auto"> <div class="max-h-[320px] w-full overflow-y-auto">
<template v-if="results.length > 0"> <template v-if="results.length > 0">
<SearchResult <SearchResult

View File

@@ -24,7 +24,7 @@ const searchActive = ref<boolean>(false)
// const authUI: any = inject('firebaseAuthUI') // const authUI: any = inject('firebaseAuthUI')
// const authPending = ref<boolean>(authUI.isPendingRedirect()) // const authPending = ref<boolean>(authUI.isPendingRedirect())
const handleSignIn = async (close: () => Promise<boolean>) => { const handleSignIn = async (close: () => Promise<void>) => {
await close() await close()
// authPending.value = false // authPending.value = false
} }

View File

@@ -9,7 +9,7 @@ const emit = defineEmits<{
</script> </script>
<template> <template>
<label <label
class="dui-btn-ghost dui-btn-sm dui-btn-circle dui-btn relative inline-grid cursor-pointer select-none place-content-center" class="dui-btn-ghost dui-btn dui-btn-sm dui-btn-circle relative inline-grid cursor-pointer select-none place-content-center"
> >
<input type="checkbox" @click="emit('toggleSideBar')" :checked="!props.sideBarCollapsed" /> <input type="checkbox" @click="emit('toggleSideBar')" :checked="!props.sideBarCollapsed" />
<svg <svg

View File

@@ -7,7 +7,7 @@ import { vibrate } from '@/composables/useHaptics'
<UIDropdown class="search-active-hide"> <UIDropdown class="search-active-hide">
<template #activator> <template #activator>
<UIButton <UIButton
:dropdown="true" dropdown
size="sm" size="sm"
variant="outline" variant="outline"
class="topbar-button text-white" class="topbar-button text-white"

View File

@@ -3,7 +3,7 @@ import { preferredNotesSource } from '@/composables/useSettings'
import { signOut as firebaseSignOut } from '@/composables/useFirebase' import { signOut as firebaseSignOut } from '@/composables/useFirebase'
import { clearEncryptionKeys } from '@/composables/useEncryption' import { clearEncryptionKeys } from '@/composables/useEncryption'
const signOut = async (close: () => Promise<boolean>) => { const signOut = async (close: () => Promise<void>) => {
await close() await close()
await firebaseSignOut() await firebaseSignOut()
preferredNotesSource.value = null preferredNotesSource.value = null

View File

@@ -273,17 +273,19 @@ const links = computed(() => {
</script> </script>
<template> <template>
<div class="flex h-full flex-grow flex-col"> <div class="flex h-full flex-grow flex-col">
<UITabs> <div class="flex">
<UITab <UITabs>
v-for="mindmap in mindmaps" <UITab
:key="mindmap.id" v-for="mindmap in mindmaps"
:active="mindmap.id === selectedMindmap?.id" :key="mindmap.id"
@click="selectedMindmap = mindmap" :active="mindmap.id === selectedMindmap?.id"
> @click="selectedMindmap = mindmap"
<i class="fas fa-fw fa-home root mr-1" v-if="mindmap.isRoot" /> >
{{ mindmap.notes.length }} notes <i class="fas fa-fw fa-home root mr-1" v-if="mindmap.isRoot" />
</UITab> {{ mindmap.notes.length }} notes
</UITabs> </UITab>
</UITabs>
</div>
<div id="mindmap" ref="mindmapElement" class="h-full"></div> <div id="mindmap" ref="mindmapElement" class="h-full"></div>
</div> </div>
</template> </template>

View File

@@ -30,7 +30,7 @@ const updateNoteContent = (content: string) => {
const references = computed<Note[]>(() => getNoteReferences(props.note)) const references = computed<Note[]>(() => getNoteReferences(props.note))
const handleAction = async (action: string, closeModal: () => Promise<Boolean>) => { const handleAction = async (action: 'delete' | 'setRoot', closeModal?: () => Promise<void>) => {
switch (action) { switch (action) {
case 'delete': case 'delete':
if (closeModal) await closeModal() if (closeModal) await closeModal()

View File

@@ -3,7 +3,7 @@
<slot name="activator" tabindex="0"></slot> <slot name="activator" tabindex="0"></slot>
<ul <ul
tabindex="0" tabindex="0"
class="dui-menu-compact dui-dropdown-content dui-menu rounded-box mt-1 w-52 bg-base-100 p-2 text-base-content shadow" class="dui-menu-compact dui-dropdown-content dui-menu mt-1 w-52 rounded-box bg-base-100 p-2 text-base-content shadow"
> >
<slot name="items"></slot> <slot name="items"></slot>
</ul> </ul>

View File

@@ -31,9 +31,9 @@ const modal = ref<HTMLElement | null>(null)
const modalBox = ref(null) const modalBox = ref(null)
const open = () => (show.value = true) const open = () => (show.value = true)
const close = (): Promise<boolean> => { const close = (): Promise<void> => {
return new Promise((resolve) => { return new Promise((resolve) => {
modal.value?.addEventListener('transitionend', () => resolve(true)) modal.value?.addEventListener('transitionend', () => resolve())
show.value = false show.value = false
}) })
} }

View File

@@ -1,3 +1,3 @@
<template> <template>
<div class="dui-tabs dui-tabs-md dui-tabs-lifted"><slot></slot></div> <div class="dui-tabs dui-tabs-boxed dui-tabs-md"><slot></slot></div>
</template> </template>