<?php
$accountUrl = accountUrl();
$accountName = currentUserDisplayName();
$accountTooltip = $accountName !== '' ? $accountName : t('Account');
$layoutAuth = is_array($viewAuth['layout'] ?? null) ? $viewAuth['layout'] : [];
$hasAdminPanel = layoutHasAdminPanel($layoutAuth);
$canViewAddressBook = (bool) ($layoutAuth['can_view_address_book'] ?? false);
$addressBookUrl = lurl('address-book');
?>
<aside class="aside-icon-bar" data-aside-storage="app-sidebar-panel">
    <nav>
        <ul class="aside-icon-group" role="tablist" aria-orientation="vertical">
            <li>
                <button type="button" id="aside-tab-explorer" data-aside-target="explorer" role="tab"
                    aria-selected="true" aria-controls="aside-panel-explorer" aria-label="<?php e(t('Explorer')); ?>"
                    data-tooltip="<?php e(t('Explorer')); ?>" data-tooltip-pos="right">
                    <i class="bi bi-house"></i>
                </button>
            </li>
            <li>
                <button type="button" id="aside-tab-search" data-aside-target="search" role="tab" aria-selected="false"
                    aria-controls="aside-panel-search" aria-label="<?php e(t('Search')); ?>"
                    data-tooltip="<?php e(t('Search')); ?>" data-tooltip-pos="right">
                    <i class="bi bi-search"></i>
                </button>
            </li>
            <?php if ($canViewAddressBook): ?>
                <li>
                    <button type="button" id="aside-tab-people" data-aside-target="people"
                        data-aside-href="<?php e($addressBookUrl); ?>" role="tab" aria-selected="false"
                        aria-controls="aside-panel-people" aria-label="<?php e(t('Address book')); ?>"
                        data-tooltip="<?php e(t('Address book')); ?>" data-tooltip-pos="right">
                        <i class="bi bi-people"></i>
                    </button>
                </li>
            <?php endif; ?>
            <li>
                <button type="button" id="aside-tab-files" data-aside-target="files" role="tab" aria-selected="false"
                    aria-controls="aside-panel-files" aria-label="<?php e(t('Files')); ?>"
                    data-tooltip="<?php e(t('Files')); ?>" data-tooltip-pos="right">
                    <i class="bi bi-folder"></i>
                </button>
            </li>
            <?php if ($hasAdminPanel): ?>
                <li>
                    <button type="button" id="aside-tab-admin" data-aside-target="admin" role="tab" aria-selected="false"
                        aria-controls="aside-panel-admin" aria-label="<?php e(t('Admin')); ?>"
                        data-tooltip="<?php e(t('Admin')); ?>" data-tooltip-pos="right">
                        <i class="bi bi-shield-lock"></i>
                    </button>
                </li>
            <?php endif; ?>
        </ul>
        <ul role="list">
            <li>
                <a href="<?php e($accountUrl); ?>" aria-label="<?php e(t('Account')); ?>"
                    data-tooltip="<?php e($accountTooltip); ?>" data-tooltip-pos="right" data-aside-shortcut="account"><i
                        class="bi bi-person-circle"></i></a>
            </li>


        </ul>
    </nav>
</aside>
