From fd31076c13ed6b30ce0c10b62fef9425f64722d0 Mon Sep 17 00:00:00 2001
From: Wassim Gharbi
Date: Wed, 29 Jul 2026 12:19:01 -1000
Subject: [PATCH] social links
---
README.md | 5 +-
components/Editor.tsx | 4 +-
components/GitHubLink.tsx | 49 ----------------
components/SocialLinks.tsx | 110 ++++++++++++++++++++++++++++++++++++
components/UploadScreen.tsx | 4 +-
hooks/useWindowChrome.ts | 28 ++++-----
6 files changed, 132 insertions(+), 68 deletions(-)
delete mode 100644 components/GitHubLink.tsx
create mode 100644 components/SocialLinks.tsx
diff --git a/README.md b/README.md
index 5fb3bd1..e37abe6 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@ Edit video and audio like you edit text — fully offline, on your device.
**✨ Try it in the browser [wassgha.github.io/rescript](https://wassgha.github.io/rescript/)** or download the [Desktop App](#download)
+[](https://github.com/wassgha/rescript)
+[](https://discord.gg/qJAhYFydat)
[](https://x.com/wassgha)
[](https://wassgha.github.io/rescript/)
@@ -115,4 +117,5 @@ MIT
---
-Built by [@wassgha](https://x.com/wassgha) — follow along on X for updates.
+Built by [@wassgha](https://x.com/wassgha) — follow along on X for updates, or
+come say hi in the [Discord](https://discord.gg/RCv4gcwE4).
diff --git a/components/Editor.tsx b/components/Editor.tsx
index c65f2ca..ec86f85 100644
--- a/components/Editor.tsx
+++ b/components/Editor.tsx
@@ -10,7 +10,7 @@ import TranscriptPanel from "./TranscriptPanel";
import MediaPreview from "./MediaPreview";
import Timeline from "./Timeline";
import ExportDialog from "./ExportDialog";
-import GitHubLink from "./GitHubLink";
+import SocialLinks from "./SocialLinks";
import { Download, Redo2, Undo2 } from "lucide-react";
import { ModelOption, ModelOptionSeparator } from "./ModelSelector";
import ModelSelector from "./ModelSelector";
@@ -145,7 +145,7 @@ export default function Editor() {
) : (
<>
-
+
-
+
}
diff --git a/hooks/useWindowChrome.ts b/hooks/useWindowChrome.ts
index dbdaf4c..910c517 100644
--- a/hooks/useWindowChrome.ts
+++ b/hooks/useWindowChrome.ts
@@ -1,6 +1,6 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useState, useSyncExternalStore } from "react";
export interface WindowChrome {
/** The native title bar is hidden — the page must supply its own drag region. */
@@ -9,6 +9,18 @@ export interface WindowChrome {
trafficLights: boolean;
}
+function subscribeFocus(onChange: () => void) {
+ window.addEventListener("focus", onChange);
+ window.addEventListener("blur", onChange);
+ return () => {
+ window.removeEventListener("focus", onChange);
+ window.removeEventListener("blur", onChange);
+ };
+}
+
+const isFocused = () => document.hasFocus();
+const isFocusedOnServer = () => true;
+
/**
* Describes how much window chrome the page is responsible for drawing. In a
* browser tab this is all false; in the Electron shell on macOS the title bar
@@ -16,7 +28,7 @@ export interface WindowChrome {
*/
export function useWindowChrome(): WindowChrome {
const [fullScreen, setFullScreen] = useState(false);
- const [focused, setFocused] = useState(true);
+ const focused = useSyncExternalStore(subscribeFocus, isFocused, isFocusedOnServer);
useEffect(() => {
const desktop = window.rescriptDesktop;
@@ -33,18 +45,6 @@ export function useWindowChrome(): WindowChrome {
};
}, []);
- useEffect(() => {
- setFocused(document.hasFocus());
- const onFocus = () => setFocused(true);
- const onBlur = () => setFocused(false);
- window.addEventListener("focus", onFocus);
- window.addEventListener("blur", onBlur);
- return () => {
- window.removeEventListener("focus", onFocus);
- window.removeEventListener("blur", onBlur);
- };
- }, []);
-
// Safe to read during render: every consumer lives under the client-only
// (ssr: false) Editor, so there is no server pass to mismatch against.
const draggable =