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
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/src/assets/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<title>ArchAIve</title>
</head>
<body>
<div id="root"></div>
Expand Down
12 changes: 8 additions & 4 deletions src/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect } from 'react'
import { useDispatch } from 'react-redux'
import { Outlet, useNavigate } from 'react-router';
import Navbar from './components/Navbar';
import { Toaster } from './components/ui/toaster';

function Layout() {
const dispatch = useDispatch();
Expand All @@ -12,10 +13,13 @@ function Layout() {
}, [])

return (
<div className='defaultLayout'>
<Navbar />
<Outlet />
</div>
<>
<div className='defaultLayout'>
<Navbar />
<Outlet />
</div>
<Toaster />
</>
)
}

Expand Down
1 change: 1 addition & 0 deletions src/assets/favicon.svg
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 src/assets/hp1.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 src/assets/hp2.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 src/assets/hp3.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 src/assets/hp4.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 src/assets/hp5.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 src/assets/hp6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion src/assets/react.svg

This file was deleted.

Binary file added src/assets/sccciBuildingOpening1964.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions src/components/toastWizard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import { toaster } from "./ui/toaster";

/**
* `ToastWizard` is a utility class for creating and managing toasts in the application.
* It provides methods to create standard toasts and promise-based toasts with various configurations.
*
* Usage:
* ```javascript
* import ToastWizard from './path/to/ToastWizard';
*
* const callback = () => console.log('Action clicked!');
*
* ToastWizard.standard(
* "success",
* "Operation Successful",
* "Your operation was completed successfully.",
* 5000, // duration (optional)
* true, // closable (optional)
* callback, // action (optional)
* "Undo" // actionLabel. provide if action is being provided. (optional)
* )
*
*
* // Promise-based usage
* const myPromise = new Promise((resolve, reject) => {
* // Simulate an async operation
* setTimeout(() => {
* resolve("Data loaded successfully");
* }, 2000);
* });
*
* ToastWizard.promiseBased(
* myPromise,
* "Operation Successful", // successTitle
* "Data loaded successfully", // successDescription
* "Error", // errorTitle
* "Failed to load data", // errorDescription
* "Loading", // loadingTitle
* "Please wait while we load your data", // loadingDescription
* callback, // action (optional)
* "Cancel" // actionLabel. provide if action is being provided. (optional)
* )
* ```
*
* `ToastWizard` uses the default `toaster` initialisation from Chakra UI. (See `src/components/ui/toaster.js` for more details)
*/
class ToastWizard {
// constructor(toaster) {
// self.toaster = toaster;
// }

static standard(type, title, description=null, duration=3000, closable=false, action=null, actionLabel=null) {
var creationObject = {
type: type,
title: title,
duration: duration,
closable: closable
}

if (description) {
creationObject.description = description;
}

if (action && actionLabel) {
creationObject.action = {
label: actionLabel,
onClick: action
}
}

const id = toaster.create(creationObject)
return id;
}

static promiseBased(promise, successTitle, successDescription, errorTitle, errorDescription, loadingTitle, loadingDescription, action=null, actionLabel=null) {
return toaster.promise(promise, {
success: {
title: successTitle,
description: successDescription,
action: action ? {
label: actionLabel,
onClick: action
} : null
},
error: {
title: errorTitle,
description: errorDescription,
action: action ? {
label: actionLabel,
onClick: action
} : null
},
loading: {
title: loadingTitle,
description: loadingDescription,
action: action ? {
label: actionLabel,
onClick: action
} : null
}
})
}
}

export default ToastWizard;
12 changes: 11 additions & 1 deletion src/components/ui/toaster.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@ export const toaster = createToaster({
pauseOnPageIdle: true,
})

const toastColors = {
success: 'primaryColour',
error: 'sccciColour',
info: 'blue.500',
warning: 'orange.500',
loading: 'gray.500',
default: 'gray.700',
};


