Import drizzle replacing prisma

Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2024-04-20 00:03:10 +02:00
parent a7f0a635ec
commit c6ba8c791b
108 changed files with 2367 additions and 1554 deletions

View File

@@ -0,0 +1,106 @@
<script lang="ts" setup>
import {type Activity, IDEs} from '~~/types'
const { data: activity, refresh } = await useAsyncData<Activity>('activity', () => $fetch('/api/activity'))
const codingActivity = computed(() => activity.value!.data.activities.filter(activity => IDEs.some(ide => ide.name === activity.name))[0])
function formatDate(date: number) {
return `${useDateFormat(date, 'DD MMM YYYY').value} at ${useDateFormat(date, 'HH:mm:ss').value}`
}
const CardUi = {
footer: { padding: 'px-4 py-2' },
body: {base: 'h-full flex items-center'}
}
useIntervalFn(async () => await refresh(), 5000)
</script>
<template>
<UCard
:ui="CardUi"
class="flex flex-col justify-between"
>
<div
v-if="activity && activity.data.activities"
class="flex items-center gap-x-4"
>
<p
class="uppercase tracking-widest text-sm"
:style="{ writingMode: 'vertical-rl', textOrientation: 'sideways' }"
>
Activity
</p>
<div v-if="codingActivity">
<div class="flex gap-4 items-center">
<UIcon
class="h-10 w-10"
:name="IDEs.find(ide => ide.name === codingActivity.name)!.icon"
/>
<div>
<div class="flex items-center gap-2">
<h1>{{ codingActivity.name }}</h1>
<UTooltip :text="codingActivity.details === 'Idling' ? 'I\'m sleeping 😴' : 'I\'m online 👋'">
<div
:class="codingActivity.details === 'Idling' ? 'bg-amber-500' : 'bg-green-500'"
class="h-3 w-3 inline-flex rounded-full cursor-pointer"
/>
</UTooltip>
</div>
<h3 v-if="codingActivity.details === 'Idling'">
I'm Idling on my computer
</h3>
<h3 v-else>
{{ codingActivity.details }} - {{ codingActivity.state }}
</h3>
</div>
</div>
</div>
<div
v-else
class="text-subtitle"
>
<div class="flex items-center gap-2">
<h1>I'm currently offline</h1>
<UTooltip text="I'm offline 🫥">
<div class="h-3 w-3 inline-flex rounded-full bg-red-500" />
</UTooltip>
</div>
<h3>Come back later to see what I'm doing</h3>
</div>
</div>
<template #footer>
<div class="flex items-center justify-end w-full">
<ClientOnly>
<p
v-if="codingActivity"
class="text-subtitle text-xs w-1/2"
>
Started {{ useTimeAgo(codingActivity.timestamps.start).value }}, the {{ formatDate(codingActivity.timestamps.start) }}
</p>
</ClientOnly>
<div class="flex items-center space-x-1 w-1/2 justify-end">
<p class="text-subtitle text-xs">
powered by
</p>
<UButton
size="xs"
:padded="false"
variant="link"
to="https://github.com/Phineas/lanyard"
target="_blank"
label="Lanyard"
/>
<UIcon
class="text-subtitle"
name="i-jam-thunder"
/>
</div>
</div>
</template>
</UCard>
</template>
<style>
</style>

View File

@@ -0,0 +1,49 @@
<script setup>
const socials = [
{
name: 'mail',
icon: 'i-material-symbols-alternate-email',
link: 'mailto:arthurdanjou@outlook.fr'
},
{
name: 'twitter',
icon: 'i-ph-twitter-logo-bold',
link: 'https://twitter.com/ArthurDanj'
},
{
name: 'github',
icon: 'i-ph-github-logo-bold',
link: 'https://github.com/ArthurDanjou'
},
{
name: 'linkedin',
icon: 'i-ph-linkedin-logo-bold',
link: 'https://www.linkedin.com/in/arthurdanjou/'
}
]
</script>
<template>
<div class="w-container mt-32 mb-24">
<div class="flex items-center flex-col space-y-4">
<h1 class="text-center lg:text-6xl sm:text-5xl text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 !leading-tight md:w-2/3">
Software engineer, mathematics lover and AI enthusiast
</h1>
<p class="leading-relaxed text-subtitle text-center md:w-2/3 p-2">
I'm Arthur, a software engineer passionate about artificial intelligence and the cloud but also a mathematics student living in France. I am currently studying mathematics at the Faculty of Sciences of Paris-Saclay.
</p>
<div class="flex gap-4">
<UButton
v-for="social in socials"
:key="social.name"
:icon="social.icon"
size="md"
:to="social.link"
variant="ghost"
target="_blank"
:ui="{ rounded: 'rounded-full' }"
/>
</div>
</div>
</div>
</template>

View File

@@ -0,0 +1,89 @@
<script lang="ts" setup>
import type { Stats } from '~~/types'
const stats = await $fetch<Stats>('/api/stats')
const CardUi = {
footer: { padding: 'px-4 py-2' },
body: {base: 'h-full'}
}
</script>
<template>
<UCard
:ui="CardUi"
class="flex flex-col justify-between"
>
<div class="flex items-center gap-x-4 h-full">
<p
class="uppercase tracking-widest text-sm"
:style="{ writingMode: 'vertical-rl', textOrientation: 'sideways' }"
>
STATS
</p>
<div v-if="stats">
<div class="flex gap-4 items-center">
<div class="text-md">
<div class="flex items-center gap-x-1">
<h3>Total hours:</h3>
<p class="text-subtitle">
{{ usePrecision(stats.coding.data.grand_total.total_seconds_including_other_language / 3600, 0) }} hours
</p>
</div>
<div class="flex items-start gap-x-1 flex-wrap">
<h3>Best Editors:</h3>
<p class="text-subtitle">
{{ stats.editors.data.slice(0, 2).map(editor => `${editor.name} (${editor.percent}%)`).join(', ') }}
</p>
</div>
<div class="flex items-center gap-x-1">
<h3>Best OS:</h3>
<p class="text-subtitle">
{{ stats.os.data[0].name }} with {{ stats.os.data[0].percent }}%
</p>
</div>
<div class="flex items-start gap-x-1 flex-wrap">
<h3>Top languages:</h3>
<p class="text-subtitle">
{{ stats.languages.data.slice(0, 2).map(language => `${language.name} (${language.percent}%)`).join(', ') }}
</p>
</div>
</div>
</div>
</div>
</div>
<template #footer>
<div class="flex items-center justify-between">
<ClientOnly>
<p
v-if="stats"
class="text-subtitle text-xs w-1/2"
>
Started {{ useTimeAgo(new Date(stats.coding.data.range.start)).value }}, the {{ useDateFormat(new Date(stats.coding.data.range.start), 'Do MMMM YYYY').value }}
</p>
</ClientOnly>
<div class="flex items-center justify-end space-x-1">
<p class="text-subtitle text-xs">
powered by
</p>
<UButton
size="xs"
:padded="false"
variant="link"
to="https://wakatime.com/"
target="_blank"
label="Wakatime"
/>
<UIcon
class="text-subtitle"
name="i-jam-thunder"
/>
</div>
</div>
</template>
</UCard>
</template>
<style>
</style>