{{define "menuItems"}}
<a-menu-item key="{{ .base_path }}xui/">
    <a-icon type="dashboard"></a-icon>
    <span>系统状态</span>
</a-menu-item>
<a-menu-item key="{{ .base_path }}xui/inbounds">
    <a-icon type="user"></a-icon>
    <span>入站列表</span>
</a-menu-item>
<a-menu-item key="{{ .base_path }}xui/setting">
    <a-icon type="setting"></a-icon>
    <span>面板设置</span>
</a-menu-item>
<!--<a-menu-item key="{{ .base_path }}xui/clients">-->
<!--    <a-icon type="laptop"></a-icon>-->
<!--    <span>客户端</span>-->
<!--</a-menu-item>-->
<a-sub-menu>
    <template slot="title">
        <a-icon type="link"></a-icon>
        <span>其他</span>
    </template>
    <a-menu-item key="https://github.com/vaxilu/x-ui/">
        <a-icon type="github"></a-icon>
        <span>Github</span>
    </a-menu-item>
</a-sub-menu>
<a-menu-item key="{{ .base_path }}logout">
    <a-icon type="logout"></a-icon>
    <span>退出登录</span>
</a-menu-item>
{{end}}


{{define "commonSider"}}
<a-layout-sider id="sider" collapsible breakpoint="md" collapsed-width="0">
    <a-menu theme="dark" mode="inline" :selected-keys="['{{ .request_uri }}']"
            @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
        {{template "menuItems" .}}
    </a-menu>
</a-layout-sider>
<a-drawer id="sider-drawer" placement="left" :closable="false"
          @close="siderDrawer.close()"
          :visible="siderDrawer.visible" :wrap-style="{ padding: 0 }">
    <div class="drawer-handle" @click="siderDrawer.change()" slot="handle">
        <a-icon :type="siderDrawer.visible ? 'close' : 'menu-fold'"></a-icon>
    </div>
    <a-menu theme="light" mode="inline" :selected-keys="['{{ .request_uri }}']"
        @click="({key}) => key.startsWith('http') ? window.open(key) : location.href = key">
        {{template "menuItems" .}}
    </a-menu>
</a-drawer>
<script>

    const siderDrawer = {
        visible: false,
        show() {
            this.visible = true;
        },
        close() {
            this.visible = false;
        },
        change() {
            this.visible = !this.visible;
        }
    };

</script>
{{end}}