feat(sidebar): Share feedback opens the Crisp chat instead of GitHub

The Crisp web SDK is loaded via GTM, so call $crisp chat:show + chat:open
on click. NavSupport now supports action items (button) alongside links.
This commit is contained in:
Paulo Castellano 2026-06-22 17:28:27 -03:00
parent 28019cee54
commit 216d962288
2 changed files with 28 additions and 7 deletions

View file

@ -149,11 +149,17 @@ const workspaceNavItems = computed<NavItem[]>(() => [
: []),
]);
const supportNavItems = computed<NavItem[]>(() => [
const openFeedbackChat = () => {
const crisp = (window as Window & { $crisp?: { push: (command: unknown[]) => void } }).$crisp;
crisp?.push(['do', 'chat:show']);
crisp?.push(['do', 'chat:open']);
};
const supportNavItems = computed(() => [
{
title: trans('sidebar.support.share_feedback'),
href: 'https://github.com/trypost-it/trypost/discussions',
icon: IconMessageCircle,
action: openFeedbackChat,
},
{
title: trans('sidebar.support.referral'),

View file

@ -1,4 +1,6 @@
<script setup lang="ts">
import type { Component } from 'vue';
import {
SidebarGroup,
SidebarGroupLabel,
@ -6,11 +8,16 @@ import {
SidebarMenuButton,
SidebarMenuItem,
} from '@/components/ui/sidebar';
import { toUrl } from '@/lib/utils';
import { type NavItem } from '@/types';
interface SupportNavItem {
title: string;
icon: Component;
href?: string;
action?: () => void;
}
interface Props {
items: NavItem[];
items: SupportNavItem[];
label: string;
}
@ -22,8 +29,16 @@ defineProps<Props>();
<SidebarGroupLabel>{{ label }}</SidebarGroupLabel>
<SidebarMenu>
<SidebarMenuItem v-for="item in items" :key="item.title">
<SidebarMenuButton as-child :tooltip="item.title">
<a :href="toUrl(item.href)" target="_blank" rel="noopener noreferrer">
<SidebarMenuButton
v-if="item.action"
:tooltip="item.title"
@click="item.action"
>
<component :is="item.icon" />
<span>{{ item.title }}</span>
</SidebarMenuButton>
<SidebarMenuButton v-else as-child :tooltip="item.title">
<a :href="item.href" target="_blank" rel="noopener noreferrer">
<component :is="item.icon" />
<span>{{ item.title }}</span>
</a>