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> <template>
<aside class="new-version" v-if="hasNewVersion"> <aside v-if="hasNewVersion" class="new-version">
<button class="button is-primary" @click="reload"> <button class="button is-primary" @click="reload">
new version available new version available
</button> </button>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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