Raise feedback FAB and add occasional nudge bubble

- Move the floating feedback button up above the message compose bar
  so it no longer overlaps the input/send controls.
- Add a small dismissible speech bubble inviting feedback, shown once
  ~45s after load and at most every 3 days (tracked via localStorage),
  auto-hiding after 14s if not interacted with.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-09-10 08:23:50 +02:00
1 parent d48172f4d1
commit 6c764578a7
3 files changed
+139 -10

No files matched your search

+71 -8
View File
@@ -1566,6 +1566,76 @@ function ChannelPasswordDialog({
);
}
const FEEDBACK_BUBBLE_STORAGE_KEY = "webspeak3.feedbackBubble.lastShown";
const FEEDBACK_BUBBLE_MIN_INTERVAL_MS = 3 * 24 * 60 * 60 * 1000; // don't nag more than every 3 days
const FEEDBACK_BUBBLE_INITIAL_DELAY_MS = 45_000;
const FEEDBACK_BUBBLE_AUTO_HIDE_MS = 14_000;
function FeedbackFab({ onOpen }: { onOpen: () => void }) {
const t = useT();
const [bubbleVisible, setBubbleVisible] = useState(false);
useEffect(() => {
let lastShown = 0;
try {
lastShown = Number(localStorage.getItem(FEEDBACK_BUBBLE_STORAGE_KEY) || 0);
} catch {
// localStorage unavailable - just skip the nudge
return;
}
if (Date.now() - lastShown < FEEDBACK_BUBBLE_MIN_INTERVAL_MS) return;
const showTimer = window.setTimeout(() => {
setBubbleVisible(true);
try {
localStorage.setItem(FEEDBACK_BUBBLE_STORAGE_KEY, String(Date.now()));
} catch {
// ignore
}
}, FEEDBACK_BUBBLE_INITIAL_DELAY_MS);
return () => window.clearTimeout(showTimer);
}, []);
useEffect(() => {
if (!bubbleVisible) return;
const hideTimer = window.setTimeout(() => setBubbleVisible(false), FEEDBACK_BUBBLE_AUTO_HIDE_MS);
return () => window.clearTimeout(hideTimer);
}, [bubbleVisible]);
return (
<div className="ts-feedback-fab-wrap">
{bubbleVisible && (
<div className="ts-feedback-bubble" onClick={onOpen}>
<button
type="button"
className="ts-feedback-bubble-close"
onClick={(e) => {
e.stopPropagation();
setBubbleVisible(false);
}}
title={t("feedback.dialog.cancel")}
>
✕
</button>
{t("feedback.fab.nudge")}
</div>
)}
<button
type="button"
className="ts-feedback-fab"
onClick={() => {
setBubbleVisible(false);
onOpen();
}}
title={t("menu.extras.feedback")}
>
💬
</button>
</div>
);
}
type FeedbackCategory = "bug" | "idea" | "other";
function FeedbackDialog({ onClose }: { onClose: () => void }) {
@@ -8573,14 +8643,7 @@ function AppInner() {
)}
{IS_OWN_HOSTED_INSTANCE && !feedbackOpen && (
<button
type="button"
className="ts-feedback-fab"
onClick={() => setFeedbackOpen(true)}
title={t("menu.extras.feedback")}
>
💬
</button>
<FeedbackFab onOpen={() => setFeedbackOpen(true)} />
)}
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}