Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
f46f6aa
trying out authentication
jing-yen Sep 2, 2024
bfd9248
working authentication in collections, localhost switched to actual URL
jing-yen Sep 2, 2024
6d96cc4
collections and returns in large buttons
jing-yen Sep 2, 2024
76b52f1
make it more ipad-friendly
jing-yen Sep 6, 2024
f8d58ad
integrated outlook booking
jing-yen Sep 6, 2024
785fddc
include content security policy
jing-yen Sep 6, 2024
12d10e5
pwa support
jing-yen Sep 6, 2024
e37c084
fixed bugs
jing-yen Sep 9, 2024
c43a93b
test bookings as popup site
jing-yen Sep 9, 2024
fbbaa97
ui upgrades
jing-yen Sep 13, 2024
376e42c
separate into site for admins and site for students
jing-yen Sep 16, 2024
0cc7dc3
add serial numbers and staff name for each collection and return
jing-yen Sep 16, 2024
212c7ad
e2a support and landing page (big)
jing-yen Sep 27, 2024
02b5459
change idp hub title name
jing-yen Sep 27, 2024
7832b06
autofill date for collection and return to today's date; added e2a pi…
jing-yen Oct 4, 2024
98a0a7b
implement overdue loans, remove bug
jing-yen Oct 4, 2024
f391e6b
add serial number in dashboard
jing-yen Oct 7, 2024
5a98bd2
fix location bug
jing-yen Oct 11, 2024
7c0113e
location filter
jing-yen Oct 18, 2024
3c03362
fix dashboard null error
jing-yen Oct 28, 2024
2238368
color for pie chart
jing-yen Oct 28, 2024
0c89806
change pics for ipad air 1
jing-yen Nov 7, 2024
dfdc3e5
with credential check
jing-yen Nov 8, 2024
dbd9205
added pin verification option to complement touchid credentials
jing-yen Nov 8, 2024
f52a084
improved pin-passwordless handling
jing-yen Nov 11, 2024
ce47f51
fix specifically for ios 12! cannot use window.pushstate
jing-yen Nov 11, 2024
a8d3ce9
debug: show pin entry on passwordless
jing-yen Nov 11, 2024
3f25f83
fix: hopefully dashboard can show sign in now on the old ipad
jing-yen Nov 11, 2024
d754eae
fix2: mistake
jing-yen Nov 11, 2024
eddcd1c
add auto focus to verifypin on ipad
jing-yen Nov 11, 2024
d05b210
2nd add
jing-yen Nov 11, 2024
f233619
remove add because it fails on ipad
jing-yen Nov 11, 2024
6737fbe
fix: resizeobserver not available on ipad
jing-yen Nov 11, 2024
b9e1893
new way of signing in to dashboard
jing-yen Nov 11, 2024
eaa2c33
remove backslash
jing-yen Nov 11, 2024
d5ea020
try to not forget progress when verifypin called
jing-yen Nov 14, 2024
1f4bc55
do the same for dashboard
jing-yen Nov 14, 2024
cda5a5b
try it without verifypin interference
jing-yen Nov 14, 2024
112f3ad
revert changes
jing-yen Nov 14, 2024
a3c2c64
restrict edic.vercel.app from collecting and returning
jing-yen Nov 15, 2024
fb2c189
pdpa messages
jing-yen Jan 16, 2025
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: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
REACT_APP_API_URL=https://express-server-1.fly.dev
ADMIN_PIN=003342
41 changes: 41 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@mui/icons-material": "^5.14.19",
"@mui/material": "^5.14.19",
"@simplewebauthn/browser": "^10.0.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.5",
"chart.js": "^4.4.4",
"cors": "^2.8.5",
"express": "^4.18.2",
"passport": "^0.7.0",
"passport-microsoft": "^1.0.0",
"pg": "^8.11.3",
"pg-promise": "^11.5.4",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.20.1",
"react-scripts": "5.0.1",
Expand Down
Binary file added public/EDIC.jpg
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 public/EDIC2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/automatic_wire_stripper-rs_pro.jpg
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 public/assets/automatic_wire_stripper-rs_pro2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/default.jpg
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 public/assets/default2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/assets/wire_wrap_tool-jonard_tools.jpg
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 public/assets/wire_wrap_tool-jonard_tools2.jpg
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 public/desktop_screenshot.png
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 public/hub.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/hub_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="frame-src https://outlook.office365.com https://login.microsoftonline.com;">
<link rel="icon" href="%PUBLIC_URL%/hub_logo_white.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
Expand Down
32 changes: 32 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"short_name": "Hub App",
"name": "Book Equipment, Makers and Spaces",
"icons": [
{
"src": "/hub_logo_white.png",
"type": "image/png",
"sizes": "585x585"
}
],
"id": "/?source=pwa",
"start_url": "/?source=pwa",
"background_color": "#FFF",
"display": "standalone",
"scope": "/",
"theme_color": "#FFF",
"description": "Weather forecast information",
"screenshots": [
{
"src": "/phone_screenshot.png",
"type": "image/png",
"sizes": "1290x2795",
"form_factor": "narrow"
},
{
"src": "/desktop_screenshot.png",
"type": "image/png",
"sizes": "1920x1080",
"form_factor": "wide"
}
]
}
Binary file added public/phone_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 51 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,65 @@
import './styles/App.css';
import Navbar from './components/Navbar';
import Home from './pages/Home';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Catalogue from './pages/Catalogue';
import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
import NewBorrowForm from './components/NewBorrowForm';
import NewCollectForm from './components/NewCollectForm';
import NewReturnForm from './components/NewReturnForm';
import { CartProvider } from './components/CartContext'; // Import the provider

