Merge remote-tracking branch 'upstream/dev' into feat/human-in-the-loop

This commit is contained in:
Anish Sarkar 2026-03-21 13:17:24 +05:30
commit 77cc2af14f
30 changed files with 4975 additions and 1162 deletions

View file

@ -1,3 +1,4 @@
{
"biome.configurationPath": "./surfsense_web/biome.json"
"biome.configurationPath": "./surfsense_web/biome.json",
"deepscan.ignoreConfirmWarning": true
}

View file

@ -46,11 +46,11 @@ https://github.com/user-attachments/assets/a0a16566-6967-4374-ac51-9b3e07fbecd7
2. Connect your connectors and sync. Enable periodic syncing to keep connectors synced.
<p align="center"><img src="https://github.com/user-attachments/assets/59da61d7-da05-4576-b7c0-dbc09f5985e8" alt="Connectors" /></p>
<p align="center"><img src="https://github.com/user-attachments/assets/0740f351-23fa-4909-9880-70aa1dcc1df7" alt="Connectors" /></p>
3. Till connectors data index, upload Documents.
<p align="center"><img src="https://github.com/user-attachments/assets/d1e8b2e2-9eac-41d8-bdc0-f0cdc405d128" alt="Upload Documents" /></p>
<p align="center"><img src="https://github.com/user-attachments/assets/daf3dbae-ef86-4e86-82ea-fcbcad988761" alt="Upload Documents" /></p>
4. Once everything is indexed, Ask Away (Use Cases):
@ -60,6 +60,7 @@ https://github.com/user-attachments/assets/a0a16566-6967-4374-ac51-9b3e07fbecd7
- Document Mention QNA
<p align="center"><img src="https://github.com/user-attachments/assets/65c3bf06-1d46-4dd5-b169-4d934c9b6798" alt="Document Mention QNA" /></p>
<p align="center"><img src="https://github.com/user-attachments/assets/be958295-0a8c-4707-998c-9fe1f1c007be" alt="Document Mention QNA" /></p>
- Report Generations and Exports (PDF, DOCX, HTML, LaTeX, EPUB, ODT, Plain Text)

View file

