import { useState, useEffect } from 'react';
import AppBar from '@mui/material/AppBar/index.js';
import Button from '@mui/material/Button/index.js';
import Switch from '@mui/material/Switch/index.js';
import Card from '@mui/material/Card/index.js';
import CardActions from '@mui/material/CardActions/index.js';
import CardContent from '@mui/material/CardContent/index.js';
import CardMedia from '@mui/material/CardMedia/index.js';
import CssBaseline from '@mui/material/CssBaseline/index.js';
import Grid from '@mui/material/Grid/index.js';
import Stack from '@mui/material/Stack/index.js';
import Box from '@mui/material/Box/index.js';
import Toolbar from '@mui/material/Toolbar/index.js';
import Typography from '@mui/material/Typography/index.js';
import Container from '@mui/material/Container/index.js';
import Link from '@mui/material/Link/index.js';
import FormControlLabel from '@mui/material/FormControlLabel/index.js';
import ThemeProvider from '@mui/material/styles/ThemeProvider.js';
import createTheme from '@mui/material/styles/createTheme.js';
import styled from '@mui/material/styles/styled.js';
// import { Link as Link2 } from "react-router-dom";
const win: Window = window;
import {
THUMB_WIDTH_THRESHOLD,
THUMB_HEIGHT_THRESHOLD,
IMAGE_API_ENDPOINT,
} from "./config.ts";
function Copyright() {
return (
{'Copyright © ETU '}
{new Date().getFullYear()}
{'.'}
);
}
// TODO remove, this demo shouldn't need to reset the theme.
const darkTheme = createTheme({
palette: {
mode: 'dark',
},
});
const lightTheme = createTheme({
palette: {
mode: 'light',
},
});
const MaterialUISwitch = styled(Switch)(({ theme }) => ({
width: 62,
height: 34,
padding: 7,
'& .MuiSwitch-switchBase': {
margin: 1,
padding: 0,
transform: 'translateX(6px)',
'&.Mui-checked': {
color: '#fff',
transform: 'translateX(22px)',
'& .MuiSwitch-thumb:before': {
backgroundImage: `url('data:image/svg+xml;utf8,')`,
},
'& + .MuiSwitch-track': {
opacity: 1,
backgroundColor: theme.palette.mode === 'dark' ? '#8796A5' : '#aab4be',
},
},
},
'& .MuiSwitch-thumb': {
backgroundColor: theme.palette.mode === 'dark' ? '#003892' : '#001e3c',
width: 32,
height: 32,
'&:before': {
content: "''",
position: 'absolute',
width: '100%',
height: '100%',
left: 0,
top: 0,
backgroundRepeat: 'no-repeat',
backgroundPosition: 'center',
backgroundImage: `url('data:image/svg+xml;utf8,')`,
},
},
'& .MuiSwitch-track': {
opacity: 1,
backgroundColor: theme.palette.mode === 'dark' ? '#8796A5' : '#aab4be',
borderRadius: 20 / 2,
},
}));
export default function Page() {
const [dark, setDark] = useState(true);
const [etu, setEtu] = useState(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
fetch('etu.json')
.then(response => response.json())
.then(data => {
setEtu(data);
setLoading(false);
})
.catch(error => {
console.error('Error loading etu.json:', error);
setLoading(false);
});
}, []);
const handleThemeChange = () => {
setDark(!dark);
};
const logoStyles = {
margin: '10px'
};
if (loading || !etu) {
return (
Loading...
);
}
return (
ETU Gallary - IIIF v{etu.iiifVersion}
}
label=""
onChange={handleThemeChange}
/>
{/* Hero unit */}
{etu.name}
{etu.author ? 'author: ' + etu.author + " " : " "} {etu.license ? 'license: ' + etu.license + " " : " "}
{etu.iiifVersion === '3' ? (
) : (
)}
{/* End hero unit */}
{etu.images.map((present: any) => (
{present.label}
{etu.iiifVersion === '3' ? (
Universal 4
Mirador 3
{/* Mirador 3-ocr */}
{/* Clover */}
) : (
Universal 3
Mirador 2
{/* Clover */}
)}
))}
{/* Footer */}
);
}