Skip to content

Commit b373427

Browse files
committed
add feedback button in sidebar
1 parent d2a4d60 commit b373427

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

resources/js/Components/UserSettingsIcon.vue

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
ArrowLeftOnRectangleIcon,
1515
ChatBubbleLeftRightIcon,
1616
} from '@heroicons/vue/24/solid';
17+
import { openFeedback } from '@/utils/feedback';
1718
1819
const page = usePage<{
1920
has_services_extension?: boolean;
@@ -34,16 +35,6 @@ const page = usePage<{
3435
const logout = () => {
3536
router.post(route('logout'));
3637
};
37-
38-
const openFeedback = () => {
39-
if (
40-
typeof window !== 'undefined' &&
41-
'showChatWindow' in window &&
42-
typeof window.showChatWindow === 'function'
43-
) {
44-
window.showChatWindow();
45-
}
46-
};
4738
</script>
4839
<template>
4940
<div class="relative">
@@ -53,7 +44,7 @@ const openFeedback = () => {
5344
as-child>
5445
<button data-testid="current_user_button">
5546
<img
56-
class="h-8 w-8 rounded-full object-cover"
47+
class="h-7 w-7 rounded-full object-cover"
5748
:src="page.props.auth.user.profile_photo_url"
5849
:alt="page.props.auth.user.name" />
5950
</button>

resources/js/Layouts/AppLayout.vue

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import { api } from '@/packages/api/src';
4747
import { getCurrentOrganizationId } from '@/utils/useUser';
4848
import LoadingSpinner from '@/packages/ui/src/LoadingSpinner.vue';
4949
import { twMerge } from 'tailwind-merge';
50+
import Button from '@/Components/ui/button/Button.vue';
51+
import { openFeedback } from '@/utils/feedback';
5052
5153
defineProps({
5254
title: String,
@@ -94,8 +96,8 @@ onMounted(async () => {
9496
}, 100);
9597
};
9698
});
97-
9899
const page = usePage<{
100+
has_services_extension?: boolean;
99101
auth: {
100102
user: User;
101103
};
@@ -242,14 +244,23 @@ const page = usePage<{
242244
<div class="justify-self-end">
243245
<UpdateSidebarNotification></UpdateSidebarNotification>
244246
<ul
245-
class="border-t border-default-background-separator pt-3 flex justify-between pr-4 items-center">
247+
class="border-t border-default-background-separator pt-3 gap-1 pr-2 flex justify-between items-center">
248+
<UserSettingsIcon></UserSettingsIcon>
249+
246250
<NavigationSidebarItem
247251
class="flex-1"
248252
title="Profile Settings"
249253
:icon="Cog6ToothIcon"
250254
:href="route('profile.show')"></NavigationSidebarItem>
251255

252-
<UserSettingsIcon></UserSettingsIcon>
256+
<Button
257+
v-if="page.props.has_services_extension"
258+
variant="outline"
259+
size="xs"
260+
class="rounded-full ml-2 flex h-6 w-6 items-center text-xs text-icon-default justify-center"
261+
@click="openFeedback">
262+
?
263+
</Button>
253264
</ul>
254265
</div>
255266
</div>

resources/js/utils/feedback.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export function openFeedback(): void {
2+
if (
3+
typeof window !== 'undefined' &&
4+
'showChatWindow' in window &&
5+
typeof window.showChatWindow === 'function'
6+
) {
7+
window.showChatWindow();
8+
}
9+
}

0 commit comments

Comments
 (0)