@ -340,20 +340,17 @@ if config.NEXT_FRONTEND_URL:
if www_url not in allowed_origins:
allowed_origins.append(www_url)
# For local development, also allow common localhost origins
if not config.BACKEND_URL or (
config.NEXT_FRONTEND_URL and "localhost" in config.NEXT_FRONTEND_URL
):
allowed_origins.extend(
[
"http://localhost:3000",
"http://127.0.0.1:3000",
]
)
allowed_origins.extend(
[ # For local development and desktop app
"http://localhost:3000",
"http://127.0.0.1:3000",
]
)
app.add_middleware(
CORSMiddleware,
allow_origins=allowed_origins,
allow_origin_regex=r"^https?://(localhost|127\.0\.0\.1)(:\d+)?$",
allow_credentials=True,
allow_methods=["*"], # Allows all methods
allow_headers=["*"], # Allows all headers

View file

@ -6,6 +6,9 @@ requires-python = ">=3.12"
dependencies = [
"alembic>=1.13.0",
"asyncpg>=0.30.0",
"authlib>=1.6.9",
"PyJWT>=2.12.0",
"tornado>=6.5.5",
"datasets>=2.21.0",
"pyarrow>=15.0.0,<19.0.0",
"discord-py>=2.5.2",

2276
surfsense_backend/uv.lock generated

File diff suppressed because it is too large Load diff

6
surfsense_desktop/.env Normal file
View file

@ -0,0 +1,6 @@
# Electron-specific build-time configuration.
# Set before running pnpm dist:mac / dist:win / dist:linux.
# The hosted web frontend URL. Used to intercept OAuth redirects and keep them
# inside the desktop app. Set to your production frontend domain.
HOSTED_FRONTEND_URL=https://surfsense.net

3
surfsense_desktop/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
node_modules/
dist/
release/

View file

@ -0,0 +1,58 @@
# SurfSense Desktop
Electron wrapper around the SurfSense web app. Packages the Next.js standalone build into a native desktop application with OAuth support, deep linking, and system browser integration.
## Prerequisites
- Node.js 18+
- pnpm 10+
- The `surfsense_web` project dependencies installed (`pnpm install` in `surfsense_web/`)
## Development
```bash
pnpm install
pnpm dev
```
This starts the Next.js dev server and Electron concurrently. Hot reload works — edit the web app and changes appear immediately.
## Configuration
Two `.env` files control the build:
**`surfsense_web/.env`** — Next.js environment variables baked into the frontend at build time:
**`surfsense_desktop/.env`** — Electron-specific configuration:
Set these before building.
## Build & Package
**Step 1** — Build the Next.js standalone output:
```bash
cd ../surfsense_web
pnpm build
```
**Step 2** — Compile Electron and prepare the standalone output:
```bash
cd ../surfsense_desktop
pnpm build
```
**Step 3** — Package into a distributable:
```bash
pnpm dist:mac # macOS (.dmg + .zip)
pnpm dist:win # Windows (.exe)
pnpm dist:linux # Linux (.deb + .AppImage)
```
**Step 4** — Find the output:
```bash
ls release/
```

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 MiB

View file

@ -0,0 +1,67 @@
appId: com.surfsense.desktop
productName: SurfSense
publish:
provider: github
owner: MODSetter
repo: SurfSense
directories:
output: release
files:
- dist/**/*
- "!node_modules"
- "!src"
- "!scripts"
- "!release"
extraResources:
- from: ../surfsense_web/.next/standalone/surfsense_web/
to: standalone/
filter:
- "**/*"
- "!**/node_modules"
- from: ../surfsense_web/.next/standalone/surfsense_web/node_modules/
to: standalone/node_modules/
filter: ["**/*"]
- from: ../surfsense_web/.next/static/
to: standalone/.next/static/
filter: ["**/*"]
- from: ../surfsense_web/public/
to: standalone/public/
filter: ["**/*"]
asarUnpack:
- "**/*.node"
mac:
icon: assets/icon.icns
category: public.app-category.productivity
artifactName: "${productName}-${version}-${arch}.${ext}"
hardenedRuntime: true
gatekeeperAssess: false
target:
- target: dmg
arch: [x64, arm64]
- target: zip
arch: [x64, arm64]
win:
icon: assets/icon.ico
target:
- target: nsis
arch: [x64, arm64]
nsis:
oneClick: false
perMachine: false
allowToChangeInstallationDirectory: true
createDesktopShortcut: true
createStartMenuShortcut: true
linux:
icon: assets/icon.png
category: Utility
artifactName: "${productName}-${version}-${arch}.${ext}"
mimeTypes:
- x-scheme-handler/surfsense
desktop:
entry:
Name: SurfSense
Comment: AI-powered research assistant
Categories: Utility;Office;
target:
- deb
- AppImage

View file

@ -0,0 +1,33 @@
{
"name": "surfsense-desktop",
"version": "0.1.0",
"description": "SurfSense Desktop App",
"main": "dist/main.js",
"scripts": {
"dev": "concurrently -k \"pnpm --dir ../surfsense_web dev\" \"wait-on http://localhost:3000 && electron .\"",
"build": "node scripts/build-electron.mjs",
"pack:dir": "pnpm build && electron-builder --dir --config electron-builder.yml",
"dist": "pnpm build && electron-builder --config electron-builder.yml",
"dist:mac": "pnpm build && electron-builder --mac --config electron-builder.yml",
"dist:win": "pnpm build && electron-builder --win --config electron-builder.yml",
"dist:linux": "pnpm build && electron-builder --linux --config electron-builder.yml",
"typecheck": "tsc --noEmit"
},
"author": "MODSetter",
"license": "MIT",
"packageManager": "pnpm@10.24.0",
"devDependencies": {
"@types/node": "^25.5.0",
"concurrently": "^9.2.1",
"dotenv": "^17.3.1",
"electron": "^41.0.2",
"electron-builder": "^26.8.1",
"esbuild": "^0.27.4",
"typescript": "^5.9.3",
"wait-on": "^9.0.4"
},
"dependencies": {
"electron-updater": "^6.8.3",
"get-port-please": "^3.2.0"
}
}

3159
surfsense_desktop/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,6 @@
packages:
- "."
onlyBuiltDependencies:
- electron
- electron-winstaller
- esbuild

View file

@ -0,0 +1,136 @@
import { build } from 'esbuild';
import fs from 'fs';
import path from 'path';
import dotenv from 'dotenv';
const desktopEnv = dotenv.config().parsed || {};
const STANDALONE_ROOT = path.join(
'..', 'surfsense_web', '.next', 'standalone', 'surfsense_web'
);
/**
* electron-builder cannot follow symlinks when packaging into ASAR.
* Recursively walk the standalone output and replace every symlink
* with a real copy (or remove it if the target doesn't exist).
*/
function resolveAllSymlinks(dir) {
if (!fs.existsSync(dir)) return;
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
const full = path.join(dir, entry.name);
if (entry.isSymbolicLink()) {
const target = fs.readlinkSync(full);
const resolved = path.resolve(dir, target);
if (fs.existsSync(resolved)) {
fs.rmSync(full, { recursive: true, force: true });
fs.cpSync(resolved, full, { recursive: true });
console.log(`Resolved symlink: ${full}`);
} else {
fs.rmSync(full, { force: true });
console.log(`Removed broken symlink: ${full}`);
}
} else if (entry.isDirectory()) {
resolveAllSymlinks(full);
}
}
}
/**
* pnpm's .pnpm/ virtual store uses symlinks for sibling dependency resolution.
* After resolveAllSymlinks converts everything to real copies, packages can no
* longer find their dependencies through the pnpm structure. We flatten the
* tree into a standard npm-like layout: every package from .pnpm/&ast;/node_modules/
* gets hoisted to the top-level node_modules/. This lets Node.js standard
* module resolution find all dependencies (e.g. next styled-jsx).
*/
function flattenPnpmStore(nodeModulesDir) {
const pnpmDir = path.join(nodeModulesDir, '.pnpm');
if (!fs.existsSync(pnpmDir)) return;
console.log('Flattening pnpm store to top-level node_modules...');
let hoisted = 0;
for (const storePkg of fs.readdirSync(pnpmDir, { withFileTypes: true })) {
if (!storePkg.isDirectory() || storePkg.name === 'node_modules') continue;
const innerNM = path.join(pnpmDir, storePkg.name, 'node_modules');
if (!fs.existsSync(innerNM)) continue;
for (const dep of fs.readdirSync(innerNM, { withFileTypes: true })) {
const depName = dep.name;
// Handle scoped packages (@org/pkg)
if (depName.startsWith('@') && dep.isDirectory()) {
const scopeDir = path.join(innerNM, depName);
for (const scopedPkg of fs.readdirSync(scopeDir, { withFileTypes: true })) {
const fullName = `${depName}/${scopedPkg.name}`;
const src = path.join(scopeDir, scopedPkg.name);
const dest = path.join(nodeModulesDir, depName, scopedPkg.name);
if (!fs.existsSync(dest)) {
fs.mkdirSync(path.join(nodeModulesDir, depName), { recursive: true });
fs.cpSync(src, dest, { recursive: true });
hoisted++;
}
}
} else if (dep.isDirectory() || dep.isFile()) {
const dest = path.join(nodeModulesDir, depName);
if (!fs.existsSync(dest)) {
fs.cpSync(path.join(innerNM, depName), dest, { recursive: true });
hoisted++;
}
}
}
}
// Remove the .pnpm directory — no longer needed
fs.rmSync(pnpmDir, { recursive: true, force: true });
console.log(`Hoisted ${hoisted} packages, removed .pnpm/`);
}
function resolveStandaloneSymlinks() {
console.log('Resolving symlinks in standalone output...');
resolveAllSymlinks(STANDALONE_ROOT);
flattenPnpmStore(path.join(STANDALONE_ROOT, 'node_modules'));
}
async function buildElectron() {
if (fs.existsSync('dist')) {
fs.rmSync('dist', { recursive: true });
console.log('Cleaned dist/');
}
fs.mkdirSync('dist', { recursive: true });
const shared = {
bundle: true,
platform: 'node',
target: 'node18',
external: ['electron'],
sourcemap: true,
minify: false,
define: {
'process.env.HOSTED_FRONTEND_URL': JSON.stringify(
desktopEnv.HOSTED_FRONTEND_URL || 'https://surfsense.net'
),
},
};
await build({
...shared,
entryPoints: ['src/main.ts'],
outfile: 'dist/main.js',
});
await build({
...shared,
entryPoints: ['src/preload.ts'],
outfile: 'dist/preload.js',
});
console.log('Electron build complete');
resolveStandaloneSymlinks();
}
buildElectron().catch((err) => {
console.error(err);
process.exit(1);
});

View file

@ -0,0 +1,258 @@
import { app, BrowserWindow, shell, ipcMain, session, dialog, clipboard, Menu } from 'electron';
import path from 'path';
import { getPort } from 'get-port-please';
function showErrorDialog(title: string, error: unknown): void {
const err = error instanceof Error ? error : new Error(String(error));
console.error(`${title}:`, err);
if (app.isReady()) {
const detail = err.stack || err.message;
const buttonIndex = dialog.showMessageBoxSync({
type: 'error',
buttons: ['OK', process.platform === 'darwin' ? 'Copy Error' : 'Copy error'],
defaultId: 0,
noLink: true,
message: title,
detail,
});
if (buttonIndex === 1) {
clipboard.writeText(`${title}\n${detail}`);
}
} else {
dialog.showErrorBox(title, err.stack || err.message);
}
}
process.on('uncaughtException', (error) => {
showErrorDialog('Unhandled Error', error);
});
process.on('unhandledRejection', (reason) => {
showErrorDialog('Unhandled Promise Rejection', reason);
});
const isDev = !app.isPackaged;
let mainWindow: BrowserWindow | null = null;
let deepLinkUrl: string | null = null;
let serverPort: number = 3000; // overwritten at startup with a free port
const PROTOCOL = 'surfsense';
// Injected at compile time from .env via esbuild define
const HOSTED_FRONTEND_URL = process.env.HOSTED_FRONTEND_URL as string;
function getStandalonePath(): string {
if (isDev) {
return path.join(__dirname, '..', '..', 'surfsense_web', '.next', 'standalone', 'surfsense_web');
}
return path.join(process.resourcesPath, 'standalone');
}
async function waitForServer(url: string, maxRetries = 60): Promise<boolean> {
for (let i = 0; i < maxRetries; i++) {
try {
const res = await fetch(url);
if (res.ok || res.status === 404 || res.status === 500) return true;
} catch {
// not ready yet
}
await new Promise((r) => setTimeout(r, 500));
}
return false;
}
async function startNextServer(): Promise<void> {
if (isDev) return;
serverPort = await getPort({ port: 3000, portRange: [30_011, 50_000] });
console.log(`Selected port ${serverPort}`);
const standalonePath = getStandalonePath();
const serverScript = path.join(standalonePath, 'server.js');
// The standalone server.js reads PORT / HOSTNAME from process.env and
// uses process.chdir(__dirname). Running it via require() in the same
// process is the proven approach (avoids spawning a second Electron
// instance whose ASAR-patched fs breaks Next.js static file serving).
process.env.PORT = String(serverPort);
process.env.HOSTNAME = 'localhost';
process.env.NODE_ENV = 'production';
process.chdir(standalonePath);
require(serverScript);
const ready = await waitForServer(`http://localhost:${serverPort}`);
if (!ready) {
throw new Error('Next.js server failed to start within 30 s');
}
console.log(`Next.js server ready on port ${serverPort}`);
}
function createWindow() {
mainWindow = new BrowserWindow({
width: 1280,
height: 800,
minWidth: 800,
minHeight: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
sandbox: true,
webviewTag: false,
},
show: false,
titleBarStyle: 'hiddenInset',
});
mainWindow.once('ready-to-show', () => {
mainWindow?.show();
});
mainWindow.loadURL(`http://localhost:${serverPort}/login`);
// External links open in system browser, not in the Electron window
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
if (url.startsWith('http://localhost')) {
return { action: 'allow' };
}
shell.openExternal(url);
return { action: 'deny' };
});
// Intercept backend OAuth redirects targeting the hosted web frontend
// and rewrite them to localhost so the user stays in the desktop app.
const filter = { urls: [`${HOSTED_FRONTEND_URL}/*`] };
session.defaultSession.webRequest.onBeforeRequest(filter, (details, callback) => {
const rewritten = details.url.replace(HOSTED_FRONTEND_URL, `http://localhost:${serverPort}`);
callback({ redirectURL: rewritten });
});
mainWindow.webContents.on('did-fail-load', (_event, errorCode, errorDescription, validatedURL) => {
console.error(`Failed to load ${validatedURL}: ${errorDescription} (${errorCode})`);
if (errorCode === -3) return; // ERR_ABORTED — normal during redirects
showErrorDialog('Page failed to load', new Error(`${errorDescription} (${errorCode})\n${validatedURL}`));
});
if (isDev) {
mainWindow.webContents.openDevTools();
}
mainWindow.on('closed', () => {
mainWindow = null;
});
}
// IPC handlers
ipcMain.on('open-external', (_event, url: string) => {
try {
const parsed = new URL(url);
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
shell.openExternal(url);
}
} catch {
// invalid URL — ignore
}
});
ipcMain.handle('get-app-version', () => {
return app.getVersion();
});
// Deep link handling
function handleDeepLink(url: string) {
if (!url.startsWith(`${PROTOCOL}://`)) return;
deepLinkUrl = url;
if (!mainWindow) return;
// Rewrite surfsense:// deep link to localhost so TokenHandler.tsx processes it
const parsed = new URL(url);
if (parsed.hostname === 'auth' && parsed.pathname === '/callback') {
const params = parsed.searchParams.toString();
mainWindow.loadURL(`http://localhost:${serverPort}/auth/callback?${params}`);
}
mainWindow.show();
mainWindow.focus();
}
// Single instance lock — second instance passes deep link to first
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {
app.quit();
} else {
app.on('second-instance', (_event, argv) => {
// Windows/Linux: deep link URL is in argv
const url = argv.find((arg) => arg.startsWith(`${PROTOCOL}://`));
if (url) handleDeepLink(url);
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});
}
// macOS: deep link arrives via open-url event
app.on('open-url', (event, url) => {
event.preventDefault();
handleDeepLink(url);
});
// Register surfsense:// protocol
if (process.defaultApp) {
if (process.argv.length >= 2) {
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [path.resolve(process.argv[1])]);
}
} else {
app.setAsDefaultProtocolClient(PROTOCOL);
}
function setupMenu() {
const isMac = process.platform === 'darwin';
const template: Electron.MenuItemConstructorOptions[] = [
...(isMac ? [{ role: 'appMenu' as const }] : []),
{ role: 'fileMenu' as const },
{ role: 'editMenu' as const },
{ role: 'viewMenu' as const },
{ role: 'windowMenu' as const },
];
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
}
// App lifecycle
app.whenReady().then(async () => {
setupMenu();
try {
await startNextServer();
} catch (error) {
showErrorDialog('Failed to start SurfSense', error);
setTimeout(() => app.quit(), 0);
return;
}
createWindow();
// If a deep link was received before the window was ready, handle it now
if (deepLinkUrl) {
handleDeepLink(deepLinkUrl);
deepLinkUrl = null;
}
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('will-quit', () => {
// Server runs in-process — no child process to kill
});

View file

@ -0,0 +1,19 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
versions: {
electron: process.versions.electron,
node: process.versions.node,
chrome: process.versions.chrome,
platform: process.platform,
},
openExternal: (url: string) => ipcRenderer.send('open-external', url),
getAppVersion: () => ipcRenderer.invoke('get-app-version'),
onDeepLink: (callback: (url: string) => void) => {
const listener = (_event: unknown, url: string) => callback(url);
ipcRenderer.on('deep-link', listener);
return () => {
ipcRenderer.removeListener('deep-link', listener);
};
},
});

