Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(notifications): collapse feedback after send

Louis Beaumont845dc283e938
diff --git a/apps/screenpipe-app-tauri/components/notification-feedback.test.tsx b/apps/screenpipe-app-tauri/components/notification-feedback.test.tsx
index 4353c9f37..914cb0a97 100644
--- a/apps/screenpipe-app-tauri/components/notification-feedback.test.tsx
+++ b/apps/screenpipe-app-tauri/components/notification-feedback.test.tsx
@@ -74,9 +74,14 @@ describe("NotificationFeedback", () => {
"include project names",
);
});
+ expect(await screen.findByText("feedback sent")).toBeInTheDocument();
expect(
- await screen.findByText("saved for the next run"),
- ).toBeInTheDocument();
+ screen.queryByRole("group", { name: "notification feedback options" }),
+ ).not.toBeInTheDocument();
+ expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
+ expect(
+ screen.queryByRole("button", { name: "send feedback" }),
+ ).not.toBeInTheDocument();
expect(capture).toHaveBeenCalledWith(
"notification_feedback_submitted",
expect.objectContaining({
@@ -111,6 +116,10 @@ describe("NotificationFeedback", () => {
undefined,
);
});
+ expect(await screen.findByText("feedback sent")).toBeInTheDocument();
+ expect(
+ screen.queryByRole("group", { name: "notification feedback options" }),
+ ).not.toBeInTheDocument();
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
expect(capture).toHaveBeenCalledWith(
"notification_feedback_submitted",
diff --git a/apps/screenpipe-app-tauri/components/notification-feedback.tsx b/apps/screenpipe-app-tauri/components/notification-feedback.tsx
index eb3543621..2c2423c91 100644
--- a/apps/screenpipe-app-tauri/components/notification-feedback.tsx
+++ b/apps/screenpipe-app-tauri/components/notification-feedback.tsx
@@ -106,127 +106,119 @@ export function NotificationFeedback({
: { padding: "0 14px 8px 14px" }
}
>
- <div
- role="group"
- aria-label="notification feedback options"
- style={{
- display: "flex",
- alignItems: "center",
- gap: "4px",
- }}
- >
- <button
- type="button"
- onClick={selectUp}
- disabled={saveState === "saving"}
- aria-label="useful notification"
- aria-pressed={rating === "up"}
- title="useful"
- style={iconButtonStyle(rating === "up")}
- >
- <ThumbsUp size={9} strokeWidth={1.8} />
- </button>
- <button
- type="button"
- onClick={selectDown}
- disabled={saveState === "saving"}
- aria-label="not useful notification"
- aria-pressed={rating === "down"}
- title="not useful"
- style={iconButtonStyle(rating === "down")}
- >
- <ThumbsDown size={9} strokeWidth={1.8} />
- </button>
- {saveState === "saved" && rating === "up" && (
- <span
- style={{
- fontSize: "9px",
- color: "hsl(var(--muted-foreground))",
- }}
- >
- saved
- </span>
- )}
- </div>
- {rating === "down" && (
- <form
- onSubmit={sendCorrection}
- style={{ display: "flex", gap: "6px", marginTop: "6px" }}
- >
- <input
- autoFocus
- value={correction}
- onChange={(event) => {
- setCorrection(event.target.value);
- if (saveState !== "idle") setSaveState("idle");
- }}
- maxLength={500}
- placeholder="what should improve?"
- aria-label="what should improve"
- style={{
- minWidth: 0,
- flex: 1,
- height: "28px",
- padding: "0 8px",
- border: "1px solid hsl(var(--border))",
- borderRadius: 0,
- outline: "none",
- background: "hsl(var(--background))",
- color: "hsl(var(--foreground))",
- fontFamily: '"IBM Plex Mono", monospace',
- fontSize: "10px",
- }}
- />
- <button
- type="submit"
- disabled={!correction.trim() || saveState === "saving"}
- aria-label="send feedback"
- title="send feedback"
- style={{
- display: "inline-flex",
- alignItems: "center",
- justifyContent: "center",
- width: "28px",
- height: "28px",
- padding: 0,
- border: "1px solid hsl(var(--border))",
- borderRadius: 0,
- background: correction.trim()
- ? "hsl(var(--foreground))"
- : "transparent",
- color: correction.trim()
- ? "hsl(var(--background))"
- : "hsl(var(--muted-foreground))",
- cursor: correction.trim() ? "pointer" : "default",
- }}
- >
- <Send size={12} strokeWidth={1.8} />
- </button>
- </form>
- )}
-
- {saveState === "saved" && rating === "down" && (
+ {saveState === "saved" ? (
<div
+ role="status"
style={{
- marginTop: "4px",
fontSize: "9px",
color: "hsl(var(--muted-foreground))",
}}
>
- saved for the next run
- </div>
- )}
- {saveState === "error" && (
- <div
- role="alert"
- style={{
- marginTop: "4px",
- fontSize: "9px",
- color: "hsl(var(--muted-foreground))",
- }}
- >
- could not save — try again
+ feedback sent
</div>
+ ) : (
+ <>
+ <div
+ role="group"
+ aria-label="notification feedback options"
+ style={{
+ display: "flex",
+ alignItems: "center",
+ gap: "4px",
+ }}
+ >
+ <button
+ type="button"
+ onClick={selectUp}
+ disabled={saveState === "saving"}
+ aria-label="useful notification"
+ aria-pressed={rating === "up"}
+ title="useful"
+ style={iconButtonStyle(rating === "up")}
+ >
+ <ThumbsUp size={9} strokeWidth={1.8} />
+ </button>
+ <button
+ type="button"
+ onClick={selectDown}
+ disabled={saveState === "saving"}
+ aria-label="not useful notification"
+ aria-pressed={rating === "down"}
+ title="not useful"
+ style={iconButtonStyle(rating === "down")}
+ >
+ <ThumbsDown size={9} strokeWidth={1.8} />
+ </button>
+ </div>
+ {rating === "down" && (
+ <form
+ onSubmit={sendCorrection}
+ style={{ display: "flex", gap: "6px", marginTop: "6px" }}
+ >
+ <input
+ autoFocus
+ value={correction}
+ onChange={(event) => {
+ setCorrection(event.target.value);
+ if (saveState !== "idle") setSaveState("idle");
+ }}
+ maxLength={500}
+ placeholder="what should improve?"
+ aria-label="what should improve"
+ style={{
+ minWidth: 0,
+ flex: 1,
+ height: "28px",
+ padding: "0 8px",
+ border: "1px solid hsl(var(--border))",
+ borderRadius: 0,
+ outline: "none",
+ background: "hsl(var(--background))",
+ color: "hsl(var(--foreground))",
+ fontFamily: '"IBM Plex Mono", monospace',
+ fontSize: "10px",
+ }}
+ />
+ <button
+ type="submit"
+ disabled={!correction.trim() || saveState === "saving"}
+ aria-label="send feedback"
+ title="send feedback"
+ style={{
+ display: "inline-flex",
+ alignItems: "center",
+ justifyContent: "center",
+ width: "28px",
+ height: "28px",
+ padding: 0,
+ border: "1px solid hsl(var(--border))",
+ borderRadius: 0,
+ background: correction.trim()
+ ? "hsl(var(--foreground))"
+ : "transparent",
+ color: correction.trim()
+ ? "hsl(var(--background))"
+ : "hsl(var(--muted-foreground))",
+ cursor: correction.trim() ? "pointer" : "default",
+ }}
+ >
+ <Send size={12} strokeWidth={1.8} />
+ </button>
+ </form>
+ )}
+ {saveState === "error" && (
+ <div
+ role="alert"
+ style={{
+ marginTop: "4px",
+ fontSize: "9px",
+ color: "hsl(var(--muted-foreground))",
+ }}
+ >
+ could not save — try again
+ </div>
+ )}
+ </>
)}
</div>
</div>
diff --git a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
index 987b1f7bf..817863485 100644
--- a/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
+++ b/apps/screenpipe-app-tauri/src-tauri/swift/notification_panel.swift
@@ -325,67 +325,58 @@ private struct NativeNotificationFeedbackView: View {
var body: some View {
VStack(alignment: .leading, spacing: 6) {
- HStack(spacing: 6) {
- feedbackButton(systemName: "hand.thumbsup", rating: .up) {
- model.rating = .up
- model.correction = ""
- model.saveState = .submitted
- onSubmit(NotificationFeedbackRating.up.rawValue, nil)
- scheduleLayoutUpdate()
- }
+ if model.saveState == .submitted {
+ Text("feedback sent")
+ .font(Brand.swiftUIMonoFont(size: 9))
+ .foregroundColor(.primary.opacity(0.4))
+ } else {
+ HStack(spacing: 6) {
+ feedbackButton(systemName: "hand.thumbsup", rating: .up) {
+ model.rating = .up
+ model.correction = ""
+ model.saveState = .submitted
+ onSubmit(NotificationFeedbackRating.up.rawValue, nil)
+ scheduleLayoutUpdate()
+ }
- feedbackButton(systemName: "hand.thumbsdown", rating: .down) {
- model.rating = .down
- model.saveState = .idle
- scheduleLayoutUpdate()
- }
+ feedbackButton(systemName: "hand.thumbsdown", rating: .down) {
+ model.rating = .down
+ model.saveState = .idle
+ scheduleLayoutUpdate()
+ }
- if model.rating == .up && model.saveState == .submitted {
- Text("sent")
- .font(Brand.swiftUIMonoFont(size: 9))
- .foregroundColor(.primary.opacity(0.4))
+ Spacer(minLength: 0)
}
- Spacer(minLength: 0)
- }
- if model.rating == .down {
- HStack(spacing: 6) {
- TextField("what should improve?", text: $model.correction)
- .textFieldStyle(.plain)
- .font(Brand.swiftUIMonoFont(size: 10))
- .padding(.horizontal, 8)
- .frame(height: 28)
- .background(Color(nsColor: .windowBackgroundColor).opacity(0.45))
- .overlay(Rectangle().stroke(Color.primary.opacity(0.16), lineWidth: 1))
- .onSubmit(sendCorrection)
- .onChange(of: model.correction) { value in
- if value.count > 500 {
- model.correction = String(value.prefix(500))
- }
- if model.saveState == .submitted {
- model.saveState = .idle
- scheduleLayoutUpdate()
+ if model.rating == .down {
+ HStack(spacing: 6) {
+ TextField("what should improve?", text: $model.correction)
+ .textFieldStyle(.plain)
+ .font(Brand.swiftUIMonoFont(size: 10))
+ .padding(.horizontal, 8)
+ .frame(height: 28)
+ .background(Color(nsColor: .windowBackgroundColor).opacity(0.45))
+ .overlay(Rectangle().stroke(Color.primary.opacity(0.16), lineWidth: 1))
+ .onSubmit(sendCorrection)
+ .onChange(of: model.correction) { value in
+ if value.count > 500 {
+ model.correction = String(value.prefix(500))
+ }
}
- }
- Button(action: sendCorrection) {
- Image(systemName: "paperplane")
- .font(.system(size: 11, weight: .regular))
- .frame(width: 28, height: 28)
- .foregroundColor(correctionReady ? Color(nsColor: .windowBackgroundColor) : .primary.opacity(0.22))
- .background(Rectangle().fill(correctionReady ? Color.primary.opacity(0.82) : Color.clear))
- .overlay(Rectangle().stroke(Color.primary.opacity(0.16), lineWidth: 1))
+ Button(action: sendCorrection) {
+ Image(systemName: "paperplane")
+ .font(.system(size: 11, weight: .regular))
+ .frame(width: 28, height: 28)
+ .foregroundColor(correctionReady ? Color(nsColor: .windowBackgroundColor) : .primary.opacity(0.22))
+ .background(Rectangle().fill(correctionReady ? Color.primary.opacity(0.82) : Color.clear))
+ .overlay(Rectangle().stroke(Color.primary.opacity(0.16), lineWidth: 1))
+ }
+ .buttonStyle(.plain)
+ .disabled(!correctionReady)
+ .help("send feedback")
+ .accessibilityLabel("send feedback")
}
- .buttonStyle(.plain)
- .disabled(!correctionReady)
- .help("send feedback")
- .accessibilityLabel("send feedback")
- }
-
- if model.saveState == .submitted {
- Text("feedback sent")
- .font(Brand.swiftUIMonoFont(size: 9))
- .foregroundColor(.primary.opacity(0.4))
}
}
}