change theems

This commit is contained in:
Julien Calixte
2025-03-01 22:54:10 +01:00
parent 6ce9f62870
commit 361b9af8f3
9 changed files with 78 additions and 72 deletions

View File

@@ -5,28 +5,28 @@ import {
nextTick,
onMounted,
ref,
watch,
} from "vue"
watch
} from 'vue'
import { useEditionMode } from "@/hooks/useEditionMode"
import { useFile } from "@/hooks/useFile.hook"
import { useGitHubContent } from "@/hooks/useGitHubContent.hook"
import { useImages } from "@/hooks/useImages.hook"
import { useLinks } from "@/hooks/useLinks.hook"
import { useNoteOverlay } from "@/hooks/useNoteOverlay.hook"
import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
import { useTitleNotes } from "@/hooks/useTitleNotes.hook"
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
import { encodeUTF8ToBase64 } from "@/utils/decodeBase64ToUTF8"
import { filenameToNoteTitle } from "@/utils/noteTitle"
import { generateTweets } from "@/utils/twitter"
import { useEditionMode } from '@/hooks/useEditionMode'
import { useFile } from '@/hooks/useFile.hook'
import { useGitHubContent } from '@/hooks/useGitHubContent.hook'
import { useImages } from '@/hooks/useImages.hook'
import { useLinks } from '@/hooks/useLinks.hook'
import { useNoteOverlay } from '@/hooks/useNoteOverlay.hook'
import { useRouteQueryStackedNotes } from '@/hooks/useRouteQueryStackedNotes.hook'
import { useTitleNotes } from '@/hooks/useTitleNotes.hook'
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { encodeUTF8ToBase64 } from '@/utils/decodeBase64ToUTF8'
import { filenameToNoteTitle } from '@/utils/noteTitle'
import { generateTweets } from '@/utils/twitter'
const LinkedNotes = defineAsyncComponent(
() => import("@/components/LinkedNotes.vue"),
() => import('@/components/LinkedNotes.vue')
)
const EditNote = defineAsyncComponent(
() => import("@/modules/note/components/EditNote.vue"),
() => import('@/modules/note/components/EditNote.vue')
)
const props = defineProps<{
@@ -50,7 +50,7 @@ const {
rawContent,
getRawContent,
saveCacheNote,
getEditedSha,
getEditedSha
} = useFile(sha)
const initialRawContent = ref<string | null>(null)
const className = computed(() => `stacked-note-${props.index}`)
@@ -62,12 +62,12 @@ const store = useUserRepoStore()
const hasBacklinks = computed(() => store.userSettings?.backlink)
const { displayNoteOverlay } = useNoteOverlay(className.value, index)
const displayedTitle = computed(() => filenameToNoteTitle(props.title ?? ""))
const breadcrumbs = computed(() => displayedTitle.value.split(" / "))
const displayedTitle = computed(() => filenameToNoteTitle(props.title ?? ''))
const breadcrumbs = computed(() => displayedTitle.value.split(' / '))
const { updateFile } = useGitHubContent({
user: user.value,
repo: repo.value,
repo: repo.value
})
onMounted(async () => {
@@ -90,13 +90,13 @@ watch([content, mode], () => {
watch(mode, async (newMode) => {
const hasUserFinishedToEdit =
newMode === "read" && rawContent.value !== initialRawContent.value
newMode === 'read' && rawContent.value !== initialRawContent.value
if (!hasUserFinishedToEdit) {
return
}
if (!path.value) {
console.warn("no path found for this file")
console.warn('no path found for this file')
return
}
@@ -105,17 +105,17 @@ watch(mode, async (newMode) => {
const newSha = await updateFile({
content: rawContent.value,
path: path.value,
sha: editedSha,
sha: editedSha
})
if (!newSha) {
console.warn("no new SHA found for this file")
console.warn('no new SHA found for this file')
return
}
await saveCacheNote(encodeUTF8ToBase64(rawContent.value), {
editedSha: newSha,
editedSha: newSha
})
initialRawContent.value = rawContent.value
})
@@ -127,7 +127,7 @@ watch(mode, async (newMode) => {
:class="{
[className]: true,
overlay: displayNoteOverlay,
[`note-${sha}`]: true,
[`note-${sha}`]: true
}"
>
<a
@@ -177,7 +177,7 @@ watch(mode, async (newMode) => {
v-if="false"
:to="{
name: 'ShareNotes',
params: { user: user, repo: repo, note: sha },
params: { user: user, repo: repo, note: sha }
}"
class="action"
>