@page 
@model IndexModel
@{
    ViewData["Title"] = "CARTAID";
}

<div class="container-fluid">

    <div class="left_frame" id="leftFrame">

        
        <div class="logo">
            <img src="/images/logo.png" alt="Logo site">
            <span class="logo_name">CARTAID</span>
        </div>

        <div class="menu">

            <div class="elements_wishlisht">

            <div class="close_menu">
                <span >Wishlists</span>
                <a class="button_close_menu" >
                    <span></span>
                    <span></span>
                    <span></span>
                </a>
            </div>

            <div class="add_chat">
                <a href="/">
                    <span >Add chat +</span>
                </a>  
            </div>

            <div class="wishlist_names">
                <section method="get" asp-page="ChatOne" >
                    <span id ="wishlist_id_1" class="wishlist_name">Gift for Jessica</span>
                </section>

                <section>
                    <span id ="wishlist_id_2" class="wishlist_name">Secret Santa</span>
                </section>

                <section>
                    <span  id ="wishlist_id_3" class="wishlist_name">Phone charger</span>
                </section>

                <section>
                    <span class="wishlist_name">Phone</span>
                </section>

                <section>
                    <span class="wishlist_name">Printer</span>
                <section>

                    <span class="wishlist_name">Books</span>
                </section>
            </div>

        </div>
        <div class="line"></div>  
            <div class="elements">
                <div class="info_user">
                    <img src="/images/avatar.jpg" alt="Avatar user">
                    <span class="user_name">Username</span>
                </div>

            </div>

            
        </div>


    </div>

    <div class="right_frame" id="rightFrame">

            <div class="open_menu">
                <a class="button_open_menu" >
                    <span></span>
                    <span></span>
                    <span></span>
                </a>
            </div>


            <div class="chat_frame">              

            <div class="new_chat">              

                <div class="title_one_frame">New chat</div>
                <div class="title_two_frame">What you're looking for</div>

                <div class="switch">
                    <div class="switch_product" id="choose_product" >
                            Product
                    </div>
                    <div class="switch_gift" id="choose_gift">
                            Gift 
                    </div>                    
                </div>


                <div class="title_three_frame">What you're looking for, we will help you solve your problem and find it</div>

                <div class="topic" >
                    <div class="topic_one">
                         <a class="button_topic_one" >
                            Date
                         </a>
                    </div>

                    <div class="topic_two">
                         <a class="button_topic_two" >
                            Halloween  gift
                         </a>                        
                    </div>
                    <div class="topic_three">
                         <a class="button_topic_three" >
                            Birthday gift
                         </a>                          
                    </div>
                </div>
            </div>

            <div class="chat_input">

                <input type="text" id="chatInput" placeholder="Describe what you are looking for....">

                <a class="button_sende">
                       <img  src="/images/send.png" alt="Send message">
                </a>      


            </div>




            </div>

    </div>
</div>


<script>
const leftFrame = document.getElementById("leftFrame");
const rightFrame = document.getElementById("rightFrame");
const openMenuButton = document.querySelector(".button_open_menu");
const closeMenuButton = document.querySelector(".button_close_menu");



const choose_gift = document.getElementById("choose_gift");
const choose_product = document.getElementById("choose_product");
const switchGift = document.querySelector(".switch_gift");
const switchProduct = document.querySelector(".switch_product");

const isLeftFrameOpen = localStorage.getItem('leftFrameOpen');

if (isLeftFrameOpen) {
     requestAnimationFrame(() => {
        leftFrame.style.transform = "translateX(0%)";
        rightFrame.style.transform = "translateX(calc(30% - 40px))";
        rightFrame.style.width = "calc(80% - 60px)";
    });
    openMenuButton.style.visibility = "hidden";
    closeMenuButton.style.visibility = "visible";
} else {
      requestAnimationFrame(() => {
        leftFrame.style.transform = "translateX(-100%)";
                rightFrame.style.transform = "translateX(0%)";
        rightFrame.style.width = "calc(100% - 40px)";
    });
    closeMenuButton.style.visibility = "hidden";
    openMenuButton.style.visibility = "visible";
}


openMenuButton.addEventListener("click", function () {
    requestAnimationFrame(() => {
        leftFrame.style.transform = "translateX(0%)";
        rightFrame.style.transform = "translateX(calc(30% - 40px))";
        rightFrame.style.width = "calc(80% - 60px)";
    });
    openMenuButton.style.visibility = "hidden";
    closeMenuButton.style.visibility = "visible";
     localStorage.setItem('leftFrameOpen', 'true');
});

closeMenuButton.addEventListener("click", function () {
    requestAnimationFrame(() => {
        leftFrame.style.transform = "translateX(-100%)";
                rightFrame.style.transform = "translateX(0%)";
        rightFrame.style.width = "calc(100% - 40px)";
    });
    closeMenuButton.style.visibility = "hidden";
    openMenuButton.style.visibility = "visible";
     localStorage.setItem('leftFrameOpen', 'false');
});

switchGift.addEventListener("click", function () {
    requestAnimationFrame(() => {
        choose_gift.style.backgroundColor = "#0052CC";
        choose_product.style.backgroundColor = "transparent";
        switchGift.style.color = "white";
        switchProduct.style.color = "#202124";

    });

});

switchProduct.addEventListener("click", function () {
    requestAnimationFrame(() => {
        choose_product.style.backgroundColor = "#0052CC";
        choose_gift.style.backgroundColor = "transparent";
        switchProduct.style.color = "white";
        switchGift.style.color = "#202124";       

    });

});


const wishlist_id_1 = document.getElementById("wishlist_id_1");

wishlist_id_1.addEventListener("click", function () {
   
        window.location.href = "/chat/" + 1;

});

</script>
