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 && ( <> - + )}