<template>
    <ContentRow class="artifact pointer" @click="() => useRouter().push('artifacts/' + artifact.id)">
        <ContentCell>{{ artifact.groupId }}</ContentCell>
        <ContentCell>{{ artifact.artifactId }}</ContentCell>
        <ContentCell><div v-if="artifact.versions" v-for="latest in [artifact.versions.at(0)]"><span v-if="latest">{{ latest.version }}</span></div></ContentCell>
        <ContentCell>{{ artifact.totalPullCount }}</ContentCell>
        <ContentCell>{{ dayjs(artifact.updatedAt).format("DD.MM.YYYY HH:mm") + " Uhr" }}</ContentCell>
    </ContentRow>
</template>

<script setup lang="ts">
import type {Artifact} from "~/components/artifact/Artifact";
import dayjs from "dayjs";
import ContentRow from "~/components/ui/table/ContentRow.vue";
import ContentCell from "~/components/ui/table/ContentCell.vue";

defineProps<{
    artifact: Artifact
}>()
</script>

<style scoped>
.artifact {
    display: contents;
}
</style>