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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Add individual notification dismiss with X button
Louis Beaumont60c9505a0ebd
diff --git a/apps/screenpipe-app-tauri/components/notification-bell.tsx b/apps/screenpipe-app-tauri/components/notification-bell.tsxindex 9ead23363..3a3f26aba 100644--- a/apps/screenpipe-app-tauri/components/notification-bell.tsx+++ b/apps/screenpipe-app-tauri/components/notification-bell.tsx@@ -5,7 +5,7 @@"use client";import { useState, useEffect, useCallback } from "react";-import { Bell, ChevronRight, ChevronDown, MessageSquare } from "lucide-react";+import { Bell, ChevronRight, ChevronDown, MessageSquare, X } from "lucide-react";import ReactMarkdown from "react-markdown";import remarkGfm from "remark-gfm";import {@@ -67,6 +67,14 @@ export function NotificationBell() {} catch {}};+ const dismissOne = async (id: string) => {+ setHistory((prev) => prev.filter((n) => n.id !== id));+ if (expandedId === id) setExpandedId(null);+ try {+ await fetch(`${API_BASE}/notifications/${encodeURIComponent(id)}`, { method: "DELETE" });+ } catch {}+ };+const formatTime = (ts: string) => {const d = new Date(ts);const now = new Date();@@ -130,7 +138,7 @@ export function NotificationBell() {className="border-b border-border/50 last:border-0"><div- className="px-3 py-2 hover:bg-muted/30 cursor-pointer"+ className="group/notif px-3 py-2 hover:bg-muted/30 cursor-pointer"onClick={() => setExpandedId(isExpanded ? null : entry.id)}><div className="flex items-start justify-between gap-2">@@ -154,9 +162,21 @@ export function NotificationBell() {</div>)}</div>- <span className="text-[9px] text-muted-foreground/50 shrink-0 mt-0.5">- {formatTime(entry.timestamp)}- </span>+ <div className="flex items-center gap-1 shrink-0 mt-0.5">+ <span className="text-[9px] text-muted-foreground/50">+ {formatTime(entry.timestamp)}+ </span>+ <button+ onClick={(e) => {+ e.stopPropagation();+ dismissOne(entry.id);+ }}+ className="p-0.5 rounded hover:bg-muted/60 opacity-0 group-hover/notif:opacity-100 transition-opacity"+ title="dismiss"+ >+ <X className="w-3 h-3 text-muted-foreground/50 hover:text-foreground" />+ </button>+ </div></div></div>{isExpanded && (diff --git a/apps/screenpipe-app-tauri/src-tauri/src/notifications/routes.rs b/apps/screenpipe-app-tauri/src-tauri/src/notifications/routes.rsindex 08faee544..3b8e54cc6 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/notifications/routes.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/notifications/routes.rs@@ -6,7 +6,7 @@use super::store::{self, NotificationHistoryEntry};use crate::server::{ApiResponse, ServerState};-use axum::extract::State;+use axum::extract::{Path, State};use axum::http::StatusCode;use axum::Json;use tracing::{error, info};@@ -89,6 +89,27 @@ pub async fn clear() -> Json<ApiResponse> {})}+/// `DELETE /notifications/:id` — dismiss a single notification.+pub async fn dismiss(Path(id): Path<String>) -> (StatusCode, Json<ApiResponse>) {+ if store::remove_by_id(&id) {+ (+ StatusCode::OK,+ Json(ApiResponse {+ success: true,+ message: "notification dismissed".to_string(),+ }),+ )+ } else {+ (+ StatusCode::NOT_FOUND,+ Json(ApiResponse {+ success: false,+ message: "notification not found".to_string(),+ }),+ )+ }+}+// ── Payload types ────────────────────────────────────────────────────#[derive(serde::Serialize, serde::Deserialize, Debug)]diff --git a/apps/screenpipe-app-tauri/src-tauri/src/notifications/store.rs b/apps/screenpipe-app-tauri/src-tauri/src/notifications/store.rsindex 5f1cecd67..9ac52ccd8 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/notifications/store.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/notifications/store.rs@@ -53,6 +53,18 @@ pub fn mark_all_read() {write_all(&history);}+pub fn remove_by_id(id: &str) -> bool {+ let mut history = read_all();+ let before = history.len();+ history.retain(|e| e.id != id);+ if history.len() < before {+ write_all(&history);+ true+ } else {+ false+ }+}+pub fn clear() {write_all(&[]);}diff --git a/apps/screenpipe-app-tauri/src-tauri/src/server.rs b/apps/screenpipe-app-tauri/src-tauri/src/server.rsindex 9c5687c06..428d0d205 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/server.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/server.rs@@ -243,6 +243,10 @@ pub async fn run_server(app_handle: tauri::AppHandle, port: u16) {.post(crate::notifications::routes::mark_read).delete(crate::notifications::routes::clear),)+ .route(+ "/notifications/:id",+ axum::routing::delete(crate::notifications::routes::dismiss),+ ).route("/inbox", axum::routing::post(send_inbox_message)).route("/log", axum::routing::post(log_message)).route("/auth", axum::routing::post(handle_auth))