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

const token = ref('')
const emit = defineEmits<{
  (e: 'update-token', value: string): void
}>()

function confirmToken() {
  const trimmed = token.value.trim()
  if (!trimmed) return
  emit('update-token', trimmed)
}
</script>

<template>
  <form @submit.prevent="confirmToken" class="token-input">
    <input v-model="token" type="password" placeholder="Enter your Hugging Face token..." />
    <button type="submit">Confirm</button>
  </form>
</template>

<style scoped>
.token-input {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

input {
  flex: 1;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

button {
  padding: 0.75rem 1rem;
  font-size: 1rem;
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  background-color: #45a049;
}
</style>
