🔧 (eslint)
This commit is contained in:
@@ -1,53 +1,53 @@
|
||||
<template>
|
||||
<header class="header-note">
|
||||
<router-link
|
||||
:to="{ name: 'Home' }"
|
||||
class="button is-small is-white back-button"
|
||||
>
|
||||
<img src="@/assets/icons/dark-left-arrow.svg" alt="go back left arrow" />
|
||||
</router-link>
|
||||
<router-link
|
||||
class="special-folder"
|
||||
:to="{ name: 'DraftNotes', params: { user, repo } }"
|
||||
>
|
||||
draft
|
||||
</router-link>
|
||||
<router-link
|
||||
class="special-folder"
|
||||
:to="{ name: 'FleetingNotes', params: { user, repo } }"
|
||||
>
|
||||
inbox
|
||||
</router-link>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'HeaderNote',
|
||||
props: {
|
||||
user: { type: String, required: true },
|
||||
repo: { type: String, required: true }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header-note {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
|
||||
.special-folder {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img {
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<header class="header-note">
|
||||
<router-link
|
||||
:to="{ name: 'Home' }"
|
||||
class="button is-small is-white back-button"
|
||||
>
|
||||
<img src="@/assets/icons/dark-left-arrow.svg" alt="go back left arrow" />
|
||||
</router-link>
|
||||
<router-link
|
||||
class="special-folder"
|
||||
:to="{ name: 'DraftNotes', params: { user, repo } }"
|
||||
>
|
||||
draft
|
||||
</router-link>
|
||||
<router-link
|
||||
class="special-folder"
|
||||
:to="{ name: 'FleetingNotes', params: { user, repo } }"
|
||||
>
|
||||
inbox
|
||||
</router-link>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'HeaderNote',
|
||||
props: {
|
||||
user: { type: String, required: true },
|
||||
repo: { type: String, required: true }
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.header-note {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 10px;
|
||||
|
||||
.special-folder {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
img {
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="column">
|
||||
<p>
|
||||
<router-link :to="{ name: 'RepoList' }" v-if="isLogged"
|
||||
<router-link v-if="isLogged" :to="{ name: 'RepoList' }"
|
||||
>Manage your repos</router-link
|
||||
>
|
||||
</p>
|
||||
@@ -49,17 +49,15 @@
|
||||
|
||||
<form @submit.prevent>
|
||||
<div class="columns is-centered is-vcentered to-user-repo">
|
||||
<div class="column">
|
||||
https://github.com/
|
||||
</div>
|
||||
<div class="column">https://github.com/</div>
|
||||
<div class="columns column is-mobile is-centered is-vcentered">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input
|
||||
v-model="userInput"
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="userInput"
|
||||
placeholder="user"
|
||||
/>
|
||||
</div>
|
||||
@@ -70,9 +68,9 @@
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input
|
||||
v-model="repoInput"
|
||||
class="input"
|
||||
type="text"
|
||||
v-model="repoInput"
|
||||
placeholder="repo"
|
||||
/>
|
||||
</div>
|
||||
@@ -109,8 +107,8 @@ import { useFavoriteRepos } from '@/modules/repo/hooks/useFavoriteRepos.hook'
|
||||
import SignInGithub from '@/components/SignInGithub.vue'
|
||||
|
||||
export default defineComponent({
|
||||
components: { SignInGithub },
|
||||
name: 'WelcomeWord',
|
||||
components: { SignInGithub },
|
||||
setup() {
|
||||
const { isLogged, username } = useGitHubLogin()
|
||||
const { savedFavoriteRepos } = useFavoriteRepos()
|
||||
|
||||
@@ -100,8 +100,9 @@ export const useNote = (containerClass: string) => {
|
||||
if (isMobile.value) {
|
||||
container.style.height = `${(stackedNotes.value.length + 1) * 100}vh`
|
||||
} else {
|
||||
container.style.width = `${NOTE_WIDTH *
|
||||
(stackedNotes.value.length + 1)}px`
|
||||
container.style.width = `${
|
||||
NOTE_WIDTH * (stackedNotes.value.length + 1)
|
||||
}px`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
import { data } from '@/data/data'
|
||||
import { DataType } from '@/data/DataType.enum'
|
||||
import { Note } from '@/modules/note/models/Note'
|
||||
import { useAsyncState } from '@vueuse/core'
|
||||
import { computed } from 'vue'
|
||||
|
||||
export const useNoteCache = (sha: string) => {
|
||||
const noteId = computed(() => data.generateId(DataType.Note, sha))
|
||||
const getCachedNote = async () => data.get<DataType.Note, Note>(noteId.value)
|
||||
|
||||
const cachedNote = useAsyncState(getCachedNote, null)
|
||||
|
||||
const saveCacheNote = async (content: string) => {
|
||||
const newNote: Note = {
|
||||
_id: noteId.value,
|
||||
$type: DataType.Note,
|
||||
content
|
||||
}
|
||||
|
||||
await data.update(newNote)
|
||||
|
||||
await cachedNote.execute()
|
||||
}
|
||||
|
||||
return {
|
||||
cachedNote: cachedNote.state,
|
||||
isReady: cachedNote.isReady,
|
||||
getCachedNote,
|
||||
saveCacheNote
|
||||
}
|
||||
}
|
||||
import { data } from '@/data/data'
|
||||
import { DataType } from '@/data/DataType.enum'
|
||||
import { Note } from '@/modules/note/models/Note'
|
||||
import { useAsyncState } from '@vueuse/core'
|
||||
import { computed } from 'vue'
|
||||
|
||||
export const useNoteCache = (sha: string) => {
|
||||
const noteId = computed(() => data.generateId(DataType.Note, sha))
|
||||
const getCachedNote = async () => data.get<DataType.Note, Note>(noteId.value)
|
||||
|
||||
const cachedNote = useAsyncState(getCachedNote, null)
|
||||
|
||||
const saveCacheNote = async (content: string) => {
|
||||
const newNote: Note = {
|
||||
_id: noteId.value,
|
||||
$type: DataType.Note,
|
||||
content
|
||||
}
|
||||
|
||||
await data.update(newNote)
|
||||
|
||||
await cachedNote.execute()
|
||||
}
|
||||
|
||||
return {
|
||||
cachedNote: cachedNote.state,
|
||||
isReady: cachedNote.isReady,
|
||||
getCachedNote,
|
||||
saveCacheNote
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
const sanitizePath = (path: string) => {
|
||||
if (path.startsWith('./')) {
|
||||
return decodeURIComponent(path.replace('./', ''))
|
||||
}
|
||||
return decodeURIComponent(path)
|
||||
}
|
||||
|
||||
const removeNoteFilename = (pathNote: string) => {
|
||||
const path = pathNote.split('/')
|
||||
path.pop()
|
||||
|
||||
return sanitizePath(path.join('/'))
|
||||
}
|
||||
|
||||
export const resolvePath = (
|
||||
currentAbsolutePathNote: string,
|
||||
pathToResolve: string
|
||||
) => {
|
||||
let currentAbsolutePath = removeNoteFilename(currentAbsolutePathNote)
|
||||
pathToResolve = sanitizePath(pathToResolve)
|
||||
|
||||
while (pathToResolve.startsWith('../')) {
|
||||
const adjustedAbsolutePath = currentAbsolutePath.split('/')
|
||||
adjustedAbsolutePath.pop()
|
||||
currentAbsolutePath = adjustedAbsolutePath.join('/')
|
||||
pathToResolve = pathToResolve.replace('../', '')
|
||||
}
|
||||
|
||||
return currentAbsolutePath
|
||||
? `${currentAbsolutePath}/${pathToResolve}`
|
||||
: pathToResolve
|
||||
}
|
||||
const sanitizePath = (path: string) => {
|
||||
if (path.startsWith('./')) {
|
||||
return decodeURIComponent(path.replace('./', ''))
|
||||
}
|
||||
return decodeURIComponent(path)
|
||||
}
|
||||
|
||||
const removeNoteFilename = (pathNote: string) => {
|
||||
const path = pathNote.split('/')
|
||||
path.pop()
|
||||
|
||||
return sanitizePath(path.join('/'))
|
||||
}
|
||||
|
||||
export const resolvePath = (
|
||||
currentAbsolutePathNote: string,
|
||||
pathToResolve: string
|
||||
) => {
|
||||
let currentAbsolutePath = removeNoteFilename(currentAbsolutePathNote)
|
||||
pathToResolve = sanitizePath(pathToResolve)
|
||||
|
||||
while (pathToResolve.startsWith('../')) {
|
||||
const adjustedAbsolutePath = currentAbsolutePath.split('/')
|
||||
adjustedAbsolutePath.pop()
|
||||
currentAbsolutePath = adjustedAbsolutePath.join('/')
|
||||
pathToResolve = pathToResolve.replace('../', '')
|
||||
}
|
||||
|
||||
return currentAbsolutePath
|
||||
? `${currentAbsolutePath}/${pathToResolve}`
|
||||
: pathToResolve
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user