<template>
    <div class="mb-2 ms-4 p-2">
        <span
            class="absolute -mt-1 flex items-center justify-center w-6 h-6 bg-blue-100 rounded-full -start-3 ring-4 ring-white dark:ring-zinc-900 dark:bg-blue-900">
            <IconBook class="size-5 text-zinc-100" />
        </span>
        <div class="shadow-2xl rounded-lg p-2">
            <!-- activity info -->
            <div class="flex justify-between">
                <div class="flex items-center text-sm font-bold tracking-tight text-zinc-950 dark:text-white">
                    <NuxtLink :to="useRuntimeConfig().public.router.Paper + instance.content">
                        <h5 class="">
                            {{ instance.title }}
                        </h5>
                    </NuxtLink>
                </div>
                <img v-if="instance.get_image" :src="useRuntimeConfig().public.MediaUrl + instance.get_image" alt=""
                    class="size-16 object-cover rounded-lg">
            </div>
            <p class="mt-1 font-normal text-zinc-700 dark:text-zinc-400">
                {{ instance.abstract }}
            </p>
            <!-- user profile -->
            <UserProfile :user="instance.user" class="mt-2" />
            <div class="flex justify-end items-end mt-1">
                <div class="flex flex-col items-end">
                    <p class="mt-1 text-xs text-left font-normal text-zinc-500 dark:text-zinc-400">
                        {{ toPersianNumbers(instance.persian_date) }}
                    </p>
                    <ActivityStatistics :instance="instance" />
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
const props = defineProps(['instance'])
const instance = props.instance
const { $toPersianNumbers } = useNuxtApp();
const toPersianNumbers = $toPersianNumbers;
</script>