This commit is contained in:
Julien Calixte
2021-05-09 01:12:01 +02:00
parent a98f30cfcd
commit 6a5e7a9d63
11 changed files with 89 additions and 95 deletions

View File

@@ -1,5 +1,5 @@
<template>
<aside class="new-version" v-if="hasNewVersion">
<aside v-if="hasNewVersion" class="new-version">
<button class="button is-primary" @click="reload">
new version available
</button>

View File

@@ -12,7 +12,7 @@
{{ displayedTitle }}
</a>
</div>
<div class="share" v-if="false">
<div v-if="false" class="share">
<router-link
:to="{
name: 'ShareNotes',

View File

@@ -39,10 +39,9 @@ export const useNoteOverlay = (className: string, index: number) => {
) as NodeListOf<HTMLElement>
stackedNoteContainers.forEach((stackedNote, ind) => {
stackedNote.style.right = `calc(-${NOTE_WIDTH}px + ${(stackedNotes.value
.length -
ind) *
BOOKMARK_WIDTH}rem)`
stackedNote.style.right = `calc(-${NOTE_WIDTH}px + ${
(stackedNotes.value.length - ind) * BOOKMARK_WIDTH
}rem)`
})
}
})

View File

@@ -13,8 +13,4 @@ const i18n = createI18n({
messages
})
createApp(App)
.use(router)
.use(i18n)
.use(createPinia())
.mount('#app')
createApp(App).use(router).use(i18n).use(createPinia()).mount('#app')

View File

@@ -1,32 +1,32 @@
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { computed } from 'vue'
export const useFolderNotes = (folders: string[]) => {
const store = useUserRepoStore()
const fleetingNotes = computed(() =>
store.files.filter(
(file) =>
folders.some((folder) => file.path?.startsWith(folder)) &&
file.path?.endsWith('.md')
)
)
const content = computed(() =>
fleetingNotes.value?.length > 0
? fleetingNotes.value
.map((note) => {
const firstFolder = note.path?.split('/').shift()
return `- [${note.path?.replace(`${firstFolder}/`, '')}](${
note.path
})`
})
.join('\n')
: ''
)
return {
content
}
}
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
import { computed } from 'vue'
export const useFolderNotes = (folders: string[]) => {
const store = useUserRepoStore()
const fleetingNotes = computed(() =>
store.files.filter(
(file) =>
folders.some((folder) => file.path?.startsWith(folder)) &&
file.path?.endsWith('.md')
)
)
const content = computed(() =>
fleetingNotes.value?.length > 0
? fleetingNotes.value
.map((note) => {
const firstFolder = note.path?.split('/').shift()
return `- [${note.path?.replace(`${firstFolder}/`, '')}](${
note.path
})`
})
.join('\n')
: ''
)
return {
content
}
}

View File

@@ -1,6 +1,6 @@
import { DataType } from '@/data/DataType.enum'
import { Model } from '@/data/models/Model'
export interface Note extends Model<DataType.Note> {
content: string
}
import { DataType } from '@/data/DataType.enum'
import { Model } from '@/data/models/Model'
export interface Note extends Model<DataType.Note> {
content: string
}

View File

@@ -5,7 +5,6 @@ import {
getMainReadme,
getUserSettingsContent
} from '@/modules/repo/services/repo'
import { refreshToken } from '@/modules/user/service/signIn'
import { defineStore } from 'pinia'
interface State {

View File

@@ -13,10 +13,10 @@
<div class="field-body">
<div class="control">
<input
v-model="user"
class="input"
type="text"
placeholder="GitHub username"
v-model="user"
/>
</div>
</div>
@@ -28,10 +28,10 @@
<div class="field-body">
<div class="control">
<input
v-model="token"
class="input"
type="password"
placeholder="Personal Access Token"
v-model="token"
/>
</div>
</div>

View File

@@ -6,8 +6,8 @@
<div v-else class="columns is-centered">
<div class="column is-one-third">
<table
class="table is-striped is-hoverable"
v-if="favoriteRepos.length > 0"
class="table is-striped is-hoverable"
>
<thead>
<tr>

View File

@@ -6,10 +6,10 @@
</div>
</article>
<flux-note
key="share-notes"
:user="user"
:repo="repo"
:content="content"
key="share-notes"
:with-header="false"
/>
</div>

View File

@@ -1,41 +1,41 @@
import { resolvePath } from '@/modules/repo/services/resolvePath'
describe('resolve path service', () => {
it('set the absolute path if path to resolve is empty', () => {
expect(resolvePath('standard/README.md', '')).toEqual('standard/')
})
it('returns the path sanitized if there is no absolute path', () => {
expect(resolvePath('', './here/note.md')).toEqual('here/note.md')
})
it('set the absolute path from the current path', () => {
expect(resolvePath('standard/README.md', './other-note.md')).toEqual(
'standard/other-note.md'
)
})
it('set the absolute path from the current path with multiple level', () => {
expect(
resolvePath('standard/you/are/here/README.md', './other-note.md')
).toEqual('standard/you/are/here/other-note.md')
})
it('set the absolute path from the current path with a go back in the relative path', () => {
expect(
resolvePath('standard/you/are/here/README.md', '../other-note.md')
).toEqual('standard/you/are/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', '../../other-note.md')
).toEqual('standard/you/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', './../../other-note.md')
).toEqual('standard/you/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', './../../../other-note.md')
).toEqual('standard/other-note.md')
})
})
import { resolvePath } from '@/modules/repo/services/resolvePath'
describe('resolve path service', () => {
it('set the absolute path if path to resolve is empty', () => {
expect(resolvePath('standard/README.md', '')).toEqual('standard/')
})
it('returns the path sanitized if there is no absolute path', () => {
expect(resolvePath('', './here/note.md')).toEqual('here/note.md')
})
it('set the absolute path from the current path', () => {
expect(resolvePath('standard/README.md', './other-note.md')).toEqual(
'standard/other-note.md'
)
})
it('set the absolute path from the current path with multiple level', () => {
expect(
resolvePath('standard/you/are/here/README.md', './other-note.md')
).toEqual('standard/you/are/here/other-note.md')
})
it('set the absolute path from the current path with a go back in the relative path', () => {
expect(
resolvePath('standard/you/are/here/README.md', '../other-note.md')
).toEqual('standard/you/are/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', '../../other-note.md')
).toEqual('standard/you/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', './../../other-note.md')
).toEqual('standard/you/other-note.md')
expect(
resolvePath('standard/you/are/here/README.md', './../../../other-note.md')
).toEqual('standard/other-note.md')
})
})