feat: full reload on repo link

This commit is contained in:
Julien Calixte
2025-06-08 12:05:03 +02:00
parent 3b8ba8530c
commit c8e75097f5
2 changed files with 34 additions and 34 deletions

View File

@@ -6,22 +6,23 @@ import {
onMounted, onMounted,
onUnmounted, onUnmounted,
toRefs, toRefs,
watch watch,
} from 'vue' } from "vue"
import LiteLoading from '@/components/LiteLoading.vue' import LiteLoading from "@/components/LiteLoading.vue"
import StackedNote from '@/components/StackedNote.vue' import StackedNote from "@/components/StackedNote.vue"
import { useLinks } from '@/hooks/useLinks.hook' import { useLinks } from "@/hooks/useLinks.hook"
import { useMarkdown } from '@/hooks/useMarkdown.hook' import { useMarkdown } from "@/hooks/useMarkdown.hook"
import { useNoteView } from '@/hooks/useNoteView.hook' import { useNoteView } from "@/hooks/useNoteView.hook"
import { useRouteQueryStackedNotes } from '@/hooks/useRouteQueryStackedNotes.hook' import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
import { useVisitRepo } from '@/modules/history/hooks/useVisitRepo.hook' import { useVisitRepo } from "@/modules/history/hooks/useVisitRepo.hook"
import CacheAllNotes from '@/modules/note/components/CacheAllNote.vue' import CacheAllNotes from "@/modules/note/components/CacheAllNote.vue"
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store' import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
import { useUserSettings } from '@/modules/user/hooks/useUserSettings.hook' import { useUserSettings } from "@/modules/user/hooks/useUserSettings.hook"
import { useRoute } from "vue-router"
const HeaderNote = defineAsyncComponent( const HeaderNote = defineAsyncComponent(
() => import('@/components/HeaderNote.vue') () => import("@/components/HeaderNote.vue"),
) )
const props = withDefaults( const props = withDefaults(
@@ -37,10 +38,11 @@ const props = withDefaults(
content: null, content: null,
parseContent: true, parseContent: true,
withContent: true, withContent: true,
withHeader: true withHeader: true,
} },
) )
const route = useRoute()
const user = computed(() => props.user) const user = computed(() => props.user)
const repo = computed(() => props.repo) const repo = computed(() => props.repo)
@@ -49,17 +51,17 @@ const store = useUserRepoStore()
useUserSettings() useUserSettings()
const { visitRepo } = useVisitRepo({ user: user, repo: repo }) const { visitRepo } = useVisitRepo({ user: user, repo: repo })
const { toHTML } = useMarkdown(repo) const { toHTML } = useMarkdown(repo)
const { listenToClick } = useLinks('note-display') const { listenToClick } = useLinks("note-display")
const { stackedNotes, scrollToTop } = useRouteQueryStackedNotes() const { stackedNotes, scrollToTop } = useRouteQueryStackedNotes()
const { titles } = useNoteView('note-container') const { titles } = useNoteView("note-container")
const renderedContent = computed(() => const renderedContent = computed(() =>
props.content !== null props.content !== null
? props.parseContent ? props.parseContent
? toHTML(props.content) ? toHTML(props.content)
: props.content : props.content
: store.readme : store.readme,
) )
const hasContent = computed(() => !!renderedContent.value) const hasContent = computed(() => !!renderedContent.value)
@@ -71,7 +73,7 @@ watch(
await nextTick() await nextTick()
listenToClick() listenToClick()
}, },
{ immediate: true } { immediate: true },
) )
watch( watch(
@@ -79,7 +81,7 @@ watch(
() => { () => {
store.setUserRepo(props.user, props.repo) store.setUserRepo(props.user, props.repo)
}, },
{ immediate: true } { immediate: true },
) )
onMounted(() => visitRepo()) onMounted(() => visitRepo())
@@ -101,9 +103,7 @@ const focusREADME = () => scrollToTop()
<div class="repo-title"> <div class="repo-title">
<div class="repo-header"> <div class="repo-header">
<h1 class="heading-1"> <h1 class="heading-1">
<router-link :to="{ name: 'FluxNoteView', params: { user, repo } }"> <a :href="route.path">{{ repo }}</a>
{{ repo }}
</router-link>
</h1> </h1>
{{ user }} {{ user }}
</div> </div>

View File

@@ -1,26 +1,26 @@
import { Notyf } from 'notyf' import { Notyf } from "notyf"
const notif = new Notyf({ const notif = new Notyf({
types: [ types: [
{ {
className: 'alert alert-success', className: "alert alert-success",
type: 'confirm' type: "confirm",
}, },
{ {
className: 'alert alert-error', className: "alert alert-error",
type: 'error' type: "error",
} },
] ],
}) })
export const confirmMessage = (message: string) => export const confirmMessage = (message: string) =>
notif.open({ notif.open({
type: 'confirm', type: "confirm",
message message,
}) })
export const errorMessage = (message: string) => export const errorMessage = (message: string) =>
notif.open({ notif.open({
type: 'error', type: "error",
message message,
}) })