import { LocationProvider } from './components/LocationContext';
import LoanDashboard from './pages/Dashboard';
import OutlookBooking from './pages/Booking';
import { useEffect, useState } from 'react';
import VerifyPIN from './components/VerifyPIN';

function App() {
// Verify PIN logic for all situations
const [verifiedByStaff, setVerifiedByStaff] = useState(false);
const [verifying, setVerifying] = useState(false);
const location = useLocation();
const navigate = useNavigate();

const startVerificationProcess = () => {
setVerifying(true);
}

const handleVerificationResponse = (verified) => {
console.log('Verification response:', verified);
setVerifiedByStaff(verified);
setVerifying(false);
if (location.pathname=='/catalogue' && verified) navigate('/dashboard');
}


useEffect(() => {
console.log('Location:', location.pathname);
if (location.pathname=='/dashboard') return;
setVerifiedByStaff(false);
setVerifying(false);
}, [location.pathname]);

return (
<div className="App">
<CartProvider>
<Router>
<LocationProvider>
<Navbar />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/new-borrow-form" element={<NewBorrowForm />} />
</Routes>
</Router>
<VerifyPIN setVerifiedByStaff={handleVerificationResponse} verifying={verifying}>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/catalogue" element={<Catalogue startVerification={startVerificationProcess} verifiedByStaff={verifiedByStaff}/>} />
<Route path="/new-borrow-form" element={<NewBorrowForm />} />
<Route path="/booking" element={<OutlookBooking /> /*not used*/} />
</Routes>
{window.location.host != 'edic.vercel.app' /*only on edic-vercel.app*/ &&
<Routes>
<Route path="/new-collect-form" element={<NewCollectForm startVerification={startVerificationProcess} verifiedByStaff={verifiedByStaff}/>} />
<Route path="/new-return-form" element={<NewReturnForm startVerification={startVerificationProcess} verifiedByStaff={verifiedByStaff} />} />
<Route path="/dashboard" element={<LoanDashboard startVerification={()=>alert('hi')} verifiedByStaff={verifiedByStaff} />} />
</Routes>
}
</VerifyPIN>
</LocationProvider>
</CartProvider>
</div>
);
Expand Down
16 changes: 8 additions & 8 deletions src/components/InventoryList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Modal from './Modal';
import '../styles/App.css';
import SearchBar from './SearchBar';
import { useCart } from './CartContext';
import { useWhichLocation } from './LocationContext';

function InventoryItem({ item, onAddToCart }) {
const [modalOpen, setModalOpen] = useState(false);
Expand Down Expand Up @@ -31,8 +32,7 @@ function InventoryItem({ item, onAddToCart }) {
<div className={`inventory-item`} onClick={handleItemClick}>
<img src={imageUrl} alt={item.item_name} onError={handleImageError} className="item-image" />
<h3 className="item-title">{item.item_name}</h3>
{item.brand && <p className="item-brand">{item.brand}</p>}
<p className="item-details">Qty: {item.qty_available}</p>
<p className="item-brand">{item.brand}&zwnj;</p>
</div>

<Modal isOpen={modalOpen} onClose={() => setModalOpen(false)}>
Expand All @@ -57,6 +57,7 @@ function InventoryItem({ item, onAddToCart }) {


function InventoryList() {
const { whichLocation } = useWhichLocation();
const [items, setItems] = useState([]);
const [searchTerm, setSearchTerm] = useState('');
const [selectedCategories, setSelectedCategories] = useState([]);
Expand All @@ -82,14 +83,15 @@ function InventoryList() {


useEffect(() => {
fetch(`${API_URL}/api/inventory`)
console.log(whichLocation);
fetch(`${API_URL}/api/inventory`+ (whichLocation=='e2a' ? 'E2A' : ''))
.then(response => response.json())
.then(data => {
const groupedItems = groupAndSumItems(data);
setItems(groupedItems);
})
.catch(error => console.error('Error fetching data:', error));
}, [API_URL]);
}, [API_URL, whichLocation]);


const handleSearchChange = (newSearchTerm) => {
Expand Down Expand Up @@ -157,9 +159,8 @@ function InventoryList() {
.sort((a, b) => a.item_name.localeCompare(b.item_name)); // This line adds sorting by item_name

return (
<div className="main-content">
<div>
<SearchBar
<div className="">
<SearchBar
onSearchChange={handleSearchChange}
onCategoryChange={handleCategoryChange}
selectedCategories={selectedCategories}
Expand All @@ -173,7 +174,6 @@ function InventoryList() {
/>)
)}
</div>
</div>
</div>
);
}
Expand Down
17 changes: 17 additions & 0 deletions src/components/LocationContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { createContext, useContext, useState } from 'react';

const LocationContext = createContext();

export function useWhichLocation() {
return useContext(LocationContext);
}

export const LocationProvider = ({ children }) => {
const [whichLocation, setWhichLocation] = useState('hub');

return (
<LocationContext.Provider value={{ whichLocation, setWhichLocation }}>
{children}
</LocationContext.Provider>
);
};
Loading