export const Toaster = () => {
return (
<Portal>
<ChakraToaster toaster={toaster} insetInline={{ mdDown: '4' }}>
{(toast) => (
<Toast.Root width={{ md: 'sm' }}>
<Toast.Root width={{ md: 'sm' }} bg={toastColors[toast.type] || toastColors.default} borderRadius={'20px'}>
{toast.type === 'loading' ? (
<Spinner size='sm' color='blue.solid' />
) : (
Expand Down
9 changes: 8 additions & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ChakraProvider, defaultSystem, Text } from "@chakra-ui/react"
import { Provider } from 'react-redux'
import { configureStore } from '@reduxjs/toolkit'
import universalReducer from './slices/UniversalState.js'
import authReducer from './slices/AuthState.js'
import { BrowserRouter, Route, Routes } from 'react-router'
import Catalogue from './pages/Catalogue.jsx'
// import Test from './pages/test.jsx'
Expand All @@ -13,10 +14,12 @@ import GalleryLayout from './GalleryLayout.jsx';
import MainTheme from './themes/MainTheme.js'
import Health from './pages/Health.jsx'
import Homepage from './pages/Homepage.jsx'
import Login from './pages/Login.jsx';

const store = configureStore({
reducer: {
universal: universalReducer
universal: universalReducer,
auth: authReducer
}
})

Expand All @@ -29,6 +32,10 @@ createRoot(document.getElementById('root')).render(
<Route index element={<Homepage />} />
<Route path='health' element={<Health />} />

<Route path="auth">
<Route path="login" element={<Login />} />
</Route>

{/* <Route path='/test' element={<Test />} /> */}
</Route>

Expand Down
12 changes: 10 additions & 2 deletions src/networking.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,25 @@ class JSONResponse {
this.status = status || 400;
this.type = data.type || null;
this.message = data.message || null;
this.data = structuredClone(data || {});
this.raw = structuredClone(data || {});
}

isError() {
isErrorStatus() {
if (this.status === undefined || this.status === null) {
console.warn("JSONResponse isError: Status is undefined or null, defaulting to error positive.");
return true;
}
return !String(this.status).startsWith("2");
}

errorType() {
return this.type === "ERROR";
}

userErrorType() {
return this.type === "UERROR";
}

fullMessage() {
if (this.type && this.message) {
return `${this.type}: ${this.message}`;
Expand Down
50 changes: 48 additions & 2 deletions src/pages/Homepage.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,54 @@
import { Flex, Text } from '@chakra-ui/react'
import { Box, Button, Flex, Image, Spacer, Text, VStack } from '@chakra-ui/react'
import hp1 from '../assets/hp1.png';
import hp2 from '../assets/hp2.png';
import hp3 from '../assets/hp3.png';
import hp4 from '../assets/hp4.png';
import hp5 from '../assets/hp5.png';
import hp6 from '../assets/hp6.png';

function Homepage() {
const imgResponsiveSizing = { base: "150px", md: "250px" }
const imgColumnMinWidth = { base: "350px", md: "450px" }
const imgOffset = "-100px"

return <Flex flexDir={'column'} justifyContent={'center'}>
<Text fontSize={'4xl'} fontWeight={'bold'} textAlign={'center'} mt={10} mb={5}>Connect <br />with your<br /> roots</Text>

<Flex flexDir={'row'} justifyContent={'center'} alignItems={'center'} w={'100%'} mt={"10px"}>
<Spacer />

{/* First images column */}
<Flex flexDir={'column'}>
<VStack spacing={{ base: "10px", md: "15px", lg: "20px" }} alignItems={'center'} minW={imgColumnMinWidth}>
<Image src={hp1} height={imgResponsiveSizing} mr={imgOffset} />
<Image src={hp2} height={imgResponsiveSizing} ml={imgOffset} />
<Image src={hp3} height={imgResponsiveSizing} mr={imgOffset} />
</VStack>
</Flex>

<Spacer />

{/* Title, subtitle, and CTA button column */}
<Flex flexDir={'column'}>
<VStack spacing={{ base: "10px", md: "15px", lg: "20px" }} alignItems={'center'}>
<Text fontSize={'5xl'} fontWeight={'bold'} textAlign={'center'} mt={10} mb={5}>Connect <br />with your<br /> roots</Text>
<Text fontSize={'xl'} textAlign={'center'}>The intelligent artefact digitisation platform.</Text>
<Button variant={'ArchPrimary'} size={'lg'} mt={'10px'}>Get Started</Button>
</VStack>
</Flex>

<Spacer />

{/* Second images column */}
<Flex flexDir={'column'}>
<VStack spacing={{ base: "10px", md: "15px", lg: "20px" }} alignItems={'center'} minW={imgColumnMinWidth}>
<Image src={hp4} height={imgResponsiveSizing} ml={imgOffset} />
<Image src={hp5} height={imgResponsiveSizing} mr={imgOffset} />
<Image src={hp6} height={imgResponsiveSizing} ml={imgOffset} />
</VStack>
</Flex>

<Spacer />
</Flex>
</Flex>
}

Expand Down
Loading