<template>
  <nav class="nav">
    <div class="nav__inner">
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('settings') }]"
          to="/profile/settings"
      >
        <icon name="ic:baseline-settings" size="20" />
        {{ t('profile.settings.title') }}
      </nuxt-link-locale>
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('orders') }]"
          to="/profile/orders"
      >
        <icon name="material-symbols:order-approve-rounded" size="20" />
        {{ t('profile.orders.title') }}
      </nuxt-link-locale>
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('wishlist') }]"
          to="/profile/wishlist"
      >
        <icon name="mdi:cards-heart-outline" size="20" />
        {{ t('profile.wishlist.title') }}
      </nuxt-link-locale>
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('cart') }]"
          to="/profile/cart"
      >
        <icon name="ph:shopping-cart-light" size="20" />
        {{ t('profile.cart.title') }}
      </nuxt-link-locale>
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('balance') }]"
          to="/profile/balance"
      >
        <icon name="ic:outline-attach-money" size="20" />
        {{ t('profile.balance.title') }}
      </nuxt-link-locale>
      <nuxt-link-locale
          class="nav__item"
          :class="[{ active: route.path.includes('promocodes') }]"
          to="/profile/promocodes"
      >
        <icon name="fluent:ticket-20-filled" size="20" />
        {{ t('profile.promocodes.title') }}
      </nuxt-link-locale>
    </div>
    <div class="nav__logout" @click="logout">
      <icon name="material-symbols:power-settings-new-outline" size="20" />
      {{ t('profile.logout') }}
    </div>
  </nav>
</template>

<script setup lang="ts">
import {useLogout} from "~/composables/auth";

const {t} = useI18n();
const route = useRoute();

const { logout } = useLogout();
</script>

<style lang="scss" scoped>
.nav {
  position: sticky;
  top: 141px;
  width: max-content;
  height: fit-content;

  &__inner {
    background-color: $white;
    border-radius: $default_border_radius;
    padding-block: 7px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.2);
  }

  &__item {
    cursor: pointer;
    padding: 7px 30px 7px 10px;
    border-left: 2px solid $white;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;

    color: $accent;
    font-size: 18px;
    font-weight: 600;

    @include hover {
      color: $accentDark;
      background-color: #f5f5f5;
      border-color: #f5f5f5;
    }

    &.active {
      border-color: $accent;
      color: $accentDark;
      background-color: rgba($accent, 0.2);
    }
  }

  &__logout {
    cursor: pointer;
    margin-top: 25px;
    border-radius: $default_border_radius;
    background-color: rgba($accent, 0.2);
    border: 1px solid $accent;
    padding: 7px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.2s;

    color: $accent;
    font-size: 16px;
    font-weight: 600;

    @include hover {
      background-color: $accent;
      color: $white;
    }
  }
}
</style>