<template>
    <div class="container container-fluid" id="main-container">
        <div class="row">
            <div class="col-6"
                 v-for="item in $store.getters.getInventoryWithItemData"
                 v-bind:key="item"
                 data-bs-dismiss="modal">
                <div :class="'inventory-item ' + getFrameClass(item.type)">
                    <div class="float-end">
                        <img :src="item.icon" :alt="item.name" class="item-icon">
                    </div>
                    {{ item.name }}<br/>
                    x{{ item.quantity }}
                </div>
            </div>
            <div v-if="$store.state.inventory.length === 0">
                You don't have any items yet.
            </div>
        </div>
    </div>
</template>

<script>
import {ItemTypeFrameClasses} from "@/data/ItemTypes";

export default {
    name: "InventoryView",
    methods: {
        getFrameClass(type) {
            return ItemTypeFrameClasses[type];
        }
    }
}
</script>

<style scoped>
#main-container {
    margin-top: 5em;
}

.item-icon {
    height: 2.5em;
}

.inventory-item {
    font-size: 0.8em;
    margin-bottom: 1em;
    background-color: white;
    border-radius: 20px;
}
</style>