<script setup lang="ts">
import { ref } from 'vue'

const recentlyFinished = ref([
  'Docker Image gebaut',
  'Memory Compression',
  'Enemy AI verbessert',
  'Daily Backup',
  'TeamView deployt',
  'Config-Editor live',
])

function onChipClick(item: string) {
  console.log('[Dashboard] Recently finished:', item)
}
</script>

<template>
  <div class="finished-section">
    <h3>Recently Finished</h3>
    <div class="finished-scroll">
      <span
        v-for="(item, idx) in recentlyFinished"
        :key="idx"
        class="finished-chip"
        role="button"
        tabindex="0"
        @click="onChipClick(item)"
        @keyup.enter="onChipClick(item)"
      >
        {{ item }}
      </span>
    </div>
  </div>
</template>

<style scoped>
.finished-section {
  display: flex;
  align-items: center;
  gap: 10px;
}
.finished-section h3 {
  font-size: 10px;
  font-weight: 700;
  color: #7e8799;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.finished-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}
.finished-scroll::-webkit-scrollbar {
  display: none;
}
.finished-chip {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid rgba(139, 124, 246, 0.1);
  border-radius: 20px;
  background: rgba(139, 124, 246, 0.06);
  color: #7e8799;
  font-size: 9.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.finished-chip:hover {
  background: rgba(139, 124, 246, 0.12);
  border-color: rgba(139, 124, 246, 0.2);
  color: #e8eaf0;
}
.finished-chip:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .finished-section {
    flex-direction: column;
    align-items: flex-start;
  }
}
</style>