View file

@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"noEmit": true
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist", "scripts"]
}

View file

@ -71,7 +71,7 @@ COPY --from=builder /app/public ./public
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone/app/ ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Entrypoint scripts for runtime env var substitution

View file

@ -1,18 +1,18 @@
import { atomWithMutation, queryClientAtom } from "jotai-tanstack-query";
import type { UpdateUserRequest } from "@/contracts/types/user.types";
import { userApiService } from "@/lib/apis/user-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
import { USER_QUERY_KEY } from "./user-query.atoms";
export const updateUserMutationAtom = atomWithMutation((get) => {
const queryClient = get(queryClientAtom);
return {
mutationKey: cacheKeys.user.current(),
mutationKey: USER_QUERY_KEY,
mutationFn: async (request: UpdateUserRequest) => {
return userApiService.updateMe(request);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: cacheKeys.user.current() });
queryClient.invalidateQueries({ queryKey: USER_QUERY_KEY });
},
};
});

View file

@ -1,14 +1,16 @@
import { atomWithQuery } from "jotai-tanstack-query";
import { userApiService } from "@/lib/apis/user-api.service";
import { getBearerToken, isPublicRoute } from "@/lib/auth-utils";
import { cacheKeys } from "@/lib/query-client/cache-keys";
export const USER_QUERY_KEY = ["user", "me"] as const;
const userQueryFn = () => userApiService.getMe();
export const currentUserAtom = atomWithQuery(() => {
const pathname = typeof window !== "undefined" ? window.location.pathname : null;
return {
queryKey: cacheKeys.user.current(),
staleTime: 5 * 60 * 1000, // 5 minutes
queryKey: USER_QUERY_KEY,
staleTime: 5 * 60 * 1000,
enabled: !!getBearerToken() && pathname !== null && !isPublicRoute(pathname),
queryFn: async () => userApiService.getMe(),
queryFn: userQueryFn,
};
});

