Merge branch 'main' of github.com:lite-note/lite-note into main

This commit is contained in:
2021-05-13 16:27:06 +02:00
24 changed files with 338 additions and 340 deletions

View File

@@ -7,6 +7,8 @@ module.exports = {
'plugin:vue/vue3-essential',
'eslint:recommended',
'plugin:vue/recommended',
'@vue/typescript/recommended',
'@vue/prettier/@typescript-eslint',
'plugin:prettier-vue/recommended'
],
parserOptions: {
@@ -17,7 +19,6 @@ module.exports = {
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/camelcase': 'off',
'vue/no-multiple-template-root': 'off',
'prettier-vue/prettier': [
'error',
{

View File

@@ -155,6 +155,16 @@ $header-height: 40px;
color: var(--font-color);
}
table {
color: var(--font-color);
background-color: var(--background-color);
thead {
th {
color: var(--font-color);
}
}
}
blockquote {
background-color: var(--background-color);
}

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

@@ -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()

View File

@@ -1,33 +1,33 @@
import { computed, ref } from 'vue'
import { confirmMessage } from '@/utils/notif'
import { GithubToken } from '@/modules/user/interfaces/GithubToken'
import { getAccessToken, saveAccessToken } from '@/modules/user/service/signIn'
import { GithubToken } from '@/modules/user/interfaces/GithubToken'
const username = ref<string | null>(null)
const accessToken = ref<string | null>(null)
let init = true
export const useGitHubLogin = () => {
const saveAccessTokenToLocal = async () => {
const response = await getAccessToken()
username.value = response?.username || ''
accessToken.value = response?.token || ''
}
if (init) {
init = false
saveAccessTokenToLocal()
}
const saveCredentials = async (githubToken: GithubToken) => {
const accessToken = await saveAccessToken(githubToken)
const saveCredentials = async (token: GithubToken): Promise<void> => {
const accessToken = await saveAccessToken(token)
await saveAccessTokenToLocal()
confirmMessage(`${accessToken.username} is logged in!`)
}
export const useGitHubLogin = () => {
if (init) {
init = false
saveAccessTokenToLocal()
}
return {
isLogged: !!accessToken.value,
isReady: computed(() => accessToken.value !== null),

View File

@@ -13,7 +13,7 @@ const md = new MarkdownIt({
h4: ['title', 'is-5'],
h5: ['title', 'is-6'],
h6: ['title', 'is-6'],
table: ['table', 'is-striped', 'is-hoverable']
table: ['table', 'is-fullwidth']
})
.use(blockEmbedPlugin, {
youtube: {

View File

@@ -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`
}
}

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

@@ -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 {
@@ -29,7 +28,6 @@ export const useUserRepoStore = defineStore({
async setUserRepo(newUser: string, newRepo: string) {
this.user = newUser
this.repo = newRepo
await refreshToken()
const [readme, files] = await Promise.all([
getMainReadme(newUser, newRepo),
getFiles(newUser, newRepo)

View File

@@ -58,8 +58,6 @@ export const refreshToken = async () => {
| GithubToken
| GithubTokenError
console.log(githubToken)
if ('error' in githubToken) {
return null
}
@@ -105,8 +103,6 @@ export const saveAccessToken = async (githubToken: GithubToken) => {
username: ''
}
console.log(accessToken)
const octokit = new Octokit({
auth: accessToken?.token
})

View File

@@ -1,9 +1,7 @@
<template>
<div class="draft-notes">
<flux-note :user="user" :repo="repo" :content="content" key="draft-notes">
<h3 class="subtitle is-3">
Drafts
</h3>
<flux-note key="draft-notes" :user="user" :repo="repo" :content="content">
<h3 class="subtitle is-3">Drafts</h3>
</flux-note>
</div>
</template>

View File

@@ -1,14 +1,12 @@
<template>
<div class="fleeting-notes">
<flux-note
key="fleeting-notes"
:user="user"
:repo="repo"
:content="content"
key="fleeting-notes"
>
<h3 class="subtitle is-3">
Inbox
</h3>
<h3 class="subtitle is-3">Inbox</h3>
</flux-note>
</div>
</template>

View File

@@ -34,6 +34,9 @@ export default defineComponent({
},
setup(props) {
const { resetStackedNotes } = useQueryStackedNotes()
onMounted(() => {
refreshToken()
})
onMounted(() => {
refreshToken()

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>