Merge pull request #15477 from itk-dev/feature/accessibility-user-settings

Feat: accessibility user settings dropdown menu
This commit is contained in:
Tim Jaeryang Baek 2025-07-02 14:22:37 +04:00 committed by GitHub
commit a3c9b46e9a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 23 additions and 20 deletions

View file

@ -173,19 +173,19 @@
} }
}} }}
> >
<button <div
class="select-none flex rounded-xl p-1.5 w-full hover:bg-gray-50 dark:hover:bg-gray-850 transition" class="select-none flex rounded-xl p-1.5 w-full hover:bg-gray-50 dark:hover:bg-gray-850 transition"
aria-label="User Menu"
> >
<div class=" self-center"> <div class=" self-center">
<span class="sr-only">{$i18n.t('User menu')}</span>
<img <img
src={$user?.profile_image_url} src={$user?.profile_image_url}
class="size-6 object-cover rounded-full" class="size-6 object-cover rounded-full"
alt="User profile" alt=""
draggable="false" draggable="false"
/> />
</div> </div>
</button> </div>
</UserMenu> </UserMenu>
{/if} {/if}
</div> </div>

View file

@ -9,6 +9,7 @@
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
aria-hidden="true"
class={className} class={className}
> >
<path <path

View file

@ -7,6 +7,7 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fill="none" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"
aria-hidden="true"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
class={className} class={className}

View file

@ -7,6 +7,7 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fill="none" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"
aria-hidden="true"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
class={className} class={className}

View file

@ -9,6 +9,7 @@
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
aria-hidden="true"
class={className} class={className}
> >
<path <path

View file

@ -9,6 +9,7 @@
viewBox="0 0 24 24" viewBox="0 0 24 24"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
aria-hidden="true"
class={className} class={className}
> >
<path <path

View file

@ -8,6 +8,7 @@
fill-rule="evenodd" fill-rule="evenodd"
d="M3 4.25A2.25 2.25 0 015.25 2h5.5A2.25 2.25 0 0113 4.25v2a.75.75 0 01-1.5 0v-2a.75.75 0 00-.75-.75h-5.5a.75.75 0 00-.75.75v11.5c0 .414.336.75.75.75h5.5a.75.75 0 00.75-.75v-2a.75.75 0 011.5 0v2A2.25 2.25 0 0110.75 18h-5.5A2.25 2.25 0 013 15.75V4.25z" d="M3 4.25A2.25 2.25 0 015.25 2h5.5A2.25 2.25 0 0113 4.25v2a.75.75 0 01-1.5 0v-2a.75.75 0 00-.75-.75h-5.5a.75.75 0 00-.75.75v11.5c0 .414.336.75.75.75h5.5a.75.75 0 00.75-.75v-2a.75.75 0 011.5 0v2A2.25 2.25 0 0110.75 18h-5.5A2.25 2.25 0 013 15.75V4.25z"
clip-rule="evenodd" clip-rule="evenodd"
aria-hidden="true"
/> />
<path <path
fill-rule="evenodd" fill-rule="evenodd"

View file

@ -7,6 +7,7 @@
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
fill="none" fill="none"
viewBox="0 0 24 24" viewBox="0 0 24 24"
aria-hidden="true"
stroke-width={strokeWidth} stroke-width={strokeWidth}
stroke="currentColor" stroke="currentColor"
class={className} class={className}

View file

@ -72,7 +72,7 @@
align="start" align="start"
transition={(e) => fade(e, { duration: 100 })} transition={(e) => fade(e, { duration: 100 })}
> >
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => { on:click={async () => {
await showSettings.set(true); await showSettings.set(true);
@ -87,9 +87,9 @@
<Settings className="w-5 h-5" strokeWidth="1.5" /> <Settings className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Settings')}</div> <div class=" self-center truncate">{$i18n.t('Settings')}</div>
</button> </DropdownMenu.Item>
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={() => { on:click={() => {
dispatch('show', 'archived-chat'); dispatch('show', 'archived-chat');
@ -104,44 +104,40 @@
<ArchiveBox className="size-5" strokeWidth="1.5" /> <ArchiveBox className="size-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Archived Chats')}</div> <div class=" self-center truncate">{$i18n.t('Archived Chats')}</div>
</button> </DropdownMenu.Item>
{#if role === 'admin'} {#if role === 'admin'}
<a <DropdownMenu.Item
href="/playground"
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/playground');
}} }}
rel="noopener noreferrer"
draggable="false"
> >
<div class=" self-center mr-3"> <div class=" self-center mr-3">
<Code className="size-5" strokeWidth="1.5" /> <Code className="size-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Playground')}</div> <div class=" self-center truncate">{$i18n.t('Playground')}</div>
</a> </DropdownMenu.Item>
<a <DropdownMenu.Item
href="/admin"
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition select-none"
on:click={() => { on:click={() => {
show = false; show = false;
if ($mobile) { if ($mobile) {
showSidebar.set(false); showSidebar.set(false);
} }
goto('/admin');
}} }}
rel="noopener noreferrer"
draggable="false"
> >
<div class=" self-center mr-3"> <div class=" self-center mr-3">
<UserGroup className="w-5 h-5" strokeWidth="1.5" /> <UserGroup className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div> <div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
</a> </DropdownMenu.Item>
{/if} {/if}
{#if help} {#if help}
@ -188,7 +184,7 @@
<hr class=" border-gray-100 dark:border-gray-800 my-1 p-0" /> <hr class=" border-gray-100 dark:border-gray-800 my-1 p-0" />
<button <DropdownMenu.Item
class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition" class="flex rounded-md py-1.5 px-3 w-full hover:bg-gray-50 dark:hover:bg-gray-800 transition"
on:click={async () => { on:click={async () => {
const res = await userSignOut(); const res = await userSignOut();
@ -203,7 +199,7 @@
<SignOut className="w-5 h-5" strokeWidth="1.5" /> <SignOut className="w-5 h-5" strokeWidth="1.5" />
</div> </div>
<div class=" self-center truncate">{$i18n.t('Sign Out')}</div> <div class=" self-center truncate">{$i18n.t('Sign Out')}</div>
</button> </DropdownMenu.Item>
{#if usage} {#if usage}
{#if usage?.user_ids?.length > 0} {#if usage?.user_ids?.length > 0}