

function loadSearch() {
    setTileActive("search_icon")
    loadView(`
        <div class="search-find">
            <i class="fa fa-magnifying-glass"></i>
            <input autocomplete="off" id="search-input" type="text" placeholder="Insérez des mots-clés ou un lien">
        </div>
        <div class="search-pl" id='playlist-info'></div>
        <div class="search-container">
            <div class="search-list" id="search-list">
            
            
            
            </div> 
        </div>
    `)
    actualView = "search"
    loadSearchView()

}

loadSearch()


function loadSettings() {
    setTileActive("settings_icon")

    var contentAdmin = ""
    var isAdmin = false

    get("USER_INFO").then((data) => {    
        if(data.admin) {
            isAdmin = true
            contentAdmin = `
            <p id="st-users" class="">Utilisateurs</p>
            <p id="st-nodes" class="">Maintenance</p>
            <p id="st-logs" class="">Logs</p>`
        }

        loadView(`
        <div class='settings-container'>
            <div class="st-selector">
                <p id="st-report" class="selected">Rapport & Tutoriel</p>
                ${contentAdmin}
            </div>
            <div id='st-content' class="st-content">
                
            </div>
        </div>
        `)
        loadSettingsView(isAdmin)
    })

   


   
}


const search_btn = getID("search_btn")
const settings_btn = getID("settings_btn")

const search_icon = getID("search_icon")
const settings_icon = getID("settings_icon")

tileList.push(search_icon)
tileList.push(settings_icon)


search_btn.addEventListener("click", () => {  
    loadSearch()
    

})

settings_btn.addEventListener("click", () => {

    loadSettings()

})


