Compare commits

...

6 Commits

Author SHA1 Message Date
Gregor Vostrak
4623697f79 add feedback button in sidebar 2025-10-01 13:10:29 +02:00
Gregor Vostrak
1c787a0ad0 clarify UserSettingsIcon Dropdown Profile Settings Item Description 2025-10-01 12:15:46 +02:00
Gregor Vostrak
5e678edb9d remove bottom padding for toast container
This became redundant due to the floating feedback bubble removal
2025-09-30 16:58:24 +02:00
Gregor Vostrak
65e145b20f improve focus states and keyboard navigation for organization switcher and user settings dropdown 2025-09-30 16:45:48 +02:00
Gregor Vostrak
d2b636842a update organization switcher to use shadcn dropdownmenu 2025-09-30 16:28:17 +02:00
Gregor Vostrak
1510884f3b change profile dropdown to shadcn, add feedback entry 2025-09-30 13:10:55 +02:00
7 changed files with 149 additions and 109 deletions

View File

@@ -41,7 +41,8 @@ class HandleInertiaRequests extends Middleware
{ {
$hasBilling = Module::has('Billing') && Module::isEnabled('Billing'); $hasBilling = Module::has('Billing') && Module::isEnabled('Billing');
$hasInvoicing = Module::has('Invoicing') && Module::isEnabled('Invoicing'); $hasInvoicing = Module::has('Invoicing') && Module::isEnabled('Invoicing');
$hasServices = Module::has('Services') && Module::isEnabled('Services');
/** @var BillingContract $billing */ /** @var BillingContract $billing */
$billing = app(BillingContract::class); $billing = app(BillingContract::class);
@@ -50,6 +51,7 @@ class HandleInertiaRequests extends Middleware
return array_merge(parent::share($request), [ return array_merge(parent::share($request), [
'has_billing_extension' => $hasBilling, 'has_billing_extension' => $hasBilling,
'has_invoicing_extension' => $hasInvoicing, 'has_invoicing_extension' => $hasInvoicing,
'has_services_extension' => $hasServices,
'billing' => $currentOrganization !== null ? [ 'billing' => $currentOrganization !== null ? [
'has_subscription' => $billing->hasSubscription($currentOrganization), 'has_subscription' => $billing->hasSubscription($currentOrganization),
'has_trial' => $billing->hasTrial($currentOrganization), 'has_trial' => $billing->hasTrial($currentOrganization),

View File

@@ -1,7 +1,7 @@
<template> <template>
<div <div
aria-live="assertive" aria-live="assertive"
class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6 sm:pb-24 z-[70]"> class="pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-end sm:p-6 z-[70]">
<div class="flex w-full flex-col items-center space-y-4 sm:items-end"> <div class="flex w-full flex-col items-center space-y-4 sm:items-end">
<Notification <Notification
v-for="notification in notifications" v-for="notification in notifications"

View File

@@ -1,12 +1,23 @@
<script setup lang="ts"> <script setup lang="ts">
import { ChevronDownIcon } from '@heroicons/vue/20/solid'; import { ChevronDownIcon } from '@heroicons/vue/20/solid';
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue'; import { Link, usePage } from '@inertiajs/vue3';
import DropdownLink from '@/Components/DropdownLink.vue'; import {
import { usePage } from '@inertiajs/vue3'; Cog6ToothIcon,
PlusCircleIcon,
CheckCircleIcon,
ArrowRightIcon,
} from '@heroicons/vue/24/solid';
import type { Organization, User } from '@/types/models'; import type { Organization, User } from '@/types/models';
import { isBillingActivated } from '@/utils/billing'; import { isBillingActivated } from '@/utils/billing';
import { canManageBilling } from '@/utils/permissions'; import { canManageBilling } from '@/utils/permissions';
import { switchOrganization } from '@/utils/useOrganization'; import { switchOrganization } from '@/utils/useOrganization';
import {
DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
} from '@/Components/ui/dropdown-menu';
const page = usePage<{ const page = usePage<{
jetstream: { jetstream: {
@@ -28,84 +39,79 @@ const switchToTeam = (organization: Organization) => {
</script> </script>
<template> <template>
<Dropdown v-if="page.props.jetstream.hasTeamFeatures" align="center" width="60"> <DropdownMenu v-if="page.props.jetstream.hasTeamFeatures">
<template #trigger> <DropdownMenuTrigger
<div class="flex w-full text-left hover:bg-white/10 focus-visible:ring-2 focus-visible:ring-ring cursor-pointer transition pl-2 py-1 rounded w-full items-center justify-between"
data-testid="organization_switcher" as-child>
class="flex hover:bg-white/10 cursor-pointer transition px-2 py-1 rounded-lg w-full items-center justify-between font-medium"> <button data-testid="organization_switcher">
<div class="flex flex-1 space-x-2 items-center w-[calc(100%-30px)]"> <div class="flex flex-1 space-x-2 items-center w-[calc(100%-30px)]">
<div <div
class="rounded sm:rounded-lg bg-blue-900 font-semibold text-xs sm:text-sm flex-shrink-0 text-white w-5 sm:w-6 h-5 sm:h-6 flex items-center justify-center"> class="rounded bg-blue-900 font-medium text-xs flex-shrink-0 text-white w-5 h-5 flex items-center justify-center">
{{ page.props.auth.user.current_team.name.slice(0, 1).toUpperCase() }} {{ page.props.auth.user.current_team.name.slice(0, 1).toUpperCase() }}
</div> </div>
<span class="text-sm flex-1 truncate font-semibold"> <span class="text-xs flex-1 truncate font-medium">
{{ page.props.auth.user.current_team.name }} {{ page.props.auth.user.current_team.name }}
</span> </span>
</div> </div>
<div class="w-[30px]"> <div class="w-[30px]">
<button <div class="p-1 rounded-full flex items-center w-6 h-6">
class="p-1 transition hover:bg-white/10 rounded-full flex items-center w-8 h-8"> <ChevronDownIcon class="w-4 sm:w-full mt-[1px]"></ChevronDownIcon>
<ChevronDownIcon class="w-5 sm:w-full mt-[1px]"></ChevronDownIcon> </div>
</button>
</div> </div>
</div> </button>
</template> </DropdownMenuTrigger>
<template #content> <DropdownMenuContent align="start">
<div class="w-60"> <div class="w-60">
<!-- Organization Management --> <DropdownMenuLabel>Manage Organization</DropdownMenuLabel>
<div class="block px-4 py-2 text-xs text-text-secondary">Manage Organization</div>
<!-- Organization Settings --> <DropdownMenuItem as-child>
<DropdownLink :href="route('teams.show', page.props.auth.user.current_team.id)"> <Link
Organization Settings :href="route('teams.show', page.props.auth.user.current_team.id)"
</DropdownLink> class="inline-flex items-center gap-2.5 w-full">
<Cog6ToothIcon class="w-5 h-5 text-icon-default" />
<span>Organization Settings</span>
</Link>
</DropdownMenuItem>
<DropdownLink v-if="canManageBilling() && isBillingActivated()" href="/billing"> <DropdownMenuItem v-if="canManageBilling() && isBillingActivated()" as-child>
Billing <Link href="/billing" class="inline-flex items-center w-full"> Billing </Link>
</DropdownLink> </DropdownMenuItem>
<DropdownLink <DropdownMenuItem v-if="page.props.jetstream.canCreateTeams" as-child>
v-if="page.props.jetstream.canCreateTeams" <Link
:href="route('teams.create')"> :href="route('teams.create')"
Create new organization class="inline-flex items-center gap-2.5 w-full">
</DropdownLink> <PlusCircleIcon class="w-5 h-5 text-icon-default" />
<span>Create new organization</span>
</Link>
</DropdownMenuItem>
<!-- Organization Switcher -->
<template v-if="page.props.auth.user.all_teams.length > 1"> <template v-if="page.props.auth.user.all_teams.length > 1">
<div class="border-t border-card-background-separator" /> <div class="border-t border-card-background-separator" />
<div class="block px-4 py-2 text-xs text-text-secondary"> <DropdownMenuLabel>Switch Organizations</DropdownMenuLabel>
Switch Organizations
</div>
<template v-for="team in page.props.auth.user.all_teams" :key="team.id"> <template v-for="team in page.props.auth.user.all_teams" :key="team.id">
<form @submit.prevent="switchToTeam(team)"> <form @submit.prevent="switchToTeam(team)">
<DropdownLink as="button"> <DropdownMenuItem
<div class="flex items-center"> as-child
<svg class="inline-flex gap-2.5 items-center w-full">
<button type="submit">
<CheckCircleIcon
v-if="team.id == page.props.auth.user.current_team_id" v-if="team.id == page.props.auth.user.current_team_id"
class="me-2 h-5 w-5 text-green-400" class="h-5 w-5 text-green-400" />
xmlns="http://www.w3.org/2000/svg" <ArrowRightIcon v-else class="h-5 w-5 text-icon-default" />
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div> <div class="w-full truncate text-left">
{{ team.name }} {{ team.name }}
</div> </div>
</div> </button>
</DropdownLink> </DropdownMenuItem>
</form> </form>
</template> </template>
</template> </template>
</div> </div>
</template> </DropdownMenuContent>
</Dropdown> </DropdownMenu>
</template> </template>

View File

@@ -1,10 +1,24 @@
<script setup lang="ts"> <script setup lang="ts">
import { router, usePage } from '@inertiajs/vue3'; import { Link, router, usePage } from '@inertiajs/vue3';
import type { Organization, User } from '@/types/models'; import type { Organization, User } from '@/types/models';
import DropdownLink from '@/Components/DropdownLink.vue'; import {
import Dropdown from '@/packages/ui/src/Input/Dropdown.vue'; DropdownMenu,
DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
} from '@/Components/ui/dropdown-menu';
import {
UserCircleIcon,
KeyIcon,
ArrowLeftOnRectangleIcon,
ChatBubbleLeftRightIcon,
} from '@heroicons/vue/24/solid';
import { openFeedback } from '@/utils/feedback';
const page = usePage<{ const page = usePage<{
has_services_extension?: boolean;
has_billing_extension?: boolean;
jetstream: { jetstream: {
canCreateTeams: boolean; canCreateTeams: boolean;
hasTeamFeatures: boolean; hasTeamFeatures: boolean;
@@ -23,60 +37,58 @@ const logout = () => {
}; };
</script> </script>
<template> <template>
<div class="ms-3 relative"> <div class="relative">
<Dropdown align="center" width="48"> <DropdownMenu>
<template #trigger> <DropdownMenuTrigger
<button class="flex text-sm border-2 outline-none border-transparent rounded-full focus-visible:ring-2 focus-visible:ring-ring transition"
v-if="page.props.jetstream.managesProfilePhotos" as-child>
data-testid="current_user_button" <button data-testid="current_user_button">
class="flex text-sm border-2 border-transparent rounded-full focus:outline-none focus:border-gray-300 transition">
<img <img
class="h-8 w-8 rounded-full object-cover" class="h-7 w-7 rounded-full object-cover"
:src="page.props.auth.user.profile_photo_url" :src="page.props.auth.user.profile_photo_url"
:alt="page.props.auth.user.name" /> :alt="page.props.auth.user.name" />
</button> </button>
</DropdownMenuTrigger>
<DropdownMenuContent align="center" class="max-w-48">
<DropdownMenuLabel>Manage Account</DropdownMenuLabel>
<span v-else class="inline-flex rounded-md"> <DropdownMenuItem as-child>
<Link
:href="route('profile.show')"
class="inline-flex items-center gap-2.5 w-full">
<UserCircleIcon class="w-5 h-5 text-icon-default" />
<span>Profile Settings</span>
</Link>
</DropdownMenuItem>
<DropdownMenuItem v-if="page.props.jetstream.hasApiFeatures" as-child>
<Link
:href="route('api-tokens.index')"
class="inline-flex items-center gap-2.5 w-full">
<KeyIcon class="w-5 h-5 text-icon-default" />
<span>API Tokens</span>
</Link>
</DropdownMenuItem>
<DropdownMenuItem v-if="page.props.has_services_extension" as-child>
<button <button
type="button" type="button"
class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none focus:bg-gray-50 active:bg-gray-50 transition ease-in-out duration-150"> class="inline-flex items-center gap-2.5 w-full"
{{ page.props.auth.user.name }} @click="openFeedback">
<ChatBubbleLeftRightIcon class="w-5 h-5 text-icon-default" />
<svg <span>Feedback</span>
class="ms-2 -me-0.5 h-4 w-4"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor">
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M19.5 8.25l-7.5 7.5-7.5-7.5" />
</svg>
</button> </button>
</span> </DropdownMenuItem>
</template>
<template #content> <form class="w-full" @submit.prevent="logout">
<!-- Account Management --> <DropdownMenuItem as-child class="inline-flex items-center gap-2.5 w-full">
<div class="block px-4 py-2 text-xs text-gray-400">Manage Account</div> <button type="submit" data-testid="logout_button">
<ArrowLeftOnRectangleIcon class="w-5 h-5 text-icon-default" />
<DropdownLink :href="route('profile.show')"> Profile </DropdownLink> <span>Log Out</span>
</button>
<DropdownLink </DropdownMenuItem>
v-if="page.props.jetstream.hasApiFeatures"
:href="route('api-tokens.index')">
API Tokens
</DropdownLink>
<div class="border-t border-card-border" />
<!-- Authentication -->
<form @submit.prevent="logout">
<DropdownLink as="button" data-testid="logout_button"> Log Out </DropdownLink>
</form> </form>
</template> </DropdownMenuContent>
</Dropdown> </DropdownMenu>
</div> </div>
</template> </template>

View File

@@ -19,7 +19,7 @@ const forwardedProps = useForwardProps(delegatedProps);
<template> <template>
<DropdownMenuLabel <DropdownMenuLabel
v-bind="forwardedProps" v-bind="forwardedProps"
:class="cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', props.class)"> :class="cn('block px-2 py-2 text-xs text-gray-400', inset && 'pl-8', props.class)">
<slot /> <slot />
</DropdownMenuLabel> </DropdownMenuLabel>
</template> </template>

View File

@@ -47,6 +47,8 @@ import { api } from '@/packages/api/src';
import { getCurrentOrganizationId } from '@/utils/useUser'; import { getCurrentOrganizationId } from '@/utils/useUser';
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue'; import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
import Button from '@/Components/ui/button/Button.vue';
import { openFeedback } from '@/utils/feedback';
defineProps({ defineProps({
title: String, title: String,
@@ -94,8 +96,8 @@ onMounted(async () => {
}, 100); }, 100);
}; };
}); });
const page = usePage<{ const page = usePage<{
has_services_extension?: boolean;
auth: { auth: {
user: User; user: User;
}; };
@@ -106,7 +108,7 @@ const page = usePage<{
<div v-bind="$attrs" class="flex flex-wrap bg-background text-text-secondary"> <div v-bind="$attrs" class="flex flex-wrap bg-background text-text-secondary">
<div <div
:class="{ :class="{
'!flex bg-default-background w-full z-[9999999999]': showSidebarMenu, '!flex bg-default-background w-full z-30': showSidebarMenu,
}" }"
class="flex-shrink-0 h-screen hidden fixed w-[230px] 2xl:w-[250px] px-2.5 2xl:px-3 py-4 lg:flex flex-col justify-between"> class="flex-shrink-0 h-screen hidden fixed w-[230px] 2xl:w-[250px] px-2.5 2xl:px-3 py-4 lg:flex flex-col justify-between">
<div class="flex flex-col h-full"> <div class="flex flex-col h-full">
@@ -242,14 +244,23 @@ const page = usePage<{
<div class="justify-self-end"> <div class="justify-self-end">
<UpdateSidebarNotification></UpdateSidebarNotification> <UpdateSidebarNotification></UpdateSidebarNotification>
<ul <ul
class="border-t border-default-background-separator pt-3 flex justify-between pr-4 items-center"> class="border-t border-default-background-separator pt-3 gap-1 pr-2 flex justify-between items-center">
<UserSettingsIcon></UserSettingsIcon>
<NavigationSidebarItem <NavigationSidebarItem
class="flex-1" class="flex-1"
title="Profile Settings" title="Profile Settings"
:icon="Cog6ToothIcon" :icon="Cog6ToothIcon"
:href="route('profile.show')"></NavigationSidebarItem> :href="route('profile.show')"></NavigationSidebarItem>
<UserSettingsIcon></UserSettingsIcon> <Button
v-if="page.props.has_services_extension"
variant="outline"
size="xs"
class="rounded-full ml-2 flex h-6 w-6 items-center text-xs text-icon-default justify-center"
@click="openFeedback">
?
</Button>
</ul> </ul>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,9 @@
export function openFeedback(): void {
if (
typeof window !== 'undefined' &&
'showChatWindow' in window &&
typeof window.showChatWindow === 'function'
) {
window.showChatWindow();
}
}