Skip to content

Improve page link access and user experience #1178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,54 @@ const { t } = useI18n()
<!-- Header: Left side -->
<div class="flex items-center space-x-4">
<div v-if="displayStore.NavTitle && isMobile" class="pr-2">
<button class="flex p-2 rounded-sm hover:bg-slate-300 dark:hover:bg-slate-600 text-slate-500 dark:text-white" @click="back()">
<button
class="flex p-2 rounded-sm hover:bg-slate-300 dark:hover:bg-slate-600 text-slate-500 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
:aria-label="t('button-back')"
@click="back()"
>
<IconBack class="w-6 h-6 fill-current" />
<span class="hidden md:block">{{ t('button-back') }}</span>
</button>
</div>
<!-- Hamburger button -->
<button
class="text-slate-500 lg:hidden dark:text-white hover:text-slate-600 dark:hover:text-slate-50"
aria-controls="sidebar" :aria-expanded="props.sidebarOpen" @click.stop="$emit('toggleSidebar')"
class="text-slate-500 lg:hidden dark:text-white hover:text-slate-600 dark:hover:text-slate-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 rounded-md p-1"
aria-controls="sidebar"
:aria-expanded="props.sidebarOpen"
:aria-label="props.sidebarOpen ? t('close-sidebar') : t('open-sidebar')"
@click.stop="$emit('toggleSidebar')"
>
<span class="sr-only">{{ t('open-sidebar') }}</span>
<span class="sr-only">{{ props.sidebarOpen ? t('close-sidebar') : t('open-sidebar') }}</span>
<IconMenu class="w-6 h-6 fill-current" />
</button>

