Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/desktop/electron-vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default defineConfig({
rollupOptions: {
input: {
index: resolve(__dirname, 'src/renderer/index.html'),
settings: resolve(__dirname, 'src/renderer/settings.html'),
},
Comment on lines 52 to 55

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep a settings entry point in the renderer build

Removing the settings.html entry from the renderer build means the production bundle no longer emits a settings page, but window:openSettings in apps/desktop/src/main/index.ts still calls loadFile('../renderer/settings.html') (and dev replaces the URL with /settings.html). That makes the settings window open to a missing file/404, so the Settings UI won’t render at all when users click the sidebar settings button. Either keep a settings.html build input or update the main-process loader to point at index.html?view=settings.

Useful? React with 👍 / 👎.

},
},
Expand Down
25 changes: 24 additions & 1 deletion apps/desktop/src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Exposes a typed API to the renderer process via contextBridge.
*/

import { contextBridge, ipcRenderer } from 'electron';
import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron';

/** Result type from operations */
export type Result<T> =
Expand Down Expand Up @@ -311,6 +311,16 @@ export interface ReadiedAPI {
/** Open the settings window */
openSettings: () => Promise<{ ok: boolean }>;
};
settings: {
/** Notify other windows of settings change */
notifyChange: (settings: unknown) => void;
/** Listen for settings sync from other windows */
onSync: (callback: (settings: unknown) => void) => () => void;
};
updates: {
/** Check for updates manually */
checkNow: () => Promise<{ available: boolean; version?: string }>;
};
}

// Expose the API
Expand Down Expand Up @@ -403,6 +413,19 @@ const api: ReadiedAPI = {
openNote: (noteId, noteTitle) => ipcRenderer.invoke('window:openNote', noteId, noteTitle),
openSettings: () => ipcRenderer.invoke('window:openSettings'),
},
settings: {
notifyChange: settings => ipcRenderer.send('settings:changed', settings),
onSync: callback => {
const handler = (_event: IpcRendererEvent, settings: unknown) => callback(settings);
ipcRenderer.on('settings:sync', handler);
return () => {
ipcRenderer.removeListener('settings:sync', handler);
};
},
},
updates: {
checkNow: () => ipcRenderer.invoke('updates:checkNow'),
},
};

