<script setup lang="ts">
import { t } from '../i18n';
import { useCommentaryStore } from '../stores/commentary';

const commentaryStore = useCommentaryStore();
</script>

<template>
  <div class="commentary-panel">
    <div class="row items-center q-mb-md">
      <div class="text-h4">
        {{ t('commentaryTitle') }}
      </div>
    </div>

    <div class="commentary-panel__layout">
      <div class="commentary-panel__commentator">
        <QInput
          v-model="commentaryStore.leftCommentator"
          :label="t('commentaryCommentator1')"
          dense
          class="commentary-panel__field"
        >
          <template #prepend>
            <QIcon name="mic" />
          </template>
        </QInput>

        <QInput
          v-model="commentaryStore.leftCommentatorTwitter"
          :label="t('commentaryTwitterText')"
          dense
          class="commentary-panel__field"
        />
      </div>

      <QBtn
        flat
        dense
        round
        icon="swap_horiz"
        class="commentary-panel__swap-btn"
        @click="commentaryStore.swapCommentators"
      />

      <div class="commentary-panel__commentator">
        <QInput
          v-model="commentaryStore.rightCommentator"
          :label="t('commentaryCommentator2')"
          dense
          class="commentary-panel__field"
        >
          <template #prepend>
            <QIcon name="mic" />
          </template>
        </QInput>

        <QInput
          v-model="commentaryStore.rightCommentatorTwitter"
          :label="t('commentaryTwitterText')"
          dense
          class="commentary-panel__field"
        />
      </div>
    </div>
  </div>
</template>

<style scoped>
.commentary-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.commentary-panel__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.commentary-panel__commentator {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.commentary-panel__field :deep(.q-field__control) {
  min-height: 28px;
  padding: 0;
  background: transparent !important;
  border-radius: 0;
}

.commentary-panel__field :deep(.q-field__control:before),
.commentary-panel__field :deep(.q-field__control:after) {
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
}

.commentary-panel__field :deep(.q-field__prepend) {
  color: rgba(255, 255, 255, 0.6);
}

.commentary-panel__field :deep(.q-field__native),
.commentary-panel__field :deep(.q-field__input),
.commentary-panel__field :deep(.q-field__label) {
  color: rgba(255, 255, 255, 0.92);
}

.commentary-panel__swap-btn {
  color: #fff;
  opacity: 0.85;
}

.commentary-panel__swap-btn:hover {
  opacity: 1;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
}

@media (max-width: 900px) {
  .commentary-panel__layout {
    grid-template-columns: 1fr;
  }

  .commentary-panel__swap-btn {
    justify-self: center;
  }
}
</style>