<!-- Title on desktop -->
<div class="hidden lg:block">
<div class="font-bold truncate text-md md:text-2xl text-dark dark:text-white flex items-center space-x-2">
<span v-if="$route.path !== '/' && $route.path !== '/app'" class="text-sm text-slate-600 dark:text-slate-400 font-normal">
<router-link to="/" class=" first-letter:uppercase hover:underline">
{{ t('home') }}
</router-link>
<template v-for="(breadcrumb, i) in displayStore.pathTitle" :key="i">
<span> / </span>
<router-link
:to="breadcrumb.path"
class="first-letter:uppercase hover:underline"
>
{{ breadcrumb.name.includes('.') ? breadcrumb.name : t(breadcrumb.name) }}
</router-link>
</template>
<span v-if="displayStore.NavTitle"> / </span>
</span>
<nav v-if="$route.path !== '/' && $route.path !== '/app'" class="text-sm text-slate-600 dark:text-slate-400 font-normal" aria-label="Breadcrumb">
<ol class="inline-flex items-center space-x-1">
<li>
<router-link
to="/"
class="first-letter:uppercase hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm px-1"
>
{{ t('home') }}
</router-link>
</li>
<li v-for="(breadcrumb, i) in displayStore.pathTitle" :key="i" class="flex items-center">
<span class="mx-1" aria-hidden="true"> / </span>
<router-link
:to="breadcrumb.path"
class="first-letter:uppercase hover:underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm px-1"
>
{{ breadcrumb.name.includes('.') ? breadcrumb.name : t(breadcrumb.name) }}
</router-link>
</li>
<li v-if="displayStore.NavTitle" class="flex items-center">
<span class="mx-1" aria-hidden="true"> / </span>
</li>
</ol>
</nav>
<span class="first-letter:uppercase">{{ displayStore.NavTitle }}</span>
</div>
</div>
Expand Down
22 changes: 16 additions & 6 deletions src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ const tabs = ref<Tab[]>([
label: 'documentation',
icon: shallowRef(IconDoc),
key: '#',
onClick: () => window.open('https://docs.capgo.app', '_blank'),
onClick: () => window.open('https://docs.capgo.app', '_blank', 'noopener,noreferrer'),
redirect: true,
},
{
label: 'discord',
icon: shallowRef(IconDiscord),
key: '#',
onClick: () => window.open('https://discord.capgo.app', '_blank'),
onClick: () => window.open('https://discord.capgo.app', '_blank', 'noopener,noreferrer'),
redirect: true,
},
])
Expand Down Expand Up @@ -93,8 +93,12 @@ const tabs = ref<Tab[]>([
>
<!-- Sidebar header -->
<div class="flex justify-between px-3 py-4 border-b border-slate-800 lg:px-6 lg:py-6 lg:border-b lg:border-slate-700 shrink-0">
<router-link class="flex items-center space-x-2 cursor-pointer lg:space-x-3" to="/app">
<img src="/capgo.webp" alt="logo" class="w-8 h-8">
<router-link
class="flex items-center space-x-2 cursor-pointer lg:space-x-3 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-slate-800 rounded-lg p-1"
to="/app"
aria-label="Capgo - Go to dashboard"
>
<img src="/capgo.webp" alt="Capgo logo" class="w-8 h-8">
<span class="text-xl font-semibold truncate transition duration-150 font-prompt text-slate-200 hover:text-white lg:text-slate-200 lg:hover:text-white">Capgo</span>
</router-link>
</div>
Expand All @@ -113,17 +117,23 @@ const tabs = ref<Tab[]>([
<ul class="space-y-1 lg:space-y-2">
<li v-for="tab, i in tabs" :key="i">
<button
class="flex items-center w-full p-2 transition duration-150 rounded-md text-slate-200 cursor-pointer hover:bg-slate-700/50 lg:p-3 lg:rounded-lg lg:text-slate-200 lg:hover:bg-slate-700/50"
class="flex items-center w-full p-3 transition duration-150 rounded-md text-slate-200 cursor-pointer hover:bg-slate-700/50 lg:p-3 lg:rounded-lg lg:text-slate-200 lg:hover:bg-slate-700/50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-slate-800 min-h-[44px]"
:class="{
'hover:bg-slate-700/50 lg:hover:bg-slate-700/50': !isTabActive(tab.key),
'bg-slate-700 text-white lg:bg-slate-700 lg:text-white': isTabActive(tab.key),
'cursor-default': isTabActive(tab.key),
}"
:aria-label="tab.redirect ? `${t(tab.label)} (opens in new tab)` : t(tab.label)"
:aria-current="isTabActive(tab.key) ? 'page' : undefined"
@click="openTab(tab)"
>
<component :is="tab.icon" class="w-5 h-5 shrink-0 transition-colors duration-150" :class="{ 'text-blue-500 lg:text-blue-500': isTabActive(tab.key), 'text-slate-400 group-hover:text-slate-300 lg:text-slate-400 lg:group-hover:text-slate-300': !isTabActive(tab.key) }" />
<span class="ml-3 text-sm font-medium first-letter:uppercase transition-colors duration-150" :class="{ 'text-blue-500 lg:text-blue-500': isTabActive(tab.key), 'text-slate-400 group-hover:text-slate-300 lg:text-slate-400 lg:group-hover:text-slate-300': !isTabActive(tab.key), 'underline': tab.redirect }">
<span class="ml-3 text-sm font-medium first-letter:uppercase transition-colors duration-150 flex items-center" :class="{ 'text-blue-500 lg:text-blue-500': isTabActive(tab.key), 'text-slate-400 group-hover:text-slate-300 lg:text-slate-400 lg:group-hover:text-slate-300': !isTabActive(tab.key), 'underline': tab.redirect }">
{{ t(tab.label) }}
<svg v-if="tab.redirect" class="w-3 h-3 ml-1 opacity-60" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path fill-rule="evenodd" d="M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" clip-rule="evenodd" />
<path fill-rule="evenodd" d="M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" clip-rule="evenodd" />
</svg>
</span>
</button>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/components/tables/LogTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ columns.value = [
class: 'truncate max-w-8',
sortable: true,
head: true,
onClick: () => window.open(DOC_LOGS, '_blank'),
onClick: () => window.open(DOC_LOGS, '_blank', 'noopener,noreferrer'),
},
{
label: t('version'),
Expand Down
24 changes: 22 additions & 2 deletions src/pages/ApiKeys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,31 @@ getKeys()
{{ t('api-keys-are-used-for-cli-and-public-api') }}
</p>
<div class="mx-3 mb-2 md:mx-auto">
<a class="text-blue-500 underline" href="https://capgo.app/docs/tooling/cli/" target="_blank">
<a
class="text-blue-500 underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm inline-flex items-center"
href="https://capgo.app/docs/tooling/cli/"
target="_blank"
rel="noopener noreferrer"
:aria-label="`${t('cli-doc')} (opens in new tab)`"
>
{{ t('cli-doc') }}
<svg class="w-3 h-3 ml-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path fill-rule="evenodd" d="M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" clip-rule="evenodd" />
<path fill-rule="evenodd" d="M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" clip-rule="evenodd" />
</svg>
</a>
<a class="ml-1 text-blue-500 underline" href="https://capgo.app/docs/tooling/api/" target="_blank">
<a
class="ml-1 text-blue-500 underline focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded-sm inline-flex items-center"
href="https://capgo.app/docs/tooling/api/"
target="_blank"
rel="noopener noreferrer"
:aria-label="`${t('api-doc')} (opens in new tab)`"
>
{{ t('api-doc') }}
<svg class="w-3 h-3 ml-1" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path fill-rule="evenodd" d="M4.25 5.5a.75.75 0 00-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 00.75-.75v-4a.75.75 0 011.5 0v4A2.25 2.25 0 0112.75 17h-8.5A2.25 2.25 0 012 14.75v-8.5A2.25 2.25 0 014.25 4h5a.75.75 0 010 1.5h-5z" clip-rule="evenodd" />
<path fill-rule="evenodd" d="M6.194 12.753a.75.75 0 001.06.053L16.5 4.44v2.81a.75.75 0 001.5 0v-4.5a.75.75 0 00-.75-.75h-4.5a.75.75 0 000 1.5h2.553l-9.056 8.194a.75.75 0 00-.053 1.06z" clip-rule="evenodd" />
</svg>
</a>
</div>
</div>
Expand Down
Loading