<!DOCTYPE html>
<html lang="en" dir="ltr" id="main_html" prefix="og: http://ogp.me/ns#">
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8" />
        <title id="title">Events</title>
        

        <meta property="og:title" content="Treehouse Events">
        <meta property="og:description" content="A Bulletin of all our events made using events.treehousefullofstars.com">
        <meta property="og:site_name" content="Treehouse Events">
        
        <!-- Material Icons -->
        <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
        <!-- Material Symbols - Outlined Set -->
        <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" rel="stylesheet" />
        <!-- Material Symbols - Rounded Set -->
        <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded" rel="stylesheet" />
        <!-- Material Symbols - Sharp Set -->
        <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp" rel="stylesheet" />
        
        <link rel="stylesheet" href="{{ url_for('static', filename='css/uikit.min.css') }}"/>
        <link rel="stylesheet" href="{{ url_for('static', filename='css/stream.css') }}"/>
        <link id="dark-mode" rel="stylesheet" href="{{ url_for('static', filename='css/dark-mode.css') }}" disabled/>


        <script src="{{ url_for('static', filename='js/uikit.min.js') }}"></script>
        <script src="{{ url_for('static', filename='js/uikit-icons.min.js') }}"></script>
        <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>


    </head>
    <body>
        <div uk-sticky="sel-target: .uk-navbar-container; cls-active: uk-navbar-sticky;">
            <nav id="navbar" class="uk-navbar-container">
                <div class="uk-container uk-container-expand">
                    <div uk-navbar="dropbar: true">
                        <div class="uk-navbar-left">
                            <p style="margin-top: 20px;"><strong>Events</strong></p>
                        </div>
                        <div class="uk-navbar-right uk-margin-small">
                            <div>
                                <a onclick="toggleDarkMode()" class="uk-button uk-button-small"><span id="modeToggle" class="uk-flex material-symbols-outlined">dark_mode</span></a>
                            </div>
                            <a href="#" class="uk-button uk-button-small" uk-icon="icon: menu" uk-toggle> Menu</a>
                            <div uk-dropdown="pos: bottom-right">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li><a href="/">Home</a></li>
                                    <li><a href="/stream">Stream</a></li>
                                    <li><a href="/events">Events</a></li>
                                    <li><a href="/radios">Radio</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </nav>
        
        </div>
        <div class="uk-container uk-section">
            <div uk-grid>
                <div class="uk-width-1-1">
                    <a href="https:/events.treehousefullofstars.com/new" target="_blank" class="uk-button uk-button-primary">Add Event</a>
                </div>
                <div class="uk-width-1-1">
                    <table class="uk-table uk-striped">
                        <thead>
                            <tr>
                                <th>Event Name</th>
                                <th>Location</th>
                                <th>Starts</th>
                                <th>Ends</th>
                                <th>Host</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for event in events %}
                                <tr>
                                    <td><a href="https://events.treehousefullofstars.com/{{event['id']}}" target="_blank">{{event['name']}}</a></td>
                                    <td>{{event['location']}}</td>
                                    <td>{{event['start']}}</td>
                                    <td>{{event['end']}}</td>
                                    <td>{{event['hostName']}}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </body>
    <script>
        var mode = false
        async function toggleDarkMode() {
            let darkMode = document.getElementById("dark-mode");    
            darkMode.disabled = !darkMode.disabled;
            mode = !mode;
            if(mode){
                document.getElementById('modeToggle').innerHTML = "light_mode"
                document.getElementById('main_html').classList.add('uk-light')
            } else {
                document.getElementById('modeToggle').innerHTML = "dark_mode"
                document.getElementById('main_html').classList.remove('uk-light')
            }
        }
    </script>
</html>