View file

@ -152,13 +152,38 @@ function usePrefetchVideos() {
}, []);
}
const AUTOPLAY_MS = 6000;
function HeroCarousel() {
const [activeIndex, setActiveIndex] = useState(0);
const [isGifExpanded, setIsGifExpanded] = useState(false);
const [isHovered, setIsHovered] = useState(false);
const [isTabVisible, setIsTabVisible] = useState(true);
const directionRef = useRef<"forward" | "backward">("forward");
usePrefetchVideos();
const shouldAutoPlay = !isGifExpanded && !isHovered && isTabVisible;
useEffect(() => {
if (!shouldAutoPlay) return;
const id = setTimeout(() => {
directionRef.current = "forward";
setActiveIndex((prev) =>
prev >= carouselItems.length - 1 ? 0 : prev + 1
);
}, AUTOPLAY_MS);
return () => clearTimeout(id);
}, [activeIndex, shouldAutoPlay]);
useEffect(() => {
const handler = () => setIsTabVisible(!document.hidden);
document.addEventListener("visibilitychange", handler);
return () => document.removeEventListener("visibilitychange", handler);
}, []);
const goTo = useCallback(
(newIndex: number) => {
directionRef.current = newIndex >= activeIndex ? "forward" : "backward";
@ -179,7 +204,11 @@ function HeroCarousel() {
const isForward = directionRef.current === "forward";
return (
<div className="w-full py-4 sm:py-8">
<div
className="w-full py-4 sm:py-8"
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
>
<div className="relative mx-auto w-full max-w-[900px]">
<AnimatePresence mode="wait" initial={false}>
<motion.div
@ -215,13 +244,25 @@ function HeroCarousel() {
key={`dot_${i}`}
type="button"
onClick={() => !isGifExpanded && goTo(i)}
className={`h-2 rounded-full transition-all duration-300 ${
className={`relative h-2 overflow-hidden rounded-full transition-all duration-300 ${
i === activeIndex
? "w-6 bg-neutral-900 dark:bg-white"
? shouldAutoPlay
? "w-6 bg-neutral-300 dark:bg-neutral-600"
: "w-6 bg-neutral-900 dark:bg-white"
: "w-2 bg-neutral-300 hover:bg-neutral-400 dark:bg-neutral-600 dark:hover:bg-neutral-500"
}`}
aria-label={`Go to slide ${i + 1}`}
/>
>
{i === activeIndex && shouldAutoPlay && (
<motion.span
key={`progress_${activeIndex}`}
className="absolute inset-0 origin-left rounded-full bg-neutral-900 dark:bg-white"
initial={{ scaleX: 0 }}
animate={{ scaleX: 1 }}
transition={{ duration: AUTOPLAY_MS / 1000, ease: "linear" }}
/>
)}
</button>
))}
</div>

View file

@ -1,3 +1,4 @@
import path from "path";
import { createMDX } from "fumadocs-mdx/next";
import type { NextConfig } from "next";
import createNextIntlPlugin from "next-intl/plugin";
@ -5,8 +6,12 @@ import createNextIntlPlugin from "next-intl/plugin";
// Create the next-intl plugin
const withNextIntl = createNextIntlPlugin("./i18n/request.ts");
// TODO: Separate app routes (/login, /dashboard) from marketing routes
// (landing page, /contact, /pricing, /docs) so the desktop build only
// ships what desktop users actually need.
const nextConfig: NextConfig = {
output: "standalone",
outputFileTracingRoot: path.join(__dirname, ".."),
reactStrictMode: false,
typescript: {
ignoreBuildErrors: true,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

After

Width:  |  Height:  |  Size: 9.4 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 MiB

After

Width:  |  Height:  |  Size: 4.2 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB

Before After
Before After