diff --git a/package.json b/package.json index 8c62da5..91f6393 100755 --- a/package.json +++ b/package.json @@ -10,20 +10,20 @@ "dependencies": { "@nuxt/content": "^1.14.0", "@nuxtjs/axios": "^5.13.6", - "@nuxtjs/composition-api": "^0.26.0", + "@nuxtjs/composition-api": "^0.27.0", "@nuxtjs/dotenv": "^1.4.1", "@nuxtjs/i18n": "^7.0.2", "@nuxtjs/proxy": "^2.1.0", "@nuxtjs/redirect-module": "^0.3.1", "@nuxtjs/robots": "^2.5.0", - "@nuxtjs/sentry": "^5.1.0", + "@nuxtjs/sentry": "^5.1.2", "@nuxtjs/sitemap": "^2.4.0", "@nuxtjs/universal-storage": "^0.5.9", "axios": "^0.21.1", - "core-js": "^3.16.1", + "core-js": "^3.16.2", "nuxt": "^2.15.8", "prism-themes": "^1.8.0", - "sass": "^1.37.5" + "sass": "^1.38.0" }, "devDependencies": { "@nuxt/types": "^2.15.8", diff --git a/settings/Arch.ts b/settings/Arch.ts index 58c43d4..7d6c692 100755 --- a/settings/Arch.ts +++ b/settings/Arch.ts @@ -41,4 +41,8 @@ const proxy = { } } -export default { srcDir, dir, build, pageTransition, target, server, buildDir, components, ssr, proxy } +const router = { + middleware: 'maintenance' +} + +export default { router, srcDir, dir, build, pageTransition, target, server, buildDir, components, ssr, proxy } diff --git a/src/assets/images/maintenance.png b/src/assets/images/maintenance.png new file mode 100644 index 0000000..6c46e5b Binary files /dev/null and b/src/assets/images/maintenance.png differ diff --git a/src/assets/images/posts/post-1.png b/src/assets/images/posts/post-1.png deleted file mode 100755 index 7d6b3c9..0000000 Binary files a/src/assets/images/posts/post-1.png and /dev/null differ diff --git a/src/assets/images/posts/post-2.png b/src/assets/images/posts/post-2.png deleted file mode 100755 index 20faab6..0000000 Binary files a/src/assets/images/posts/post-2.png and /dev/null differ diff --git a/src/assets/images/projects/ares.png b/src/assets/images/projects/ares.png deleted file mode 100755 index 6500fcd..0000000 Binary files a/src/assets/images/projects/ares.png and /dev/null differ diff --git a/src/assets/images/projects/athena.png b/src/assets/images/projects/athena.png deleted file mode 100755 index 563f7fb..0000000 Binary files a/src/assets/images/projects/athena.png and /dev/null differ diff --git a/src/assets/images/projects/erisium.png b/src/assets/images/projects/erisium.png deleted file mode 100755 index 9a01de3..0000000 Binary files a/src/assets/images/projects/erisium.png and /dev/null differ diff --git a/src/assets/images/projects/linkyjs.png b/src/assets/images/projects/linkyjs.png deleted file mode 100755 index 0fa9ae3..0000000 Binary files a/src/assets/images/projects/linkyjs.png and /dev/null differ diff --git a/src/components/Announcement.vue b/src/components/Announcement.vue index d076915..1874062 100644 --- a/src/components/Announcement.vue +++ b/src/components/Announcement.vue @@ -26,7 +26,7 @@ export default { const {$axios, $sentry, app} = useContext() const announce = useAsync(async () => { - const response = await $axios.get('/api/announces', { + const response = await $axios.get('/api/announce', { headers: { 'Authorization': `Bearer ${process.env.API_TOKEN}` } diff --git a/src/components/ExperiencesAbout.vue b/src/components/ExperiencesAbout.vue index 715462d..cdd8cfd 100755 --- a/src/components/ExperiencesAbout.vue +++ b/src/components/ExperiencesAbout.vue @@ -31,7 +31,9 @@ export default defineComponent({ } }) if (response.status === 200) { - return response.data.experiences + return response.data.experiences.sort((a, b) => { + return a.end_date === 'Today' ? -1 : a.end_date.split('-')[1] > b.end_date.split('-')[1] ? -1 : a.end_date.split('-')[0] > b.end_date.split('-')[0] ? 0 : 1 + }) } else { app.error({statusCode: 500}) $sentry.captureEvent(response.data) diff --git a/src/components/Footer.vue b/src/components/Footer.vue index beb7a5e..1501fd3 100755 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -29,7 +29,7 @@ - + diff --git a/src/components/FormationsAbout.vue b/src/components/FormationsAbout.vue index 42a2da1..dfaaf85 100755 --- a/src/components/FormationsAbout.vue +++ b/src/components/FormationsAbout.vue @@ -31,7 +31,9 @@ export default defineComponent({ } }) if (response.status === 200) { - return response.data.formations + return response.data.formations.sort((a, b) => { + return a.end_date === 'Today' ? -1 : a.end_date.split('-')[1] > b.end_date.split('-')[1] ? -1 : a.end_date.split('-')[0] > b.end_date.split('-')[0] ? 0 : 1 + }) } else { app.error({statusCode: 500}) $sentry.captureEvent(response.data) diff --git a/src/components/Header.vue b/src/components/Header.vue index 8f19544..0fef809 100755 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -23,7 +23,7 @@ - + @@ -83,6 +83,7 @@ export default defineComponent({ window.location.reload() } }) + const isFrench = computed(() => i18n.locale === 'fr') const store = useStore() const route = computed(() => store.state.route) @@ -97,7 +98,8 @@ export default defineComponent({ changeColorMode, updateScroll, changeLanguage, - isWindow + isWindow, + isFrench } } }) diff --git a/src/components/LanguagesAbout.vue b/src/components/LanguagesAbout.vue index 5acc150..3819af5 100755 --- a/src/components/LanguagesAbout.vue +++ b/src/components/LanguagesAbout.vue @@ -2,7 +2,7 @@ {{ $t('about.title.languages') }} - + @@ -21,6 +21,6 @@ diff --git a/src/components/MobileNavbar.vue b/src/components/MobileNavbar.vue index 3176f32..49a4162 100644 --- a/src/components/MobileNavbar.vue +++ b/src/components/MobileNavbar.vue @@ -51,22 +51,22 @@ export default defineComponent({ const toggleMenu = () => { store.commit('TOGGLE_OPENED', !store.state.opened) if (store.state.opened) { + document.getElementById('slider')!.style.maxHeight = window.screen.height + 'px' setTimeout(() => document.getElementById('nav')!.classList.add('z-50'), 300) } else { document.getElementById('nav')!.classList.remove('z-50') setTimeout(() => { document.getElementById('slider')!.style.maxHeight = 'none' - }, 100) + }, 500) } } const $router = useRouter() $router.afterEach(() => { store.commit('TOGGLE_OPENED', false) - document.getElementById('nav')!.classList.remove('z-50') setTimeout(() => { document.getElementById('slider')!.style.maxHeight = 'none' - }, 100) + }, 600) }) return { diff --git a/src/components/Post.vue b/src/components/Post.vue index 68d76c7..80a4646 100755 --- a/src/components/Post.vue +++ b/src/components/Post.vue @@ -2,7 +2,7 @@ + :style="{ backgroundImage: `url(https://athena.arthurdanjou.fr/files/${cover})` }"> @@ -11,8 +11,8 @@ - {{ title }} - {{ description }} + {{ $t(title) }} + {{ $t(description) }} {{ formatDate }} @@ -69,8 +69,6 @@ export default defineComponent({ } }, setup(props: PostProps) { - const getCover = computed(() => require(`~/assets/images/posts/${props.cover}`)) - const { i18n } = useContext() const formatDate = computed(() => { const [first, second, third]: any = props.date.split('-') @@ -78,7 +76,6 @@ export default defineComponent({ }) return { - getCover, formatDate } } diff --git a/src/components/PostsHome.vue b/src/components/PostsHome.vue index b89f514..4fed472 100755 --- a/src/components/PostsHome.vue +++ b/src/components/PostsHome.vue @@ -12,9 +12,9 @@ { - return $content(`articles/${i18n.locale}`) - .sortBy('date', 'asc') - .limit(3) - .fetch() - .catch((error) => { - $sentry.captureEvent(error) - }) - }, 'posts') + const posts = useAsync(async () => { + const response = await $axios.get('/api/posts', { + headers: { + 'Authorization': `Bearer ${process.env.API_TOKEN}` + } + }) + if (response.status === 200) { + return response.data.posts + } else { + app.error({statusCode: 500}) + $sentry.captureEvent(response.data) + } + }, 'posts_home') return { posts diff --git a/src/components/PresentationAbout.vue b/src/components/PresentationAbout.vue index d9e56d6..691a258 100755 --- a/src/components/PresentationAbout.vue +++ b/src/components/PresentationAbout.vue @@ -4,7 +4,7 @@ - {{ $t('about.banner.hello') }} Arthur DANJOU 👋. + {{ $t('about.banner.hello') }} Arthur DANJOU 👋. {{ $t('about.banner.1')}} {{ $t('about.banner.2') }} {{ $t('about.banner.3') }} diff --git a/src/components/Project.vue b/src/components/Project.vue index 59d2d6a..bf05da1 100755 --- a/src/components/Project.vue +++ b/src/components/Project.vue @@ -1,14 +1,14 @@ - - + + - + - + {{ title }} @@ -20,15 +20,7 @@ diff --git a/src/components/ProjectsHome.vue b/src/components/ProjectsHome.vue index e6a39d6..1716699 100755 --- a/src/components/ProjectsHome.vue +++ b/src/components/ProjectsHome.vue @@ -9,12 +9,12 @@ {{ $t('projects.description') }} - + @@ -34,16 +34,21 @@ import {Project} from "~/types/types"; export default defineComponent({ name: "ProjectsHome", setup() { - const { $content, $sentry } = useContext() + const { $axios, app, $sentry } = useContext() - const projects = useAsync(() => { - return $content(`projects`) - .limit(3) - .fetch() - .catch((error) => { - $sentry.captureEvent(error) - }) - }, 'projects') + const projects = useAsync(async () => { + const response = await $axios.get('/api/projects', { + headers: { + 'Authorization': `Bearer ${process.env.API_TOKEN}` + } + }) + if (response.status === 200) { + return response.data.projects.slice(0, 3) + } else { + $sentry.captureEvent(response.data) + app.error({statusCode: 500}) + } + }, 'projects_home') return { projects diff --git a/src/components/SideMenu.vue b/src/components/SideMenu.vue index 328a45b..0ca6222 100644 --- a/src/components/SideMenu.vue +++ b/src/components/SideMenu.vue @@ -17,7 +17,7 @@ - + @@ -90,7 +90,7 @@ - + @@ -130,13 +130,15 @@ export default defineComponent({ } }) + const isFrench = computed(() => i18n.locale === 'fr') + const store = useStore() const closeMenu = () => { store.commit('TOGGLE_OPENED', false) document.getElementById('nav')!.classList.remove('z-50') setTimeout(() => { document.getElementById('slider')!.style.maxHeight = 'none' - }, 100) + }, 500) } const route = computed(() => store.state.route) @@ -150,7 +152,8 @@ export default defineComponent({ changeLanguage, closeMenu, opened: computed(() => store.state.opened), - isWindow + isWindow, + isFrench } } }) diff --git a/src/components/icons/LanguageIcon.vue b/src/components/icons/LanguageIcon.vue new file mode 100644 index 0000000..98fcc17 --- /dev/null +++ b/src/components/icons/LanguageIcon.vue @@ -0,0 +1,14 @@ + + + + + + + diff --git a/src/components/icons/TranslateIcon.vue b/src/components/icons/TranslateIcon.vue index 9cf015e..45c6d43 100644 --- a/src/components/icons/TranslateIcon.vue +++ b/src/components/icons/TranslateIcon.vue @@ -1,14 +1,40 @@ - + + fill="#00247D" + d="M0 9.059V13h5.628zM4.664 31H13v-5.837zM23 25.164V31h8.335zM0 23v3.941L5.63 23zM31.337 5H23v5.837zM36 26.942V23h-5.631zM36 13V9.059L30.371 13zM13 5H4.664L13 10.837z" /> + + + + + + + + + diff --git a/src/content/articles/en/how-i-start.md b/src/content/en/how-i-start.md similarity index 94% rename from src/content/articles/en/how-i-start.md rename to src/content/en/how-i-start.md index 252ee8d..3419056 100755 --- a/src/content/articles/en/how-i-start.md +++ b/src/content/en/how-i-start.md @@ -1,11 +1,5 @@ --- slug: how-i-start -title: How did I start development? -description: How did I start development? What am I capable of mastering? What will my future be? -reading_time: 5 -tags: ["tags.life"] -cover: post-2.png -date: 07-01-2021 --- ## Presentation diff --git a/src/content/articles/en/new-version-new-website.md b/src/content/en/new-version-new-website.md similarity index 92% rename from src/content/articles/en/new-version-new-website.md rename to src/content/en/new-version-new-website.md index 6e9a426..cb0994f 100755 --- a/src/content/articles/en/new-version-new-website.md +++ b/src/content/en/new-version-new-website.md @@ -1,11 +1,5 @@ --- slug: new-version-new-website -title: Opening of the new version of my site! -description: After long months of development, here is version 2 of my site! -reading_time: 2 -tags: ["tags.dev"] -cover: post-1.png -date: 13-12-2020 --- ## Presentation diff --git a/src/content/articles/fr/how-i-start.md b/src/content/fr/how-i-start.md similarity index 94% rename from src/content/articles/fr/how-i-start.md rename to src/content/fr/how-i-start.md index 8774d73..8938fb8 100755 --- a/src/content/articles/fr/how-i-start.md +++ b/src/content/fr/how-i-start.md @@ -1,11 +1,5 @@ --- slug: how-i-start -title: Comment ai-je commencé le développement ? -description: Comment ai-je commencé le développement ? Que suis-je capable de maitriser ? Quel sera mon futur ? -reading_time: 5 -tags: ["tags.life"] -cover: post-2.png -date: 07-01-2021 --- ## Présentation diff --git a/src/content/articles/fr/new-version-new-website.md b/src/content/fr/new-version-new-website.md similarity index 92% rename from src/content/articles/fr/new-version-new-website.md rename to src/content/fr/new-version-new-website.md index 86eaa40..efd5308 100755 --- a/src/content/articles/fr/new-version-new-website.md +++ b/src/content/fr/new-version-new-website.md @@ -1,11 +1,5 @@ --- slug: new-version-new-website -title: Ouverture de la nouvelle version de mon site ! -description: Après de long mois de développement, voici la version 2 de mon site ! -reading_time: 2 -tags: ["tags.dev"] -cover: post-1.png -date: 13-12-2020 --- ## Présentation diff --git a/src/content/projects.json b/src/content/projects.json deleted file mode 100755 index 522be4f..0000000 --- a/src/content/projects.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "slug": "erisium", - "title": "Erisium", - "description": "works.erisium", - "url": "https://erisium.com", - "cover": "erisium.png", - "tags": ["tags.mc"] - }, - { - "slug": "ares", - "title": "Ares", - "description": "works.ares", - "url": "https://arthurdanjou.fr", - "cover": "ares.png", - "tags": ["tags.web"] - }, - { - "slug": "athena", - "title": "Athena", - "description": "works.athena", - "url": "https://athena.arthurdanjou.fr", - "cover": "athena.png", - "tags": ["tags.api"] - }, - { - "slug": "linkyjs", - "title": "LinkyJs", - "description": "works.linkyjs", - "url": "https://github.com/linkyjs/", - "cover": "linkyjs.png", - "tags": ["tags.software", "tags.opensource"] - } -] diff --git a/src/content/tags.json b/src/content/tags.json deleted file mode 100755 index b2d78fd..0000000 --- a/src/content/tags.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "slug": "tags.dev" - }, - { - "slug": "tags.tech" - }, - { - "slug": "tags.life" - } -] diff --git a/src/layouts/default.vue b/src/layouts/default.vue index 68da2b6..405b012 100755 --- a/src/layouts/default.vue +++ b/src/layouts/default.vue @@ -6,7 +6,6 @@ id="slider" class="xl:static shadow-2xl transition-all duration-500 overflow-hidden xl:overflow-visible" :class="{'transform scale-90 md:scale-70 lg:scale-60 xl:scale-100 rounded-lg xl:rounded-none translate-x-10/12 sm:translate-x-4/12 lg:translate-x-3/12 xl:translate-x-0': opened}" - :style="`max-height: ${height}px`" :tabindex="opened ? -1 : 0" > { store.commit('TOGGLE_OPENED', false) document.getElementById('nav')!.classList.remove('z-50') + setTimeout(() => { + document.getElementById('slider')!.style.maxHeight = 'none' + }, 500) } - const height = ref(0) - onMounted(() => { - height.value = window.screen.height - }) - return { opened: computed(() => store.state.opened), closeMenu, - height, } } } diff --git a/src/layouts/maintenance.vue b/src/layouts/maintenance.vue new file mode 100644 index 0000000..324145a --- /dev/null +++ b/src/layouts/maintenance.vue @@ -0,0 +1,9 @@ + + + + + diff --git a/src/locales/en-EN.ts b/src/locales/en-EN.ts index ae4faea..0022f26 100755 --- a/src/locales/en-EN.ts +++ b/src/locales/en-EN.ts @@ -47,7 +47,7 @@ const translations = { }, footer: { - description: 'Développeur Web et Logiciel, mais également étudiant en Mathématiques et en Physique. Je développe des sites internet', + description: "Web and Software Developer, but also student in Mathematics and Physics 🎓. I live in Paris 🇫🇷. I love to create more or less useful applications and software 🛍. I use modern technologies to get the best possible result ✨ I also adore contributing to all types of Open-Source projects 🧪", links: 'Quick links', credits: 'Developed with', credits_separator: 'and', @@ -115,7 +115,7 @@ const translations = { 1: 'I am a young creative developer who loves to tinker and touch everything! I am very interested in new technologies, development and IT.', 2: 'I love sharing my knowledge and helping others through lives on Twitchs, technical articles on my blog, open-source projects or by reviewing community code. As long as I share my passions, I will continue to do this.', 3: 'I am able to quickly learn new technologies to meet the needs of different projects. I often identify the need for new systems or tools to improve workflow efficiency. I am always motivated by a challenge and like to be well organized to produce consistent results.', - 4: 'En parallèle du développement, je suis étudiant en Mathématiques et en Physique dans la faculté des Sciences Paris-Saclay. De plus, je suis un grand fan de moto.' + 4: 'In parallel with the development, I am a student in Mathematics and Physics in the Paris-Saclay Faculty of Sciences. In addition, I am a big fan of motorcycles.' }, title: { skills: 'Skills', @@ -252,7 +252,14 @@ const translations = { linkyjs: 'LinkyJS is my custom and Open-Source url shortener' }, - loading: 'Loading...' + loading: 'Loading...', + + maintenance: { + back_soon: "We'll be back soon...", + title: 'Website under maintenance !', + progress: "To follow the progress: ", + separator: 'or' + } } export default async function () { diff --git a/src/locales/fr-FR.ts b/src/locales/fr-FR.ts index 6000dd6..cb60532 100755 --- a/src/locales/fr-FR.ts +++ b/src/locales/fr-FR.ts @@ -47,7 +47,7 @@ const translations = { }, footer: { - description: 'Développeur Web et Logiciel, mais également étudiant en Mathématiques et en Physique. Je développe des sites internet', + description: "Développeur Web et Logiciel, mais aussi étudiant en Mathématiques et Physique 🎓. J'habite à Paris 🇫🇷. J'adore créer des applications et des logiciels plus ou moins utiles 🛍. J'utilise les technologies modernes pour obtenir le meilleur résultat possible ✨ J'adore également contribuer à tous types de projets Open-Source 🧪", links: 'Liens rapides', credits: 'Développé avec', credits_separator: 'et', @@ -252,7 +252,14 @@ const translations = { linkyjs: "LinkyJS est mon raccourcisseur d'url personnalisé et Open-Source." }, - loading: 'Chargement...' + loading: 'Chargement...', + + maintenance: { + back_soon: "Nous serons de retour bientôt...", + title: 'Site en maintenance !', + progress: "Pour suivre l'avancée : ", + separator: 'ou' + } } export default async function () { diff --git a/src/middlewares/maintenance.ts b/src/middlewares/maintenance.ts new file mode 100644 index 0000000..c3b5392 --- /dev/null +++ b/src/middlewares/maintenance.ts @@ -0,0 +1,19 @@ +import {Context} from "@nuxt/types"; + +export default async function ({redirect, route, $axios}: Context) { + let isMaintenance = true + const response = await $axios.get('/api/maintenance', { + headers: { + 'Authorization': `Bearer ${process.env.API_TOKEN}` + } + }) + if (response.status === 200) { + isMaintenance = response.data.maintenance.active === 1 + } + if(isMaintenance){ + return redirect('/maintenance') + } + if(!isMaintenance && route.path === '/maintenance'){ + return redirect('/') + } +} diff --git a/src/pages/blog/_slug.vue b/src/pages/blog/_slug.vue index 77e1e63..b2ece92 100755 --- a/src/pages/blog/_slug.vue +++ b/src/pages/blog/_slug.vue @@ -1,6 +1,7 @@ - + + {{ slug }} @@ -14,10 +15,10 @@ - {{ post.title }} + {{ $t(postData.title.code) }} - {{ post.description }} + {{ $t(postData.description.code) }} @@ -26,16 +27,16 @@ {{ $t('blog.read.time') }} - {{ post.reading_time }} min + {{ postData.reading_time }} min - Tags + Tags {{ formatTags }} - + - {{ likes }} + {{ getLikes }} @@ -63,7 +64,7 @@ @@ -119,7 +120,7 @@ export default defineComponent({ const slug = computed(() => route.value.params.slug) const post = useStatic((slug) => { - return $content(`articles/${i18n.locale}`, slug) + return $content(i18n.locale, slug) .fetch() .catch((error) => { app.error({statusCode: 404, message: "Post not found"}) @@ -127,31 +128,34 @@ export default defineComponent({ }) as Promise }, slug, 'post') - title.value = post.value?.title ? `Blog - Arthur Danjou - ${post.value!.title}` : 'Loading title...' - - watch(post, () => { - title.value = post.value?.title ? `Blog - Arthur Danjou - ${post.value!.title}` : 'Loading title...' - }) - const liked = ref($storage.getCookie(`${slug.value}`) !== undefined) + const likes = ref(0) + const getLikes = computed(() => likes.value) - const likes = useAsync(async () => { - const response = await $axios.get(`/api/posts/${slug.value}`, { + const postData = useAsync(async () => { + const response = await $axios.get(`/api/posts/${slug.value}/data`, { headers: { 'Authorization': `Bearer ${process.env.API_TOKEN}` } }) if (response.status === 200) { - return response.data.likes + likes.value = response.data.post.likes + title.value = `Blog - Arthur Danjou - ${i18n.t(response.data.post.title.code)}` + return response.data.post } else { $sentry.captureEvent(response.data) app.error({statusCode: 500}) } - }, 'likes') + }, 'postData') + + watch(postData, () => { + title.value = `Blog - Arthur Danjou - ${i18n.t(postData.value.title.code)}` + likes.value = postData.value.likes + }) const handleLike = async () => { if (liked.value) { - const response = await $axios.post(`/api/posts/${post.value?.slug}/unlike`, {}, { + const response = await $axios.post(`/api/posts/${postData.value.slug}/unlike`, {}, { headers: { 'Authorization': `Bearer ${process.env.API_TOKEN}` } @@ -165,7 +169,7 @@ export default defineComponent({ app.error({statusCode: 500}) } } else { - const response = await $axios.post(`/api/posts/${post.value?.slug}/like`, {}, { + const response = await $axios.post(`/api/posts/${postData.value.slug}/like`, {}, { headers: { 'Authorization': `Bearer ${process.env.API_TOKEN}` } @@ -185,7 +189,7 @@ export default defineComponent({ const isCopied = ref(false) const copyToClipboard = () => { - navigator.clipboard.writeText('https://arthurdanjou.fr/blog/' + post.value?.slug) + navigator.clipboard.writeText('https://arthurdanjou.fr/blog/' + postData.value.slug) isCopied.value = true setTimeout(() => { isCopied.value = false @@ -200,13 +204,13 @@ export default defineComponent({ } const formatDate = computed(() => { - const [first, second, third]: any = post.value?.date.split('-') + const [first, second, third]: any = postData.value.date.split('-') return `${first} ${i18n.t(`month.${second}`)} ${third}` }) const formatTags = computed(() => { let tags = "" - post.value?.tags.map(tag => { + postData.value.tags.map(tag => { tags += i18n.t(String(tag)) + ", " }) return tags.substring(0, tags.length - 2) @@ -214,14 +218,16 @@ export default defineComponent({ return { post, - likes, + getLikes, liked, handleLike, isCopied, copyToClipboard, scrollToTop, formatDate, - formatTags + formatTags, + postData, + slug } } }) diff --git a/src/pages/blog/index.vue b/src/pages/blog/index.vue index 104779b..9c8af2f 100755 --- a/src/pages/blog/index.vue +++ b/src/pages/blog/index.vue @@ -9,9 +9,9 @@ { - return $content(`articles/${i18n.locale}`) - .sortBy('date', 'asc') - .limit(10) - .fetch() - .catch((error) => { - $sentry.captureEvent(error) - }) + const posts = useAsync(async () => { + const response = await $axios.get('/api/posts', { + headers: { + 'Authorization': `Bearer ${process.env.API_TOKEN}` + } + }) + if (response.status === 200) { + console.log(response.data.posts) + return response.data.posts + } else { + app.error({statusCode: 500}) + $sentry.captureEvent(response.data) + } }, 'posts') return { - posts, + posts } } }) diff --git a/src/pages/maintenance.vue b/src/pages/maintenance.vue new file mode 100644 index 0000000..41f25f4 --- /dev/null +++ b/src/pages/maintenance.vue @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('maintenance.back_soon') }} + + + {{ $t('maintenance.title') }} + + + {{ $t(maintenance.reason.code) }} + + + + + + {{ $t('maintenance.progress') }} + + + + {{ $t('maintenance.separator') }} + + + + + + + + + + + + diff --git a/src/pages/projects.vue b/src/pages/projects.vue index 2f45a96..6c64bac 100755 --- a/src/pages/projects.vue +++ b/src/pages/projects.vue @@ -5,12 +5,12 @@ {{ $t('projects.description') }} - - + + @@ -33,14 +33,20 @@ export default defineComponent({ } }, setup() { - const { $content, $sentry } = useContext() + const { $axios, app, $sentry } = useContext() - const projects = useAsync(() => { - return $content('projects') - .fetch() - .catch((error) => { - $sentry.captureEvent(error) - }) + const projects = useAsync(async () => { + const response = await $axios.get('/api/projects', { + headers: { + 'Authorization': `Bearer ${process.env.API_TOKEN}` + } + }) + if (response.status === 200) { + return response.data.projects + } else { + $sentry.captureEvent(response.data) + app.error({statusCode: 500}) + } }, 'projects') return { diff --git a/yarn.lock b/yarn.lock index b48f0cb..4c5b828 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1414,17 +1414,17 @@ defu "^5.0.0" lodash.template "^4.5.0" -"@nuxtjs/composition-api@^0.26.0": - version "0.26.0" - resolved "https://registry.yarnpkg.com/@nuxtjs/composition-api/-/composition-api-0.26.0.tgz#0fbda4fc942ca1e346b7c6d55a1fb331ff931a2a" - integrity sha512-+4L9YDEN5h/vBY6xbBKPMIhgxbPv7psE4IVgKlF+QIekou6oN8m0T+QR2JLE0dHKwzicUbZLCr1v2Qw5T7L48A== +"@nuxtjs/composition-api@^0.27.0": + version "0.27.0" + resolved "https://registry.yarnpkg.com/@nuxtjs/composition-api/-/composition-api-0.27.0.tgz#cbe4df6a7306e4a34770fbad5b1ad79717f8fdb7" + integrity sha512-YtQ1KX+ls13zbukII8/vhKskoI1FrngDxegGVW31576qlaiEQUQGpOATF0cGrZ1W7Wgmz3rsAz1CNdSd5FFXOA== dependencies: - "@vue/composition-api" "^1.0.4" + "@vue/composition-api" "^1.1.1" defu "^5.0.0" estree-walker "^2.0.2" fs-extra "^9.1.0" magic-string "^0.25.7" - ufo "^0.7.7" + ufo "^0.7.9" upath "^2.0.1" "@nuxtjs/dotenv@^1.4.1": @@ -1470,17 +1470,17 @@ resolved "https://registry.yarnpkg.com/@nuxtjs/robots/-/robots-2.5.0.tgz#a42b25e3bc58181cb2a8fbd30d6b0fee6c36bc60" integrity sha512-z1F3HXb05NiZga8Cuq6k5bbowfJOScPtbSOakip0nege+1aI9pGoajzap8eR5s1qwLXAk9Ts+NcgetoUn5lwrQ== -"@nuxtjs/sentry@^5.1.0": - version "5.1.1" - resolved "https://registry.yarnpkg.com/@nuxtjs/sentry/-/sentry-5.1.1.tgz#329606bf93f804d18769cf26befd6786b86e0480" - integrity sha512-tJq4I0r3M46WMO8oPIRVZ05VjXJrzuWCPYNRmhg2q2jcKgHaetK60RnJwGcnsDz6x92MLFVhdzA5kiJEIe9/7Q== +"@nuxtjs/sentry@^5.1.2": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@nuxtjs/sentry/-/sentry-5.1.2.tgz#ba856e4b35676f5be9adfbe73cfa5b785fb0051c" + integrity sha512-WdEa22ynTkFr2FQo3FZEEr5derBu2ckBvAYE5897kJvYp5dI65PK0dKRilPbHikrfb0hUWaPp2dH6Ke1VvGElw== dependencies: "@sentry/browser" "^6.11.0" "@sentry/integrations" "^6.11.0" "@sentry/node" "^6.11.0" "@sentry/webpack-plugin" "^1.17.1" consola "^2.15.3" - lodash.merge "^4.6.2" + lodash.mergewith "^4.6.2" "@nuxtjs/sitemap@^2.4.0": version "2.4.0" @@ -2106,10 +2106,10 @@ optionalDependencies: prettier "^1.18.2" -"@vue/composition-api@^1.0.4": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@vue/composition-api/-/composition-api-1.1.0.tgz#484e7e3bbc516ad6a9b0a9967d316325c239539e" - integrity sha512-9TMJliVFByhfEJjqM+Ymu9ImVrUnrT/Y2S7Fz8EsQ1MbggbE0o8Ohvk9XqK2UIOp8w68f7goVX+6h6O78iRsJQ== +"@vue/composition-api@^1.1.1": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@vue/composition-api/-/composition-api-1.1.3.tgz#8fa528c5f68fec47363340fdae7c7fe047ba5e10" + integrity sha512-gFcLkHD7SkaoE+i4OhMtv6c/gQeSYxEDDGk4yzF4tZ8h8+7oFNBX8lPUWf9McHGBTcztZNzsIZuwkDVmc0WZlQ== dependencies: tslib "^2.3.0" @@ -3392,10 +3392,10 @@ core-js@^2.6.5: resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== -core-js@^3.16.1: - version "3.16.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.16.1.tgz#f4485ce5c9f3c6a7cb18fa80488e08d362097249" - integrity sha512-AAkP8i35EbefU+JddyWi12AWE9f2N/qr/pwnDtWz4nyUIBGMJPX99ANFFRSw6FefM374lDujdtLDyhN2A/btHw== +core-js@^3.16.2: + version "3.16.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.16.2.tgz#3f485822889c7fc48ef463e35be5cc2a4a01a1f4" + integrity sha512-P0KPukO6OjMpjBtHSceAZEWlDD1M2Cpzpg6dBbrjFqFhBHe/BwhxaP820xKOjRn/lZRQirrCusIpLS/n2sgXLQ== core-util-is@~1.0.0: version "1.0.2" @@ -5773,6 +5773,11 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.mergewith@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" + integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== + lodash.template@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" @@ -8275,10 +8280,10 @@ sass-loader@10.1.1: schema-utils "^3.0.0" semver "^7.3.2" -sass@^1.37.5: - version "1.37.5" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.37.5.tgz#f6838351f7cc814c4fcfe1d9a20e0cabbd1e7b3c" - integrity sha512-Cx3ewxz9QB/ErnVIiWg2cH0kiYZ0FPvheDTVC6BsiEGBTZKKZJ1Gq5Kq6jy3PKtL6+EJ8NIoaBW/RSd2R6cZOA== +sass@^1.38.0: + version "1.38.0" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.38.0.tgz#2f3e60a1efdcdc910586fa79dc89d3399a145b4f" + integrity sha512-WBccZeMigAGKoI+NgD7Adh0ab1HUq+6BmyBUEaGxtErbUtWUevEbdgo5EZiJQofLUGcKtlNaO2IdN73AHEua5g== dependencies: chokidar ">=3.0.0 <4.0.0" @@ -9178,6 +9183,11 @@ ufo@^0.7.4, ufo@^0.7.5, ufo@^0.7.7: resolved "https://registry.yarnpkg.com/ufo/-/ufo-0.7.7.tgz#0062f9e5e790819b0fb23ca24d7c63a4011c036a" integrity sha512-N25aY3HBkJBnahm+2l4JRBBrX5I+JPakF/tDHYDTjd3wUR7iFLdyiPhj8mBwBz21v728BKwM9L9tgBfCntgdlw== +ufo@^0.7.9: + version "0.7.9" + resolved "https://registry.yarnpkg.com/ufo/-/ufo-0.7.9.tgz#0268e3734b413c9ed6f3510201f42372821b875c" + integrity sha512-6t9LrLk3FhqTS+GW3IqlITtfRB5JAVr5MMNjpBECfK827W+Vh5Ilw/LhTcHWrt6b3hkeBvcbjx4Ti7QVFzmcww== + uglify-js@^3.5.1: version "3.14.1" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.14.1.tgz#e2cb9fe34db9cb4cf7e35d1d26dfea28e09a7d06"
{{ description }}
{{ $t(description) }}
{{ $t('about.banner.hello') }} Arthur DANJOU 👋.
{{ $t('about.banner.1')}}
{{ $t('about.banner.2') }}
{{ $t('about.banner.3') }}
{{ $t('blog.read.time') }}
{{ post.reading_time }} min
{{ postData.reading_time }} min
Tags
{{ formatTags }}
+ {{ $t(maintenance.reason.code) }} +