(backlinks) init backlinks

This commit is contained in:
Julien Calixte
2021-06-05 16:38:53 +02:00
parent ececcc2391
commit 203db4c00a
6 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<template>
<div class="linked-notes"></div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'LinkedNotes',
props: {
sha: { type: String, required: true }
}
})
</script>
<style scoped lang="scss">
.linked-notes {
}
</style>

View File

@@ -23,6 +23,7 @@
</router-link> </router-link>
</div> </div>
<section class="note-content" v-html="content"></section> <section class="note-content" v-html="content"></section>
<linked-notes v-if="content" :sha="sha" />
</div> </div>
</template> </template>
@@ -33,9 +34,13 @@ import { useLinks } from '@/hooks/useLinks.hook'
import { useNoteOverlay } from '@/hooks/useNoteOverlay.hook' import { useNoteOverlay } from '@/hooks/useNoteOverlay.hook'
import { useFocus } from '@/hooks/useFocus.hook' import { useFocus } from '@/hooks/useFocus.hook'
import { useImages } from '@/hooks/useImages.hook' import { useImages } from '@/hooks/useImages.hook'
import LinkedNotes from '@/components/LinkedNotes.vue'
export default defineComponent({ export default defineComponent({
name: 'StackedNote', name: 'StackedNote',
components: {
LinkedNotes
},
props: { props: {
user: { type: String, required: true }, user: { type: String, required: true },
repo: { type: String, required: true }, repo: { type: String, required: true },

View File

@@ -0,0 +1,14 @@
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { watch } from 'vue'
export const useBackLinks = () => {
const store = useUserRepoStore()
watch(store, () => {
if (!store.userSettings?.backlink) {
return
}
console.log("let's go backlinks!")
})
}

View File

@@ -8,4 +8,5 @@ export interface UserSettings {
| 'Tajawal' | 'Tajawal'
| 'Domine' | 'Domine'
mode?: 'light' | 'dark' mode?: 'light' | 'dark'
backlink?: boolean
} }

View File

@@ -79,6 +79,7 @@ export const getUserSettingsContent = async (
if (!configFile?.sha) { if (!configFile?.sha) {
return null return null
} }
const content = await getFileContent(user, repo, configFile.sha) const content = await getFileContent(user, repo, configFile.sha)
if (!content) { if (!content) {

View File

@@ -12,6 +12,7 @@ import { defineComponent, defineAsyncComponent, computed } from 'vue'
import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook' import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
import NewVersion from '@/components/NewVersion.vue' import NewVersion from '@/components/NewVersion.vue'
import Authorize from '@/components/Authorize.vue' import Authorize from '@/components/Authorize.vue'
import { useBackLinks } from '@/hooks/useBacklinks.hook'
const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue')) const FluxNote = defineAsyncComponent(() => import('@/components/FluxNote.vue'))
@@ -33,6 +34,7 @@ export default defineComponent({
}, },
setup(props) { setup(props) {
const { resetStackedNotes } = useQueryStackedNotes() const { resetStackedNotes } = useQueryStackedNotes()
useBackLinks()
return { return {
resetStackedNotes, resetStackedNotes,