contextBridge.exposeInMainWorld('readied', api);
Expand Down
16 changes: 12 additions & 4 deletions apps/desktop/src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ import { useDebouncedSearch } from './hooks/useDebouncedSearch';
import { useKeyboardShortcuts } from './hooks/useKeyboardShortcuts';
import { useEditorPreferencesStore } from './stores/editorPreferencesStore';
import { useTagColorsStore } from './stores/tagColorsStore';
import { useSettingsStore, selectGeneral } from './stores/settings';
import { usePerformanceMode } from './hooks/usePerformanceMode';
import { useResizableLayout } from './hooks/useResizableLayout';
import { useTheme } from './hooks/useTheme';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -41,6 +43,7 @@ const queryClient = new QueryClient({
*/
function NotesApp() {
usePerformanceMode();
useTheme();

// Resizable layout
const { sidebarWidth, notelistWidth, startResizeSidebar, startResizeNotelist } =
Expand All @@ -59,6 +62,9 @@ function NotesApp() {
// Editor preferences
const cycleViewMode = useEditorPreferencesStore(state => state.cycleViewMode);

// General settings (for default notebook)
const generalSettings = useSettingsStore(selectGeneral);

// Load tag colors on mount (once)
useEffect(() => {
useTagColorsStore.getState().loadColors();
Expand Down Expand Up @@ -99,15 +105,16 @@ function NotesApp() {
// Determine selected quick filter for NoteList header
const selectedQuickFilter = navigation.kind === 'global' ? navigation.filter : null;

// Create new note (respects current navigation context)
// Create new note (respects current navigation context, falls back to default notebook)
const handleNewNote = useCallback(async () => {
const notebookId = selectedNotebookId ?? generalSettings.defaultNotebookId ?? undefined;
const newNote = await createNote.mutateAsync({
content: '# Untitled\n\n',
notebookId: selectedNotebookId ?? undefined,
notebookId,
});
setSelectedNote(newNote);
clearSearch();
}, [createNote, selectedNotebookId, clearSearch]);
}, [createNote, selectedNotebookId, generalSettings.defaultNotebookId, clearSearch]);

// Select note
const handleSelectNote = useCallback(async (id: string) => {
Expand All @@ -119,13 +126,14 @@ function NotesApp() {

// Handle wikilink click - best-effort navigation by title
const handleWikilinkClick = useCallback(
async (title: string) => {
async (title: string, _anchor?: string) => {
const notes = await window.readied.notes.search(title);
if (notes.length > 0) {
// Find exact match (case-insensitive)
const match = notes.find(n => n.title.toLowerCase() === title.toLowerCase());
if (match) {
handleSelectNote(match.id);
// TODO: scroll to anchor after navigation (requires editor/preview scroll API)
}
}
// No-op if note doesn't exist (future: could show toast or create note)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-md);
box-shadow: var(--shadow-lg);
padding: 8px;
min-width: 120px;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/renderer/components/NoteEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface NoteEditorProps {
onStatusChange?: (status: NoteStatus) => void;
onDuplicate?: () => void;
onDelete?: () => void;
onWikilinkClick?: (target: string) => void;
onWikilinkClick?: (target: string, anchor?: string) => void;
onNavigateToNote?: (noteId: string) => void;
/** Called when note is updated (e.g., tags changed) */
onNoteUpdate?: (note: NoteSnapshot) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
-webkit-backdrop-filter: blur(24px) saturate(150%);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 8px;
box-shadow:
0 12px 48px rgba(0, 0, 0, 0.5),
0 0 1px rgba(0, 0, 0, 0.2);
padding: 4px;
animation: fadeIn 0.1s ease-out;
}
Expand Down Expand Up @@ -119,9 +116,6 @@
-webkit-backdrop-filter: blur(24px) saturate(150%);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 8px;
box-shadow:
0 12px 48px rgba(0, 0, 0, 0.5),
0 0 1px rgba(0, 0, 0, 0.2);
padding: 4px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
max-width: 560px;
background: var(--bg-inset, #1a1d23);
border-radius: 8px;
border: none;
box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
border: 1px solid var(--border);
overflow: hidden;
animation: slideIn 0.15s ease-out;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
border-left: 1px solid var(--glass-border);
box-shadow: var(--glass-shadow);
transform: translateX(100%);
transition: transform var(--transition-normal);
z-index: 50;
Expand All @@ -61,7 +60,6 @@
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
border-left: 1px solid var(--glass-border);
box-shadow: var(--glass-shadow);
transform: translateX(0);
transition: transform var(--transition-normal);
z-index: 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
border-left: 1px solid var(--glass-border);
box-shadow: var(--glass-shadow);
transform: translateX(100%);
transition: transform var(--transition-normal);
z-index: 50;
Expand All @@ -62,7 +61,6 @@
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
border-left: 1px solid var(--glass-border);
box-shadow: var(--glass-shadow);
transform: translateX(0);
transition: transform var(--transition-normal);
z-index: 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface MarkdownPreviewProps {
readonly createdAt?: string;
readonly updatedAt?: string;
readonly onReady?: () => void;
readonly onWikilinkClick?: (target: string) => void;
readonly onWikilinkClick?: (target: string, anchor?: string) => void;
readonly onEmbedClick?: (target: string, url: string) => void;
/** Optional pre-resolved embeds from parent (for sharing with editor) */
readonly resolvedEmbeds?: Record<string, string | null>;
Expand Down Expand Up @@ -116,9 +116,10 @@ export const MarkdownPreview = forwardRef<MarkdownPreviewHandle, MarkdownPreview
const wikilinkEl = (e.target as HTMLElement).closest('.wikilink');
if (wikilinkEl) {
const noteTitle = wikilinkEl.getAttribute('data-target');
const anchor = wikilinkEl.getAttribute('data-anchor') ?? undefined;
if (noteTitle && onWikilinkClick) {
e.preventDefault();
onWikilinkClick(noteTitle);
onWikilinkClick(noteTitle, anchor);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
max-width: 420px;
background: var(--bg-inset, #1a1d23);
border-radius: 12px;
border: none;
box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
border: 1px solid var(--border);
overflow: hidden;
animation: slideIn 0.15s ease-out;
padding: 20px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
background: var(--bg-inset, #1a1d23);
border-radius: 12px;
border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
overflow: hidden;
animation: slideIn 0.2s ease-out;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
-webkit-backdrop-filter: blur(24px) saturate(150%);
border: 1px solid rgba(255, 255, 255, 0.06);
border-radius: 8px;
box-shadow:
0 12px 48px rgba(0, 0, 0, 0.5),
0 0 1px rgba(0, 0, 0, 0.2);
padding: 4px;
animation: fadeIn 0.1s ease-out;
}
Expand Down
Loading