Merge branch 'main' of github.com:lite-note/lite-note into main
This commit is contained in:
@@ -7,6 +7,8 @@ module.exports = {
|
|||||||
'plugin:vue/vue3-essential',
|
'plugin:vue/vue3-essential',
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:vue/recommended',
|
'plugin:vue/recommended',
|
||||||
|
'@vue/typescript/recommended',
|
||||||
|
'@vue/prettier/@typescript-eslint',
|
||||||
'plugin:prettier-vue/recommended'
|
'plugin:prettier-vue/recommended'
|
||||||
],
|
],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@@ -17,7 +19,6 @@ module.exports = {
|
|||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
'@typescript-eslint/camelcase': 'off',
|
'@typescript-eslint/camelcase': 'off',
|
||||||
'vue/no-multiple-template-root': 'off',
|
|
||||||
'prettier-vue/prettier': [
|
'prettier-vue/prettier': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -155,6 +155,16 @@ $header-height: 40px;
|
|||||||
color: var(--font-color);
|
color: var(--font-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
color: var(--font-color);
|
||||||
|
background-color: var(--background-color);
|
||||||
|
thead {
|
||||||
|
th {
|
||||||
|
color: var(--font-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
blockquote {
|
blockquote {
|
||||||
background-color: var(--background-color);
|
background-color: var(--background-color);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<p>
|
<p>
|
||||||
<router-link :to="{ name: 'RepoList' }" v-if="isLogged"
|
<router-link v-if="isLogged" :to="{ name: 'RepoList' }"
|
||||||
>Manage your repos</router-link
|
>Manage your repos</router-link
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
@@ -49,17 +49,15 @@
|
|||||||
|
|
||||||
<form @submit.prevent>
|
<form @submit.prevent>
|
||||||
<div class="columns is-centered is-vcentered to-user-repo">
|
<div class="columns is-centered is-vcentered to-user-repo">
|
||||||
<div class="column">
|
<div class="column">https://github.com/</div>
|
||||||
https://github.com/
|
|
||||||
</div>
|
|
||||||
<div class="columns column is-mobile is-centered is-vcentered">
|
<div class="columns column is-mobile is-centered is-vcentered">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input
|
<input
|
||||||
|
v-model="userInput"
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
v-model="userInput"
|
|
||||||
placeholder="user"
|
placeholder="user"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -70,9 +68,9 @@
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input
|
<input
|
||||||
|
v-model="repoInput"
|
||||||
class="input"
|
class="input"
|
||||||
type="text"
|
type="text"
|
||||||
v-model="repoInput"
|
|
||||||
placeholder="repo"
|
placeholder="repo"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,8 +107,8 @@ import { useFavoriteRepos } from '@/modules/repo/hooks/useFavoriteRepos.hook'
|
|||||||
import SignInGithub from '@/components/SignInGithub.vue'
|
import SignInGithub from '@/components/SignInGithub.vue'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { SignInGithub },
|
|
||||||
name: 'WelcomeWord',
|
name: 'WelcomeWord',
|
||||||
|
components: { SignInGithub },
|
||||||
setup() {
|
setup() {
|
||||||
const { isLogged, username } = useGitHubLogin()
|
const { isLogged, username } = useGitHubLogin()
|
||||||
const { savedFavoriteRepos } = useFavoriteRepos()
|
const { savedFavoriteRepos } = useFavoriteRepos()
|
||||||
|
|||||||
@@ -1,33 +1,33 @@
|
|||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
import { confirmMessage } from '@/utils/notif'
|
import { confirmMessage } from '@/utils/notif'
|
||||||
import { GithubToken } from '@/modules/user/interfaces/GithubToken'
|
|
||||||
import { getAccessToken, saveAccessToken } from '@/modules/user/service/signIn'
|
import { getAccessToken, saveAccessToken } from '@/modules/user/service/signIn'
|
||||||
|
import { GithubToken } from '@/modules/user/interfaces/GithubToken'
|
||||||
|
|
||||||
const username = ref<string | null>(null)
|
const username = ref<string | null>(null)
|
||||||
const accessToken = ref<string | null>(null)
|
const accessToken = ref<string | null>(null)
|
||||||
|
|
||||||
let init = true
|
let init = true
|
||||||
|
|
||||||
export const useGitHubLogin = () => {
|
|
||||||
const saveAccessTokenToLocal = async () => {
|
const saveAccessTokenToLocal = async () => {
|
||||||
const response = await getAccessToken()
|
const response = await getAccessToken()
|
||||||
username.value = response?.username || ''
|
username.value = response?.username || ''
|
||||||
accessToken.value = response?.token || ''
|
accessToken.value = response?.token || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
if (init) {
|
const saveCredentials = async (token: GithubToken): Promise<void> => {
|
||||||
init = false
|
const accessToken = await saveAccessToken(token)
|
||||||
saveAccessTokenToLocal()
|
|
||||||
}
|
|
||||||
|
|
||||||
const saveCredentials = async (githubToken: GithubToken) => {
|
|
||||||
const accessToken = await saveAccessToken(githubToken)
|
|
||||||
|
|
||||||
await saveAccessTokenToLocal()
|
await saveAccessTokenToLocal()
|
||||||
confirmMessage(`${accessToken.username} is logged in!`)
|
confirmMessage(`${accessToken.username} is logged in!`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const useGitHubLogin = () => {
|
||||||
|
if (init) {
|
||||||
|
init = false
|
||||||
|
saveAccessTokenToLocal()
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isLogged: !!accessToken.value,
|
isLogged: !!accessToken.value,
|
||||||
isReady: computed(() => accessToken.value !== null),
|
isReady: computed(() => accessToken.value !== null),
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const md = new MarkdownIt({
|
|||||||
h4: ['title', 'is-5'],
|
h4: ['title', 'is-5'],
|
||||||
h5: ['title', 'is-6'],
|
h5: ['title', 'is-6'],
|
||||||
h6: ['title', 'is-6'],
|
h6: ['title', 'is-6'],
|
||||||
table: ['table', 'is-striped', 'is-hoverable']
|
table: ['table', 'is-fullwidth']
|
||||||
})
|
})
|
||||||
.use(blockEmbedPlugin, {
|
.use(blockEmbedPlugin, {
|
||||||
youtube: {
|
youtube: {
|
||||||
|
|||||||
@@ -100,8 +100,9 @@ export const useNote = (containerClass: string) => {
|
|||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
container.style.height = `${(stackedNotes.value.length + 1) * 100}vh`
|
container.style.height = `${(stackedNotes.value.length + 1) * 100}vh`
|
||||||
} else {
|
} else {
|
||||||
container.style.width = `${NOTE_WIDTH *
|
container.style.width = `${
|
||||||
(stackedNotes.value.length + 1)}px`
|
NOTE_WIDTH * (stackedNotes.value.length + 1)
|
||||||
|
}px`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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)`
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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')
|
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -29,7 +28,6 @@ export const useUserRepoStore = defineStore({
|
|||||||
async setUserRepo(newUser: string, newRepo: string) {
|
async setUserRepo(newUser: string, newRepo: string) {
|
||||||
this.user = newUser
|
this.user = newUser
|
||||||
this.repo = newRepo
|
this.repo = newRepo
|
||||||
await refreshToken()
|
|
||||||
const [readme, files] = await Promise.all([
|
const [readme, files] = await Promise.all([
|
||||||
getMainReadme(newUser, newRepo),
|
getMainReadme(newUser, newRepo),
|
||||||
getFiles(newUser, newRepo)
|
getFiles(newUser, newRepo)
|
||||||
|
|||||||
@@ -58,8 +58,6 @@ export const refreshToken = async () => {
|
|||||||
| GithubToken
|
| GithubToken
|
||||||
| GithubTokenError
|
| GithubTokenError
|
||||||
|
|
||||||
console.log(githubToken)
|
|
||||||
|
|
||||||
if ('error' in githubToken) {
|
if ('error' in githubToken) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@@ -105,8 +103,6 @@ export const saveAccessToken = async (githubToken: GithubToken) => {
|
|||||||
username: ''
|
username: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(accessToken)
|
|
||||||
|
|
||||||
const octokit = new Octokit({
|
const octokit = new Octokit({
|
||||||
auth: accessToken?.token
|
auth: accessToken?.token
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="draft-notes">
|
<div class="draft-notes">
|
||||||
<flux-note :user="user" :repo="repo" :content="content" key="draft-notes">
|
<flux-note key="draft-notes" :user="user" :repo="repo" :content="content">
|
||||||
<h3 class="subtitle is-3">
|
<h3 class="subtitle is-3">Drafts</h3>
|
||||||
Drafts
|
|
||||||
</h3>
|
|
||||||
</flux-note>
|
</flux-note>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="fleeting-notes">
|
<div class="fleeting-notes">
|
||||||
<flux-note
|
<flux-note
|
||||||
|
key="fleeting-notes"
|
||||||
:user="user"
|
:user="user"
|
||||||
:repo="repo"
|
:repo="repo"
|
||||||
:content="content"
|
:content="content"
|
||||||
key="fleeting-notes"
|
|
||||||
>
|
>
|
||||||
<h3 class="subtitle is-3">
|
<h3 class="subtitle is-3">Inbox</h3>
|
||||||
Inbox
|
|
||||||
</h3>
|
|
||||||
</flux-note>
|
</flux-note>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { resetStackedNotes } = useQueryStackedNotes()
|
const { resetStackedNotes } = useQueryStackedNotes()
|
||||||
|
onMounted(() => {
|
||||||
|
refreshToken()
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
refreshToken()
|
refreshToken()
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user