<template>
    <ul class="mini-menu">
        <li v-for="(item, i) in items" :key="i">
            <router-link :to="item.to" @click="popup.hide()">
                <Button v-bind="item.props" iconPos="right" severity="secondary" link />
            </router-link>
        </li>
        <li>
            <Button :label="$t('logout')" icon="isax isax-logout-1" iconPos="right" severity="secondary" link
                @click="logout()" />
        </li>
    </ul>
</template>

<script setup>
const items = reactive([
    {
        to: "/panel/profile",
        props: { label: "پروفایل کاربری", icon: "isax isax-user-square" },
    },
    { to: "/panel/favorites", props: { label: "علاقه مندی ها", icon: "isax isax-heart" } },
    {
        to: "/panel/comments",
        props: { label: "نظرات من", icon: "isax isax-message-text4" },
    },
    { to: "/panel/factors", props: { label: "فاکتورها", icon: "isax isax-receipt-2-1" } },
    {
        to: "/panel/moeen",
        props: { label: "فاکتور معین", icon: "isax isax-archive-book4" },
    },
    { to: "/panel/notifications", props: { label: "اعلان ها", icon: "isax isax-notification" } },
    {
        to: "/panel/orders",
        props: { label: "سفارشات", icon: "isax isax-shopping-cart" },
    },
])

const { popup } = inject('service')

const { dialog } = inject('service')
const logout = () => {
    popup.value.hide();
    dialog.show(resolveComponent('PanelDialogLogout'))
}
</script>

<style lang="scss">
.mini-menu {
    @apply flex flex-col gap-3 px-4 pt-[1.4rem] rtl shadow-[0px_2px_10px_#004b8229];
    @apply w-[13.4rem] h-[27.8rem] bg-white rounded-2xl shadow border;

    li {
        button {
            @apply h-10 py-1.5 justify-end #{!important};

            .p-button-icon {
                @apply text-[#333333] text-2xl ml-3;
            }

            .p-button-label {
                @apply text-[#333333] text-lg font-medium font-vazir grow-0 whitespace-nowrap;
            }
        }
    }
}

.p-overlaypanel:has(.mini-menu) {
    @apply -translate-x-8;
}
</style>