<script setup>
import ModalDialog from './ModalDialog.vue'

defineEmits(['close'])
</script>

<template>
  <ModalDialog :title="$t('credits.title')" @close="$emit('close')">
    <p class="credits-intro">{{ $t('credits.intro') }}</p>

    <div class="credit-item">
      <div class="credit-header">
        <i class="bi bi-lightning-charge-fill credit-icon"></i>
        <strong>{{ $t('credits.appIcon.name') }}</strong>
      </div>
      <p class="credit-detail">{{ $t('credits.appIcon.description') }}</p>
      <p class="credit-meta">
        <span class="credit-license">CC BY 3.0</span>
        &mdash;
        <a href="https://game-icons.net" target="_blank" rel="noopener noreferrer">
          game-icons.net
        </a>
        &mdash;
        {{ $t('credits.appIcon.author') }}
      </p>
      <p class="credit-note">{{ $t('credits.gameIcons') }}</p>
    </div>

    <div class="credit-item">
      <div class="credit-header">
        <i class="bi bi-grid-3x3-gap-fill credit-icon"></i>
        <strong>{{ $t('credits.bootstrapIcons.name') }}</strong>
      </div>
      <p class="credit-detail">{{ $t('credits.bootstrapIcons.description') }}</p>
      <p class="credit-meta">
        <span class="credit-license">MIT</span>
        &mdash;
        <a href="https://icons.getbootstrap.com" target="_blank" rel="noopener noreferrer">
          icons.getbootstrap.com
        </a>
      </p>
    </div>

    <div class="credit-item">
      <div class="credit-header">
        <i class="bi bi-box-seam credit-icon"></i>
        <strong>{{ $t('credits.thirdParties.title') }}</strong>
      </div>
      <p class="credit-detail credit-links">
        <a href="https://vuejs.org" target="_blank" rel="noopener noreferrer">Vue</a>,
        <a href="https://router.vuejs.org" target="_blank" rel="noopener noreferrer">Vue Router</a>,
        <a href="https://vitejs.dev" target="_blank" rel="noopener noreferrer">Vite</a>,
        <a href="https://sqlite.org/wasm/" target="_blank" rel="noopener noreferrer">SQLite WASM</a
        >, <a href="https://www.chartjs.org" target="_blank" rel="noopener noreferrer">Chart.js</a>,
        <a href="https://vue-chartjs.org" target="_blank" rel="noopener noreferrer">vue-chartjs</a>,
        <a href="https://www.i18next.com" target="_blank" rel="noopener noreferrer">i18next</a>,
        <a href="https://i18next.github.io/i18next-vue/" target="_blank" rel="noopener noreferrer"
          >i18next-vue</a
        >, <a href="https://prettier.io" target="_blank" rel="noopener noreferrer">Prettier</a>,
        <a href="https://vite-pwa-org.netlify.app" target="_blank" rel="noopener noreferrer"
          >vite-plugin-pwa</a
        >, <a href="https://marked.js.org" target="_blank" rel="noopener noreferrer">marked</a>,
        <a href="https://github.com/cure53/DOMPurify" target="_blank" rel="noopener noreferrer"
          >DOMPurify</a
        >
      </p>
    </div>

    <div class="credit-item">
      <div class="credit-header">
        <i class="bi bi-check2-square credit-icon"></i>
        <strong>{{ $t('credits.testingTools.title') }}</strong>
      </div>
      <p class="credit-detail credit-links">
        <a href="https://playwright.dev/python/" target="_blank" rel="noopener noreferrer"
          >Playwright</a
        >, <a href="https://pytest.org" target="_blank" rel="noopener noreferrer">pytest</a>
      </p>
    </div>
  </ModalDialog>
</template>

<style scoped>
.credits-intro {
  font-size: 14px;
  color: var(--front-color2);
  margin: 0 0 20px;
}

.credit-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.credit-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.credit-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.credit-icon {
  font-size: 16px;
  color: var(--front-color2);
}

.credit-detail {
  font-size: 13px;
  color: var(--front-color2);
  margin: 0 0 6px;
}

.credit-meta {
  font-size: 13px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.credit-license {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-color);
  font-size: 11px;
  font-weight: 600;
}

.credit-links {
  line-height: 1.8;
}

.credit-note {
  font-size: 12px;
  color: var(--front-color2);
  margin: 6px 0 0;
  font-style: italic;
}

a {
  color: var(--front-color1);
}
</style>
