mirror of
https://github.com/ArthurDanjou/artsite.git
synced 2026-01-30 05:28:46 +01:00
Change linter config to antfu config and lint code
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
<script lang="ts" setup>
|
||||
const { locale } = useI18n()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="!max-w-none prose dark:prose-invert">
|
||||
<ContentDoc :path="`/home/${locale}`" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
const { locale } = useI18n()
|
||||
</script>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: 'Things I use',
|
||||
description: t('description')
|
||||
description: t('description'),
|
||||
})
|
||||
|
||||
const { data: items } = await useAsyncData('uses', () => queryContent('/uses').find()
|
||||
const { data: items } = await useAsyncData('uses', () => queryContent('/uses').find(),
|
||||
)
|
||||
|
||||
const hardware = items.value!.filter(item => item.category === 'hardware')
|
||||
|
||||
@@ -3,33 +3,33 @@ const route = useRoute()
|
||||
const { data: post } = await useAsyncData(`writing:${route.params.slug}`, () => queryContent(`/writings/${route.params.slug}`).findOne())
|
||||
const {
|
||||
data: postDB,
|
||||
refresh
|
||||
refresh,
|
||||
} = await useAsyncData(`writing:${route.params.slug}:db`, () => $fetch(`/api/posts/${route.params.slug}`, { method: 'POST' }))
|
||||
|
||||
const { locale, locales } = useI18n()
|
||||
const currentLocale = computed(() => locales.value.filter(l => l.code === locale.value)[0])
|
||||
|
||||
const { t } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
|
||||
function top() {
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
behavior: 'smooth',
|
||||
})
|
||||
}
|
||||
|
||||
const { copy, copied } = useClipboard({
|
||||
source: `https://arthurdanjou.fr/writings/${route.params.slug}`,
|
||||
copiedDuring: 4000
|
||||
copiedDuring: 4000,
|
||||
})
|
||||
|
||||
useSeoMeta({
|
||||
title: post.value?.title,
|
||||
description: post.value?.description,
|
||||
author: 'Arthur Danjou'
|
||||
author: 'Arthur Danjou',
|
||||
})
|
||||
|
||||
function getDetails() {
|
||||
@@ -43,11 +43,12 @@ function getDetails() {
|
||||
}
|
||||
|
||||
const likeCookie = useCookie<boolean>(`post:like:${route.params.slug}`, {
|
||||
maxAge: 7200
|
||||
maxAge: 7200,
|
||||
})
|
||||
|
||||
async function handleLike() {
|
||||
if (likeCookie.value) return
|
||||
if (likeCookie.value)
|
||||
return
|
||||
await $fetch(`/api/posts/like/${route.params.slug}`, { method: 'PUT' })
|
||||
await refresh()
|
||||
likeCookie.value = true
|
||||
@@ -133,7 +134,7 @@ async function handleLike() {
|
||||
<div class="flex gap-4 items-center flex-wrap">
|
||||
<UButton
|
||||
:label="postDB?.likes > 1 ? `${postDB?.likes} likes` : `${postDB?.likes} like`"
|
||||
:color="likeCookie ? 'red': 'white'"
|
||||
:color="likeCookie ? 'red' : 'white'"
|
||||
icon="i-ph-heart-duotone"
|
||||
size="lg"
|
||||
variant="solid"
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
const { t, locale } = useI18n({
|
||||
useScope: 'local'
|
||||
useScope: 'local',
|
||||
})
|
||||
useSeoMeta({
|
||||
title: 'My Shelf',
|
||||
description: t('description')
|
||||
description: t('description'),
|
||||
})
|
||||
|
||||
const { data: writings } = await useAsyncData('all-writings', () =>
|
||||
queryContent('/writings').sort({ published: -1 }).without('body').find()
|
||||
)
|
||||
queryContent('/writings').sort({ published: -1 }).without('body').find())
|
||||
|
||||
const { data: writingsDB } = await useAsyncData('all-writings-db', () =>
|
||||
$fetch(`/api/posts`)
|
||||
)
|
||||
$fetch(`/api/posts`))
|
||||
|
||||
function getDetails(slug: string) {
|
||||
const writing = writingsDB.value!.find(writing => writing.slug === slug)
|
||||
if (!writing) return ''
|
||||
if (!writing)
|
||||
return ''
|
||||
|
||||
const like = writing.likes! > 1 ? t('likes.many') : t('likes.one')
|
||||
const view = writing.views! > 1 ? t('views.many') : t('views.one')
|
||||
|
||||
Reference in New Issue
Block a user