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

feat(changelog): pull live entries from screenpi.pe/api/changelog

Louis Beaumont3f2765b18108
diff --git a/apps/screenpipe-app-tauri/components/changelog-dialog.tsx b/apps/screenpipe-app-tauri/components/changelog-dialog.tsx
index e19de00ef..6b2f740b4 100644
--- a/apps/screenpipe-app-tauri/components/changelog-dialog.tsx
+++ b/apps/screenpipe-app-tauri/components/changelog-dialog.tsx
@@ -8,75 +8,207 @@ import { MemoizedReactMarkdown } from "./markdown";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
import { CodeBlock } from "./ui/codeblock";
+import { Sparkles, Wrench, Bug, ExternalLink } from "lucide-react";
+
+interface ChangelogEntry {
+ version: string;
+ date: string;
+ summary: string;
+ features: string[];
+ improvements: string[];
+ fixes: string[];
+ commitCount: number;
+}
+
+const CHANGELOG_API = "https://screenpi.pe/api/changelog?limit=50";
+
+async function fetchRemote(): Promise<ChangelogEntry[] | null> {
+ try {
+ const resp = await fetch(CHANGELOG_API, { cache: "no-store" });
+ if (!resp.ok) return null;
+ const data = (await resp.json()) as { entries?: ChangelogEntry[] };
+ return Array.isArray(data.entries) ? data.entries : null;
+ } catch {
+ return null;
+ }
+}
+
+async function fetchBundled(): Promise<string | null> {
+ try {
+ const resp = await fetch("/CHANGELOG.md");
+ if (!resp.ok) return null;
+ return await resp.text();
+ } catch {
+ return null;
+ }
+}
+
+function CategorySection({
+ icon,
+ label,
+ items,
+}: {
+ icon: React.ReactNode;
+ label: string;
+ items: string[];
+}) {
+ if (!items.length) return null;
+ return (
+ <div className="mt-4">
+ <div className="flex items-center gap-2 mb-2">
+ {icon}
+ <span className="font-mono text-[10px] uppercase tracking-[0.15em] font-semibold text-muted-foreground">
+ {label}
+ </span>
+ </div>
+ <ul className="space-y-1.5 list-none pl-0">
+ {items.map((item, i) => (
+ <li key={i} className="text-sm leading-relaxed pl-4 relative before:absolute before:left-0 before:top-2 before:w-1 before:h-1 before:rounded-full before:bg-foreground/30">
+ {item}
+ </li>
+ ))}
+ </ul>
+ </div>
+ );
+}
+
+function formatDate(dateStr: string): string {
+ try {
+ const d = new Date(dateStr + "T00:00:00");
+ return d.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
+ } catch {
+ return dateStr;
+ }
+}
export const ChangelogDialog: React.FC = () => {
- const [changelogContent, setChangelogContent] = useState<string>("");
+ const [entries, setEntries] = useState<ChangelogEntry[] | null>(null);
+ const [bundled, setBundled] = useState<string>("");
+ const [loading, setLoading] = useState(true);
const { showChangelogDialog, setShowChangelogDialog } = useChangelogDialog();
useEffect(() => {
- const fetchChangelog = async () => {
- const response = await fetch("/CHANGELOG.md");
- const text = await response.text();
- setChangelogContent(text);
+ if (!showChangelogDialog) return;
+ let cancelled = false;
+ setLoading(true);
+ (async () => {
+ const remote = await fetchRemote();
+ if (cancelled) return;
+ if (remote && remote.length > 0) {
+ setEntries(remote);
+ setLoading(false);
+ return;
+ }
+ const fallback = await fetchBundled();
+ if (cancelled) return;
+ setBundled(fallback ?? "");
+ setLoading(false);
+ })();
+ return () => {
+ cancelled = true;
};
-
- fetchChangelog();
- }, []);
+ }, [showChangelogDialog]);
const onClose = () => setShowChangelogDialog(false);
return (
<Dialog open={showChangelogDialog} onOpenChange={onClose}>
- <DialogContent className="w-11/12 max-w-6xl p-6 h-[80vh] overflow-auto">
- <div className="max-w-max prose prose-medium prose-slate w-full h-full">
- <h1>Changelog</h1>
- <MemoizedReactMarkdown
- // className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0"
- remarkPlugins={[remarkGfm, remarkMath]}
- components={{
- p({ children }) {
- return <p className="mb-2 last:mb-0">{children}</p>;
- },
- a({ node, href, children, ...props }) {
- return (
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- {...props}
- >
- {children}
- </a>
- );
- },
- code({ node, className, children, ...props }) {
- const content = String(children).replace(/\n$/, "");
- const match = /language-(\w+)/.exec(className || "");
-
- if (!match) {
- return (
- <code
- className="px-1 py-0.5 rounded-sm font-mono text-sm"
- {...props}
- >
- {content}
- </code>
- );
- }
-
- return (
- <CodeBlock
- key={Math.random()}
- language={(match && match[1]) || ""}
- value={content}
- {...props}
- />
- );
- },
- }}
+ <DialogContent className="w-11/12 max-w-3xl p-0 h-[80vh] overflow-hidden flex flex-col">
+ <div className="px-6 pt-6 pb-4 border-b border-border flex items-center justify-between">
+ <h1 className="text-xl font-semibold">changelog</h1>
+ <a
+ href="https://screenpi.pe/changelog"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"
>
- {changelogContent}
- </MemoizedReactMarkdown>
+ view all <ExternalLink className="w-3 h-3" />
+ </a>
+ </div>
+ <div className="flex-1 overflow-y-auto px-6 py-4">
+ {loading ? (
+ <div className="text-sm text-muted-foreground font-mono">loading…</div>
+ ) : entries && entries.length > 0 ? (
+ <div className="space-y-8">
+ {entries.map((entry) => (
+ <div key={entry.version} className="pb-6 border-b border-border/40 last:border-b-0">
+ <div className="flex items-baseline gap-3 mb-2">
+ <span className="font-mono text-sm font-semibold">v{entry.version}</span>
+ <span className="text-xs text-muted-foreground">{formatDate(entry.date)}</span>
+ </div>
+ {entry.summary && (
+ <p className="text-sm text-foreground/80 mb-2">{entry.summary}</p>
+ )}
+ <CategorySection
+ icon={<Sparkles className="w-3 h-3 text-foreground/60" />}
+ label="new"
+ items={entry.features ?? []}
+ />
+ <CategorySection
+ icon={<Wrench className="w-3 h-3 text-foreground/60" />}
+ label="improved"
+ items={entry.improvements ?? []}
+ />
+ <CategorySection
+ icon={<Bug className="w-3 h-3 text-foreground/60" />}
+ label="fixed"
+ items={entry.fixes ?? []}
+ />
+ </div>
+ ))}
+ </div>
+ ) : bundled ? (
+ <div className="prose prose-sm dark:prose-invert max-w-full">
+ <MemoizedReactMarkdown
+ remarkPlugins={[remarkGfm, remarkMath]}
+ components={{
+ p({ children }) {
+ return <p className="mb-2 last:mb-0">{children}</p>;
+ },
+ a({ node, href, children, ...props }) {
+ return (
+ <a href={href} target="_blank" rel="noopener noreferrer" {...props}>
+ {children}
+ </a>
+ );
+ },
+ code({ node, className, children, ...props }) {
+ const content = String(children).replace(/\n$/, "");
+ const match = /language-(\w+)/.exec(className || "");
+ if (!match) {
+ return (
+ <code className="px-1 py-0.5 rounded-sm font-mono text-sm" {...props}>
+ {content}
+ </code>
+ );
+ }
+ return (
+ <CodeBlock
+ key={Math.random()}
+ language={(match && match[1]) || ""}
+ value={content}
+ {...props}
+ />
+ );
+ },
+ }}
+ >
+ {bundled}
+ </MemoizedReactMarkdown>
+ </div>
+ ) : (
+ <div className="text-sm text-muted-foreground font-mono">
+ couldn&apos;t reach the changelog. try again later or visit{" "}
+ <a
+ href="https://screenpi.pe/changelog"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="underline hover:text-foreground"
+ >
+ screenpi.pe/changelog
+ </a>
+ </div>
+ )}
</div>
</DialogContent>
</Dialog>