Skip to content
Merged
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
2 changes: 1 addition & 1 deletion PERFORMANCE_AUDIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This critical area for a background desktop app is fully resolved.
**Status: 🟢 Excellent**

**Linting:**
* `npm run lint` yields 0 errors and only 13 minimal warnings (`no-empty`, `no-console`, and some remaining `any` types that are safe or intentional). The majority of the codebase is now strongly typed.
* `npm run lint` yields 0 errors and only 8 minimal warnings (`no-empty`, `no-console`, and some remaining `any` types that are safe or intentional). The majority of the codebase is now strongly typed.

**Electron-Builder:**
* `asar` packaging is efficiently enabled.
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ PaperCache brings AI right into your note — no subscription, no middleman. You

---

## Support

If you find PaperCache useful, consider buying me a coffee to support its ongoing development!

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/thevariable)

---

## License

MIT License.

4 changes: 3 additions & 1 deletion src/Settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ describe('Settings Component', () => {
})

it('loads API key status from IPC', async () => {
;(window.electronAPI.getApiKeyStatus as any).mockResolvedValue(true)
;(
window.electronAPI.getApiKeyStatus as unknown as { mockResolvedValue: (v: boolean) => void }
).mockResolvedValue(true)
await act(async () => {
render(<Settings />)
})
Expand Down
9 changes: 6 additions & 3 deletions src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CodeMirror from '@uiw/react-codemirror'
import { ViewUpdate } from '@codemirror/view'
import { useAppStore } from '../store/useAppStore'
import { useSettingsStore } from '../store/useSettingsStore'
import { MathEvaluator } from '../lib/editor/MathEvaluator'

import { useEditorExtensions } from '../lib/editor/extensions'

import { type TransactionSpec } from '@codemirror/state'
Expand Down Expand Up @@ -54,14 +54,17 @@ export const Editor = forwardRef<EditorRef>((_props, ref) => {

if (viewUpdate?.transactions?.some((tr) => tr.docChanged)) {
if (editorRef.current?.view) {
MathEvaluator.triggerMathEvaluation(editorRef.current.view)
const view = editorRef.current.view
import('../lib/editor/MathEvaluator').then((m) => {
m.MathEvaluator.triggerMathEvaluation(view)
})
}
}
},
[currentNoteIndex, setNotes]
)

const extensions = useEditorExtensions(handleEditorChange)
const extensions = useEditorExtensions()

useEffect(() => {
const handleWindowFocus = () => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/NoteTitleBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function NoteTitleBar() {
prev.map((n) => (n.id === activeNote.id ? { ...n, content: newContent } : n))
)
} catch (e) {
// eslint-disable-next-line no-console
console.error('Failed to save note', e)
}
} else {
Expand All @@ -50,6 +51,7 @@ export function NoteTitleBar() {
setNotes((prev) => prev.map((n) => (n.id === activeNote.id ? { ...n, id: newId } : n)))
}
} catch (e) {
// eslint-disable-next-line no-console
console.error('Failed to rename note', e)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useReminders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('useReminders', () => {
window.electronAPI = {
onPowerSuspend: vi.fn().mockReturnValue(vi.fn()),
onPowerResume: vi.fn().mockReturnValue(vi.fn()),
} as Partial<Window['electronAPI']> as any
} as unknown as Window['electronAPI']
}

// Clear localStorage
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useReminders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function handleDueReminders(notes: Note[]) {
for (const r of allReminders) {
if (now >= r.dueAt.getTime()) {
if (!notified.has(r.key)) {
// eslint-disable-next-line no-console
console.log('Triggering OS notification for:', r.label)
new Notification('PaperCache Reminder', {
body: r.label,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/editor/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
return true
}

export function useEditorExtensions(handleEditorChange: (val: string) => void) {
export function useEditorExtensions() {
const { apiBaseUrl, apiModel, aiSystemPrompt } = useAIStore()

return useMemo(
Expand Down Expand Up @@ -149,7 +149,7 @@
messages: messages,
baseURL: finalBaseUrl || '',
})
.then((completion: any) => {

Check warning on line 152 in src/lib/editor/extensions.ts

View workflow job for this annotation

GitHub Actions / ci (windows-latest)

Unexpected any. Specify a different type

Check warning on line 152 in src/lib/editor/extensions.ts

View workflow job for this annotation

GitHub Actions / ci (macos-latest)

Unexpected any. Specify a different type

Check warning on line 152 in src/lib/editor/extensions.ts

View workflow job for this annotation

GitHub Actions / ci (ubuntu-latest)

Unexpected any. Specify a different type
let response: string
if (completion.choices && completion.choices.length > 0) {
response = completion.choices[0].message?.content || ''
Expand Down Expand Up @@ -236,6 +236,6 @@
},
}),
],
[apiBaseUrl, apiModel, aiSystemPrompt, handleEditorChange]
[apiBaseUrl, apiModel, aiSystemPrompt]
)
}
4 changes: 3 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ export const getFolderColor = (str: string): string => {
let colors: Record<string, string> = {}
try {
colors = JSON.parse(localStorage.getItem('papercache-folder-colors') || '{}')
} catch {}
} catch {
/* ignore */
}

if (colors[str]) return colors[str]

Expand Down
Loading