bigwolfe commited on
Commit
bfedc14
·
1 Parent(s): 77e3067

Fix TypeScript errors: add @types /d3-force, remove unused imports/variables

Browse files
frontend/package-lock.json CHANGED
@@ -36,6 +36,7 @@
36
  },
37
  "devDependencies": {
38
  "@eslint/js": "^9.39.1",
 
39
  "@types/node": "^24.10.0",
40
  "@types/react": "^19.2.2",
41
  "@types/react-dom": "^19.2.2",
@@ -3272,6 +3273,13 @@
3272
  "@babel/types": "^7.28.2"
3273
  }
3274
  },
 
 
 
 
 
 
 
3275
  "node_modules/@types/debug": {
3276
  "version": "4.1.12",
3277
  "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
 
36
  },
37
  "devDependencies": {
38
  "@eslint/js": "^9.39.1",
39
+ "@types/d3-force": "^3.0.10",
40
  "@types/node": "^24.10.0",
41
  "@types/react": "^19.2.2",
42
  "@types/react-dom": "^19.2.2",
 
3273
  "@babel/types": "^7.28.2"
3274
  }
3275
  },
3276
+ "node_modules/@types/d3-force": {
3277
+ "version": "3.0.10",
3278
+ "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.10.tgz",
3279
+ "integrity": "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==",
3280
+ "dev": true,
3281
+ "license": "MIT"
3282
+ },
3283
  "node_modules/@types/debug": {
3284
  "version": "4.1.12",
3285
  "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
frontend/package.json CHANGED
@@ -38,6 +38,7 @@
38
  },
39
  "devDependencies": {
40
  "@eslint/js": "^9.39.1",
 
41
  "@types/node": "^24.10.0",
42
  "@types/react": "^19.2.2",
43
  "@types/react-dom": "^19.2.2",
 
38
  },
39
  "devDependencies": {
40
  "@eslint/js": "^9.39.1",
41
+ "@types/d3-force": "^3.0.10",
42
  "@types/node": "^24.10.0",
43
  "@types/react": "^19.2.2",
44
  "@types/react-dom": "^19.2.2",
frontend/src/components/GraphView.tsx CHANGED
@@ -1,7 +1,7 @@
1
  import { useEffect, useRef, useState, useMemo } from 'react';
2
  import ForceGraph2D, { type ForceGraphMethods } from 'react-force-graph-2d';
3
  import { forceRadial } from 'd3-force';
4
- import type { GraphData, GraphNode } from '@/types/graph';
5
  import { getGraphData } from '@/services/api';
6
  import { Loader2, AlertCircle } from 'lucide-react';
7
  import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
@@ -14,7 +14,7 @@ export function GraphView({ onSelectNote }: GraphViewProps) {
14
  const [data, setData] = useState<GraphData>({ nodes: [], links: [] });
15
  const [isLoading, setIsLoading] = useState(true);
16
  const [error, setError] = useState<string | null>(null);
17
- const graphRef = useRef<ForceGraphMethods>();
18
  // Theme detection would go here, simplified for MVP
19
  const isDark = document.documentElement.classList.contains('dark');
20
 
 
1
  import { useEffect, useRef, useState, useMemo } from 'react';
2
  import ForceGraph2D, { type ForceGraphMethods } from 'react-force-graph-2d';
3
  import { forceRadial } from 'd3-force';
4
+ import type { GraphData } from '@/types/graph';
5
  import { getGraphData } from '@/services/api';
6
  import { Loader2, AlertCircle } from 'lucide-react';
7
  import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
 
14
  const [data, setData] = useState<GraphData>({ nodes: [], links: [] });
15
  const [isLoading, setIsLoading] = useState(true);
16
  const [error, setError] = useState<string | null>(null);
17
+ const graphRef = useRef<ForceGraphMethods | undefined>(undefined);
18
  // Theme detection would go here, simplified for MVP
19
  const isDark = document.documentElement.classList.contains('dark');
20
 
frontend/src/components/NoteViewer.tsx CHANGED
@@ -40,7 +40,7 @@ export function NoteViewer({
40
  // [[Link|Alias]] -> [Alias](wikilink:Link)
41
  const processedBody = useMemo(() => {
42
  if (!note.body) return '';
43
- const processed = note.body.replace(/\[\[([^\]]+)\]\]/g, (match, content) => {
44
  const [link, alias] = content.split('|');
45
  const displayText = alias || link;
46
  const href = `wikilink:${encodeURIComponent(link)}`;
 
40
  // [[Link|Alias]] -> [Alias](wikilink:Link)
41
  const processedBody = useMemo(() => {
42
  if (!note.body) return '';
43
+ const processed = note.body.replace(/\[\[([^\]]+)\]\]/g, (_match, content) => {
44
  const [link, alias] = content.split('|');
45
  const displayText = alias || link;
46
  const href = `wikilink:${encodeURIComponent(link)}`;
frontend/src/pages/MainApp.tsx CHANGED
@@ -29,7 +29,6 @@ import {
29
  } from '@/services/api';
30
  import {
31
  Dialog,
32
- DialogClose,
33
  DialogContent,
34
  DialogDescription,
35
  DialogFooter,
@@ -281,7 +280,7 @@ export function MainApp() {
281
  const folderPath = newFolderName.replace(/\/$/, ''); // Remove trailing slash if present
282
  const placeholderPath = `${folderPath}/.placeholder.md`;
283
 
284
- const note = await createNote({
285
  note_path: placeholderPath,
286
  title: 'Folder',
287
  body: `# ${folderPath}\n\nThis folder was created.`,
@@ -308,41 +307,6 @@ export function MainApp() {
308
  }
309
  };
310
 
311
- // Handle rename note
312
- const handleRenameNote = async (oldPath: string, newPath: string) => {
313
- if (!newPath.trim()) {
314
- toast.error('New path cannot be empty');
315
- return;
316
- }
317
-
318
- try {
319
- // Ensure new path has .md extension
320
- const finalNewPath = newPath.endsWith('.md') ? newPath : `${newPath}.md`;
321
-
322
- await moveNote(oldPath, finalNewPath);
323
-
324
- // Refresh notes list
325
- const notesList = await listNotes();
326
- setNotes(notesList);
327
-
328
- // If renaming currently selected note, update selection
329
- if (selectedPath === oldPath) {
330
- setSelectedPath(finalNewPath);
331
- }
332
-
333
- toast.success(`Note renamed successfully`);
334
- } catch (err) {
335
- let errorMessage = 'Failed to rename note';
336
- if (err instanceof APIException) {
337
- errorMessage = err.message || err.error;
338
- } else if (err instanceof Error) {
339
- errorMessage = err.message;
340
- }
341
- toast.error(errorMessage);
342
- console.error('Error renaming note:', err);
343
- }
344
- };
345
-
346
  // Handle dragging file to folder
347
  const handleMoveNoteToFolder = async (oldPath: string, targetFolderPath: string) => {
348
  try {
 
29
  } from '@/services/api';
30
  import {
31
  Dialog,
 
32
  DialogContent,
33
  DialogDescription,
34
  DialogFooter,
 
280
  const folderPath = newFolderName.replace(/\/$/, ''); // Remove trailing slash if present
281
  const placeholderPath = `${folderPath}/.placeholder.md`;
282
 
283
+ await createNote({
284
  note_path: placeholderPath,
285
  title: 'Folder',
286
  body: `# ${folderPath}\n\nThis folder was created.`,
 
307
  }
308
  };
309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
310
  // Handle dragging file to folder
311
  const handleMoveNoteToFolder = async (oldPath: string, targetFolderPath: string) => {
312
  try {