mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(feedback): route failed-run Report issue through the offline handoff (#429)
Apply the always-on handoff to the failed-run Report issue button too. Un-gate the two buttons in tool-page.tsx from the analytics toggle, and extend the dialog offline handoff to source=failed_job, prefilling the GitHub issue with the tool id and error category so it is actionable even with an empty message. Follows #428. Claude-Session: https://claude.ai/code/session_01XVrHKXwzZDWBWgkGQdPZ3A
This commit is contained in:
@@ -118,6 +118,14 @@ export function FeedbackDialog({
|
||||
const isAdminInstall = source === "admin_installer";
|
||||
const isSearchMiss = source === "search_miss";
|
||||
const isGlobal = source === "global";
|
||||
const isFailedJob = source === "failed_job";
|
||||
// For a failed run, thread the tool and error into the offline handoff so the
|
||||
// GitHub issue is actionable even if the message box is left empty.
|
||||
const handoffMessage = isFailedJob
|
||||
? [`Tool: ${toolId ?? "unknown"}`, `Error category: ${errorCategory ?? "unknown"}`, "", message]
|
||||
.join("\n")
|
||||
.trim()
|
||||
: message;
|
||||
const canSubmit = Boolean(
|
||||
message.trim() || sentiment || feedbackType !== "other" || isAdminInstall,
|
||||
);
|
||||
@@ -206,13 +214,13 @@ export function FeedbackDialog({
|
||||
|
||||
{submitted ? (
|
||||
<div className="p-6 space-y-4">
|
||||
{isGlobal && !accepted ? (
|
||||
{(isGlobal || isFailedJob) && !accepted ? (
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm text-foreground">{t.feedback.offlineDescription}</p>
|
||||
<p className="text-xs text-muted-foreground">{t.feedback.offlinePublicNote}</p>
|
||||
<div className="flex flex-col gap-2">
|
||||
<a
|
||||
href={buildFeedbackGithubUrl(message)}
|
||||
href={buildFeedbackGithubUrl(handoffMessage)}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="w-full text-center py-2 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:bg-primary/90"
|
||||
@@ -220,7 +228,7 @@ export function FeedbackDialog({
|
||||
{t.feedback.offlineGithubButton}
|
||||
</a>
|
||||
<a
|
||||
href={buildFeedbackMailtoUrl(message)}
|
||||
href={buildFeedbackMailtoUrl(handoffMessage)}
|
||||
className="w-full text-center py-2 rounded-lg border border-border text-sm text-muted-foreground hover:bg-muted hover:text-foreground"
|
||||
>
|
||||
{t.feedback.offlineEmailButton}
|
||||
|
||||
@@ -51,7 +51,6 @@ import { ICON_MAP } from "@/lib/icon-map";
|
||||
import { MULTI_FILE_TOOLS } from "@/lib/tool-display-modes";
|
||||
import { getToolName } from "@/lib/tool-i18n";
|
||||
import { getToolRegistryEntry } from "@/lib/tool-registry";
|
||||
import { useAnalyticsStore } from "@/stores/analytics-store";
|
||||
import { useBase64Store } from "@/stores/base64-store";
|
||||
import { useCollageStore } from "@/stores/collage-store";
|
||||
import { useDuplicateStore } from "@/stores/duplicate-store";
|
||||
@@ -327,8 +326,6 @@ export function ToolPage() {
|
||||
);
|
||||
const [mobileSettingsOpen, setMobileSettingsOpen] = useState(false);
|
||||
const [failedFeedbackOpen, setFailedFeedbackOpen] = useState(false);
|
||||
const analyticsConfig = useAnalyticsStore((s) => s.config);
|
||||
const feedbackEnabled = Boolean(analyticsConfig?.enabled);
|
||||
const [previewTransform, setPreviewTransform] = useState<PreviewTransform | null>(null);
|
||||
const [previewFilter, setPreviewFilter] = useState<string>("");
|
||||
const [imageWrapperStyle, setImageWrapperStyle] = useState<React.CSSProperties | null>(null);
|
||||
@@ -791,16 +788,14 @@ export function ToolPage() {
|
||||
>
|
||||
{t.toolPage.tryDifferentFile}
|
||||
</button>
|
||||
{feedbackEnabled && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setFailedFeedbackOpen(true)}
|
||||
className="px-4 py-2 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center justify-center gap-2"
|
||||
>
|
||||
<MessageSquare className="h-3.5 w-3.5" />
|
||||
{t.feedback.reportIssue}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setFailedFeedbackOpen(true)}
|
||||
className="px-4 py-2 rounded-md border border-border text-sm text-muted-foreground hover:bg-muted hover:text-foreground inline-flex items-center justify-center gap-2"
|
||||
>
|
||||
<MessageSquare className="h-3.5 w-3.5" />
|
||||
{t.feedback.reportIssue}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1120,7 +1115,7 @@ export function ToolPage() {
|
||||
</Suspense>
|
||||
</div>
|
||||
|
||||
{feedbackEnabled && currentEntry?.status === "failed" && (
|
||||
{currentEntry?.status === "failed" && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setFailedFeedbackOpen(true)}
|
||||
|
||||
Reference in New Issue
Block a user