<script setup lang="ts">
import { Clock3 } from '@lucide/vue'
import { RouterLink } from 'vue-router'

import Card from '../ui/Card.vue'

defineProps<{
  priorityActions: Array<{ label: string; value: number; to: string; hint: string; icon: unknown; tone: string }>
}>()
</script>

<template>
  <Card class="p-6">
    <div class="flex items-center justify-between gap-4">
      <div>
        <p class="text-xs font-semibold uppercase tracking-[0.26em] text-violet-500">Schnellzugriffe</p>
        <h2 class="mt-1 text-xl font-bold text-slate-900">Was zuerst?</h2>
      </div>
      <Clock3 class="h-6 w-6 text-amber-500" />
    </div>

    <div class="mt-5 space-y-3">
      <RouterLink
        v-for="item in priorityActions"
        :key="item.label"
        :to="item.to"
        class="group block rounded-[22px] border border-violet-100 bg-white/85 p-4 transition hover:-translate-y-0.5 hover:border-violet-200 hover:bg-violet-50/70"
      >
        <div class="flex items-center justify-between gap-4">
          <div class="flex min-w-0 items-center gap-3">
            <div
              class="grid h-10 w-10 shrink-0 place-items-center rounded-2xl"
              :class="{
                'bg-violet-100 text-violet-700': item.tone === 'violet',
                'bg-rose-100 text-rose-700': item.tone === 'rose',
                'bg-amber-100 text-amber-700': item.tone === 'amber',
                'bg-emerald-100 text-emerald-700': item.tone === 'emerald',
              }"
            >
              <component :is="item.icon" class="h-5 w-5" />
            </div>
            <div class="min-w-0">
              <p class="truncate font-semibold text-slate-800">{{ item.label }}</p>
              <p class="truncate text-sm text-slate-500">{{ item.hint }}</p>
            </div>
          </div>
          <strong class="rounded-full border border-violet-100 bg-white px-3 py-1 text-violet-800">{{ item.value }}</strong>
        </div>
      </RouterLink>
    </div>
  </Card>
</template>
