diff --git a/main.go b/main.go index 18968d8..b5f9c34 100644 --- a/main.go +++ b/main.go @@ -270,6 +270,14 @@ func main() { router.GET("/", func(c *gin.Context) { serveEmbeddedFile(c, "", "index.html") }) + // history route + router.GET("/history", func(c *gin.Context) { + serveEmbeddedFile(c, "", "index.html") + }) + // experimental-ocr route + router.GET("/experimental-ocr", func(c *gin.Context) { + serveEmbeddedFile(c, "", "index.html") + }) // Start OCR worker pool numWorkers := 1 // Number of workers to start diff --git a/web-app/src/components/Sidebar.tsx b/web-app/src/components/Sidebar.tsx index ae17d27..69485d5 100644 --- a/web-app/src/components/Sidebar.tsx +++ b/web-app/src/components/Sidebar.tsx @@ -1,11 +1,10 @@ +import { mdiHistory, mdiHomeOutline, mdiTextBoxSearchOutline } from "@mdi/js"; +import { Icon } from "@mdi/react"; import axios from "axios"; -import React, { useCallback, useEffect, useState } from 'react'; -import "./Sidebar.css"; -import { Link, useLocation } from 'react-router-dom'; -import { Icon } from '@mdi/react'; -import { mdiHomeOutline, mdiTextBoxSearchOutline, mdiHistory } from '@mdi/js'; +import React, { useCallback, useEffect, useState } from "react"; +import { Link, useLocation } from "react-router-dom"; import logo from "../assets/logo.svg"; - +import "./Sidebar.css"; interface SidebarProps { onSelectPage: (page: string) => void; @@ -27,7 +26,9 @@ const Sidebar: React.FC = ({ onSelectPage }) => { const [ocrEnabled, setOcrEnabled] = useState(false); const fetchOcrEnabled = useCallback(async () => { try { - const res = await axios.get<{ enabled: boolean }>("/api/experimental/ocr"); + const res = await axios.get<{ enabled: boolean }>( + "/api/experimental/ocr" + ); setOcrEnabled(res.data.enabled); } catch (err) { console.error(err); @@ -39,30 +40,45 @@ const Sidebar: React.FC = ({ onSelectPage }) => { }, [fetchOcrEnabled]); const menuItems = [ - { name: 'home', path: '/', icon: mdiHomeOutline, title: 'Home' }, - { name: 'history', path: '/history', icon: mdiHistory, title: 'History' }, + { name: "home", path: "/", icon: mdiHomeOutline, title: "Home" }, + { name: "history", path: "/history", icon: mdiHistory, title: "History" }, ]; // If OCR is enabled, add the OCR menu item if (ocrEnabled) { - menuItems.push({ name: 'ocr', path: '/experimental-ocr', icon: mdiTextBoxSearchOutline, title: 'OCR' }); + menuItems.push({ + name: "ocr", + path: "/experimental-ocr", + icon: mdiTextBoxSearchOutline, + title: "OCR", + }); } return (
- {!collapsed && Logo} + {!collapsed && ( + Logo + )}
    {menuItems.map((item) => ( -
  • +
  • handlePageClick(item.name)} + > handlePageClick(item.name)} - style={{ display: 'flex', alignItems: 'center' }} + style={{ display: "flex", alignItems: "center" }} > {/* {!collapsed &&   {item.title}} */}