<script setup lang="ts">
const shortcuts = [
  { key: 'Ctrl + 1', desc: '文本翻译' },
  { key: 'Ctrl + 2', desc: '术语提取' },
  { key: 'Ctrl + 3', desc: '词典搜索' },
  { key: 'Ctrl + 4', desc: '流水线' },
  { key: 'Ctrl + /', desc: '显示/隐藏快捷键帮助' },
  { key: 'Esc', desc: '关闭弹窗' },
]

defineProps<{
  modelValue: boolean
}>()

defineEmits<{
  (e: 'update:modelValue', v: boolean): void
}>()
</script>

<template>
  <el-dialog :model-value="modelValue" title="⌨️ 快捷键" width="400px" @close="$emit('update:modelValue', false)">
    <div class="shortcut-list">
      <div v-for="s in shortcuts" :key="s.key" class="shortcut-item">
        <kbd>{{ s.key }}</kbd>
        <span>{{ s.desc }}</span>
      </div>
    </div>
  </el-dialog>
</template>

<style scoped>
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}
kbd {
  font-family: monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 12px;
}
</style>
