Skip to content

Commit

Permalink
Implement inventory editor
Browse files Browse the repository at this point in the history
New Features: Inventory editor and authentication page

# Sidebar shows available items in the store when inventory editor is opened
# Items can be dragged and dropped to a shelf
# Layouts are stored in the local storage
  • Loading branch information
ChamudithaNawarathna committed Mar 3, 2025
1 parent 2fa05b8 commit 99261ef
Show file tree
Hide file tree
Showing 29 changed files with 2,399 additions and 284 deletions.
Binary file added web-app/assets/Kist_Jam_Mixed_Fruit_510g.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added web-app/assets/Nescafe_Ice_Cold_Coffee_180ml.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
640 changes: 587 additions & 53 deletions web-app/package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
"preview": "vite preview"
},
"dependencies": {
"@tailwindcss/vite": "^4.0.9",
"konva": "^9.3.18",
"lodash": "^4.17.21",
"lucide-react": "^0.477.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-konva": "^19.0.2",
"react-router-dom": "^7.2.0",
"tailwindcss": "^4.0.9",
"uuid": "^11.0.5",
"zustand": "^5.0.3"
},
Expand Down
58 changes: 46 additions & 12 deletions web-app/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,56 @@
// App.tsx
import React from "react";
import LayoutEditor from "./features/editor/LayoutEditor";
import { BrowserRouter, Routes, Route, Navigate } from "react-router-dom";
import { FixtureProvider } from "./context/FixtureContext";
import { EdgeProvider } from "./context/EdgeContext";
import { NodeProvider } from "./context/NodeContext";
import { SidebarProvider } from "./context/SidebarContext";
import Main from "./components/Main";
import AuthPage from "./AuthPage";

// Simple authentication check
const useAuth = () => {
// In a real app, you would check localStorage/sessionStorage or a state management store
// This is just a simple example for demonstration
const isAuthenticated = localStorage.getItem("isAuthenticated") === "true";
return { isAuthenticated };
};

// Protected route component
const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const { isAuthenticated } = useAuth();

if (!isAuthenticated) {
return <Navigate to="/" replace />;
}

return <>{children}</>;
};

const App: React.FC = () => {
return (
<div>
<FixtureProvider>
<EdgeProvider>
<NodeProvider>
<LayoutEditor />
</NodeProvider>
</EdgeProvider>
</FixtureProvider>
</div>
<BrowserRouter>
<SidebarProvider>
<FixtureProvider>
<EdgeProvider>
<NodeProvider>
<Routes>
<Route path="/" element={<AuthPage />} />
<Route
path="/editor"
element={
<ProtectedRoute>
<Main />
</ProtectedRoute>
}
/>
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
</NodeProvider>
</EdgeProvider>
</FixtureProvider>
</SidebarProvider>
</BrowserRouter>
);
};

export default App;
export default App;
Loading

0 comments on commit 99261ef

Please sign in to comment.