From e08edb67f1d1908dcf13f04e80bc9e211f91ed15 Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Tue, 28 Jul 2026 10:53:45 +0200 Subject: [PATCH] feat(feedback): cut over to the FleetCrown embeddable widget Swap the in-repo React suggestion widget (SuggestionButton) for the FleetCrown script-tag embed. Visitor feedback now lands in the FleetCrown project inbox (triage + dispatch-to-agent) instead of site_suggestions. data-fc-bottom=88 stacks the FAB above HirnPublicFab. The retired React widget files stay in place this commit for easy revert; the admin inbox and /api/suggestions remain for historical data. Co-Authored-By: Claude Fable 5 --- .../feedback/FleetCrownFeedbackEmbed.tsx | 34 +++++++++++++++++++ src/components/layout/MainLayout.tsx | 4 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/components/feedback/FleetCrownFeedbackEmbed.tsx diff --git a/src/components/feedback/FleetCrownFeedbackEmbed.tsx b/src/components/feedback/FleetCrownFeedbackEmbed.tsx new file mode 100644 index 000000000..72da0028f --- /dev/null +++ b/src/components/feedback/FleetCrownFeedbackEmbed.tsx @@ -0,0 +1,34 @@ +'use client' + +import { useEffect } from 'react' + +const WIDGET_SRC = 'https://fleetcrown.orangecat.ch/widget.js' +const PROJECT_TOKEN = 'fcw_45baa3d5c31f7cde10d65c168f6b9df9' +/** Sits above HirnPublicFab (bottom-6 + h-14 ≈ 80px) so the two FABs stack. */ +const BOTTOM_OFFSET_PX = '88' + +/** + * FleetCrown embeddable feedback widget (revampit = customer #1). + * + * Replaces the in-repo React widget (SuggestionButton et al.): feedback now + * flows into the FleetCrown project inbox where it can be dispatched to an + * agent as a fix-task, instead of the local site_suggestions table. The token + * is write-only and public by design; the server enforces an Origin allowlist + * (www.revamp-it.ch / revamp-it.ch), so the widget renders on localhost but + * submissions only succeed from prod. + */ +export function FleetCrownFeedbackEmbed() { + useEffect(() => { + if (document.querySelector(`script[src="${WIDGET_SRC}"]`)) return + const script = document.createElement('script') + script.src = WIDGET_SRC + script.async = true + script.setAttribute('data-fc-project', PROJECT_TOKEN) + script.setAttribute('data-fc-bottom', BOTTOM_OFFSET_PX) + document.body.appendChild(script) + // No cleanup: the widget mounts once per page load and MainLayout wraps + // every non-lean page, so unmount/remount churn would only flicker the FAB. + }, []) + + return null +} diff --git a/src/components/layout/MainLayout.tsx b/src/components/layout/MainLayout.tsx index c9fc621e3..7ec76ea8d 100644 --- a/src/components/layout/MainLayout.tsx +++ b/src/components/layout/MainLayout.tsx @@ -4,7 +4,7 @@ import { ReactNode } from 'react' import { Header } from './header' import Footer from './Footer' import { HirnPublicFab } from '@/components/hirn/HirnPublicFab' -import SuggestionButton from '@/components/feedback/SuggestionButton' +import { FleetCrownFeedbackEmbed } from '@/components/feedback/FleetCrownFeedbackEmbed' interface MainLayoutProps { children: ReactNode @@ -26,7 +26,7 @@ export default function MainLayout({ children, leanChrome = false }: MainLayoutP {!leanChrome && ( <> - + )}