Update About page and persist theme

This commit is contained in:
Corey 2024-04-18 15:28:13 +00:00
parent c2a76562b1
commit feb2dc528c
6 changed files with 98 additions and 20 deletions

View File

@ -1,15 +1,15 @@
import { Box, Container } from '@mui/material'; import { Box, Container } from '@mui/material';
import { useState } from 'react'; import { useState } from 'react';
import { HashRouter, Route, Routes } from 'react-router-dom'; import { BrowserRouter, Route, Routes } from 'react-router-dom';
import AlertComponent from './components/Alert'; import AlertComponent from './components/Alert';
import Footer from './components/Footer'; import Footer from './components/Footer';
import Header from './components/Header'; import Header from './components/Header';
import ServerDetails from './components/ServerDetails';
import SearchState from './data/SearchState'; import SearchState from './data/SearchState';
import ServerData from './data/ServerData'; import ServerData from './data/ServerData';
import About from './pages/About'; import About from './pages/About';
import Home from './pages/Home'; import Home from './pages/Home';
import NotFound from './pages/NotFound'; import NotFound from './pages/NotFound';
import ServerDetails from './pages/ServerDetails';
export function App() { export function App() {
const [alertInfo, setAlertInfo] = useState<{ const [alertInfo, setAlertInfo] = useState<{
@ -75,8 +75,8 @@ export function App() {
export function WrappedApp() { export function WrappedApp() {
return ( return (
<HashRouter> <BrowserRouter>
<App /> <App />
</HashRouter> </BrowserRouter>
); );
} }

View File

@ -103,12 +103,12 @@ export default function ServerCard({ server }: { server: ServerData }) {
return ( return (
<Tooltip <Tooltip
key={key}
arrow arrow
disableInteractive disableInteractive
title={ServerSettingsInfo[key].description} title={ServerSettingsInfo[key].description}
> >
<Chip <Chip
key={key}
label={`${ServerSettingsInfo[key].name === '' ? key : ServerSettingsInfo[key].name}`} label={`${ServerSettingsInfo[key].name === '' ? key : ServerSettingsInfo[key].name}`}
avatar={ avatar={
typeof chipValue === 'object' ? undefined : ( typeof chipValue === 'object' ? undefined : (

View File

@ -19,15 +19,15 @@ import { DataGrid, GridColDef } from '@mui/x-data-grid';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom'; import { Link, useParams } from 'react-router-dom';
import { fetchData, fetchDemo } from '../apiUtil'; import { fetchData, fetchDemo } from '../apiUtil';
import { AlertResponse } from '../components/Alert';
import ErrorCard from '../components/ErrorCard';
import ExpansionBar from '../components/ExpansionsBar';
import ServerData, { import ServerData, {
ServerSetting, ServerSetting,
ServerSettings, ServerSettings,
ServerSettingsInfo, ServerSettingsInfo,
} from '../data/ServerData'; } from '../data/ServerData';
import CopyImageIcon from '../images/copy-image.png'; import CopyImageIcon from '../images/copy-image.png';
import { AlertResponse } from './Alert';
import ErrorCard from './ErrorCard';
import ExpansionBar from './ExpansionsBar';
interface KeyValueRow { interface KeyValueRow {
id: number; id: number;

View File

@ -1,7 +1,7 @@
import { useMediaQuery } from '@mui/material'; import { useMediaQuery } from '@mui/material';
import { createTheme, StyledEngineProvider } from '@mui/material/styles'; import { createTheme, StyledEngineProvider } from '@mui/material/styles';
import ThemeProvider from '@mui/material/styles/ThemeProvider'; import ThemeProvider from '@mui/material/styles/ThemeProvider';
import { createContext, ReactNode, useMemo, useState } from 'react'; import { createContext, ReactNode, useEffect, useMemo, useState } from 'react';
type ThemeContextType = { type ThemeContextType = {
switchColorMode: () => void; switchColorMode: () => void;
@ -18,12 +18,22 @@ export const ThemeContext = createContext<ThemeContextType>({
export function ThemeContextProvider({ children }: ThemeProviderProps) { export function ThemeContextProvider({ children }: ThemeProviderProps) {
const rootElement = document.getElementById('root'); const rootElement = document.getElementById('root');
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)'); const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
const [mode, setMode] = useState<'light' | 'dark'>( const [mode, setMode] = useState<'light' | 'dark'>(() => {
prefersDarkMode ? 'dark' : 'light' const manualTheme = localStorage.getItem('theme');
); if (manualTheme && (manualTheme === 'light' || manualTheme === 'dark')) {
return manualTheme;
}
return prefersDarkMode ? 'dark' : 'light';
});
useEffect(() => {
localStorage.setItem('theme', mode);
}, [mode]);
const switchColorMode = () => { const switchColorMode = () => {
setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light')); setMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light'));
}; };
const theme = useMemo( const theme = useMemo(
() => () =>
createTheme({ createTheme({

View File

@ -7,3 +7,7 @@
user-drag: none; user-drag: none;
user-select: none; user-select: none;
} }
code {
user-select: text;
}

View File

@ -31,13 +31,10 @@ export default function About() {
<Link to="https://github.com/LandSandBoat/server"> <Link to="https://github.com/LandSandBoat/server">
LandSandBoat LandSandBoat
</Link>{' '} </Link>{' '}
software (or serving their API). Servers are updated every hour, software (or serving their API). Servers are updated at a set
and are automatically removed after 24 hours of failed updates. interval and are removed after a variable amount of
All information is pulled directly from the servers and Ixion disconnectivity. All information is gathered directly from the
makes no guarantees as to how current or correct the information listed servers.
is and is in no way affiliated with any listed server. Always use
a different strong and unique password for every server (and just
in general).
</Typography> </Typography>
</Box> </Box>
<Box className="mb-3"> <Box className="mb-3">
@ -65,7 +62,8 @@ export default function About() {
align="justify" align="justify"
color={(theme) => alpha(theme.palette.text.primary, 0.87)} color={(theme) => alpha(theme.palette.text.primary, 0.87)}
> >
Additional servers can be found on the XiPrivateServers{' '} Additional servers and more detailed information can be found on
the XiPrivateServers{' '}
<Link to="https://github.com/XiPrivateServers/Servers/blob/main/SERVERS.md"> <Link to="https://github.com/XiPrivateServers/Servers/blob/main/SERVERS.md">
GitHub GitHub
</Link> </Link>
@ -82,6 +80,72 @@ export default function About() {
here! here!
</Typography> </Typography>
</Box> </Box>
<Box className="mb-3">
<Typography align="center" variant="h6">
Notes
</Typography>
<ul className="m-0 pl-4">
<Typography
component="li"
variant="body2"
align="justify"
color={(theme) => alpha(theme.palette.text.primary, 0.87)}
className="mb-2"
>
Due to the nature of private server customization, only basic
details can be gathered from the LSB API. Ixion doesn&apos;t
know about EXP table changes or any kind of scripting or core
changes, just basic settings. If a server doesn&apos;t have a
website linked, check the{' '}
<Link to="https://github.com/XiPrivateServers/Servers/blob/main/SERVERS.md">
XiPrivateServers GitHub
</Link>{' '}
and see if it&apos;s listed there. Server owners see below for
how to add a link to your website.
</Typography>
<Typography
component="li"
variant="body2"
align="justify"
color={(theme) => alpha(theme.palette.text.primary, 0.87)}
className="mb-2"
>
The information provided by Ixion is sourced from third-party
sources, and while we strive to ensure accuracy, we cannot
guarantee its completeness or reliability. Users are encouraged
to verify any information independently before making decisions
based on it.
</Typography>
<Typography
component="li"
variant="body2"
align="justify"
color={(theme) => alpha(theme.palette.text.primary, 0.87)}
className="mb-2"
>
Ixion may contain links to external websites operated by third
parties. These links are provided for convenience and
informational purposes only. We do not endorse or control the
content of these third-party sites, and we are not responsible
for their accuracy, legality, or content. Users access external
sites at their own risk.
</Typography>
<Typography
component="li"
variant="body2"
align="justify"
color={(theme) => alpha(theme.palette.text.primary, 0.87)}
className="mb-2"
>
All names, trademarks, and copyrights mentioned on this website
belong to their respective owners. Any use of these names,
trademarks, and copyrights is for identification purposes only
and does not imply endorsement, sponsorship, or affiliation with
our website. We acknowledge the ownership of these intellectual
properties and respect the rights of their owners.
</Typography>
</ul>
</Box>
</CardContent> </CardContent>
</Card> </Card>
<Card> <Card>