mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 09:52:50 +08:00
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:
1 parent
d48172f4d1
commit
6c764578a7
3 files changed
+139
-10
No files matched your search
+66
-2
@@ -3457,11 +3457,18 @@
|
|||||||
max-width: 90vw;
|
max-width: 90vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ts-feedback-fab {
|
.ts-feedback-fab-wrap {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 1.25rem;
|
right: 1.25rem;
|
||||||
bottom: 1.25rem;
|
bottom: 5.5rem;
|
||||||
z-index: 500;
|
z-index: 500;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ts-feedback-fab {
|
||||||
width: 3rem;
|
width: 3rem;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
@@ -3483,6 +3490,63 @@
|
|||||||
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ts-feedback-bubble {
|
||||||
|
position: relative;
|
||||||
|
max-width: 13rem;
|
||||||
|
background: var(--panel-bg, #23262e);
|
||||||
|
color: var(--text, #eee);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 0.6rem;
|
||||||
|
padding: 0.5rem 0.7rem;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.35;
|
||||||
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
|
||||||
|
animation: ts-feedback-bubble-in 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ts-feedback-bubble::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
right: 1.1rem;
|
||||||
|
bottom: -0.4rem;
|
||||||
|
width: 0.8rem;
|
||||||
|
height: 0.8rem;
|
||||||
|
background: inherit;
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ts-feedback-bubble-close {
|
||||||
|
position: absolute;
|
||||||
|
top: -0.4rem;
|
||||||
|
right: -0.4rem;
|
||||||
|
width: 1.1rem;
|
||||||
|
height: 1.1rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--panel-bg, #23262e);
|
||||||
|
color: var(--text-muted, #999);
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ts-feedback-bubble-in {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(4px);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.ts-feedback-intro,
|
.ts-feedback-intro,
|
||||||
.ts-feedback-hint {
|
.ts-feedback-hint {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
+71
-8
@@ -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";
|
type FeedbackCategory = "bug" | "idea" | "other";
|
||||||
|
|
||||||
function FeedbackDialog({ onClose }: { onClose: () => void }) {
|
function FeedbackDialog({ onClose }: { onClose: () => void }) {
|
||||||
@@ -8573,14 +8643,7 @@ function AppInner() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{IS_OWN_HOSTED_INSTANCE && !feedbackOpen && (
|
{IS_OWN_HOSTED_INSTANCE && !feedbackOpen && (
|
||||||
<button
|
<FeedbackFab onOpen={() => setFeedbackOpen(true)} />
|
||||||
type="button"
|
|
||||||
className="ts-feedback-fab"
|
|
||||||
onClick={() => setFeedbackOpen(true)}
|
|
||||||
title={t("menu.extras.feedback")}
|
|
||||||
>
|
|
||||||
💬
|
|
||||||
</button>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}
|
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
|||||||
"menu.extras.stopRecording": "Aufnahme beenden",
|
"menu.extras.stopRecording": "Aufnahme beenden",
|
||||||
"menu.extras.options": "Optionen",
|
"menu.extras.options": "Optionen",
|
||||||
"menu.extras.feedback": "Feedback geben",
|
"menu.extras.feedback": "Feedback geben",
|
||||||
|
"feedback.fab.nudge": "Was denkst du über WebSpeak3? Feedback ist willkommen!",
|
||||||
|
|
||||||
"feedback.dialog.title": "Feedback",
|
"feedback.dialog.title": "Feedback",
|
||||||
"feedback.dialog.intro": "Melde einen Fehler oder teile eine Idee zur Weiterentwicklung von WebSpeak3 mit.",
|
"feedback.dialog.intro": "Melde einen Fehler oder teile eine Idee zur Weiterentwicklung von WebSpeak3 mit.",
|
||||||
@@ -631,6 +632,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
|||||||
"menu.extras.stopRecording": "Stop Recording",
|
"menu.extras.stopRecording": "Stop Recording",
|
||||||
"menu.extras.options": "Options",
|
"menu.extras.options": "Options",
|
||||||
"menu.extras.feedback": "Send Feedback",
|
"menu.extras.feedback": "Send Feedback",
|
||||||
|
"feedback.fab.nudge": "What do you think of WebSpeak3? Feedback welcome!",
|
||||||
|
|
||||||
"feedback.dialog.title": "Feedback",
|
"feedback.dialog.title": "Feedback",
|
||||||
"feedback.dialog.intro": "Report a bug or share an idea to help improve WebSpeak3.",
|
"feedback.dialog.intro": "Report a bug or share an idea to help improve WebSpeak3.",
|
||||||
|
|||||||
Reference in new issue
Block a user