forked from CRSS/Website
feat: Formatting
This commit is contained in:
parent
70a173d02b
commit
39e87cffdc
5
.prettierrc
Normal file
5
.prettierrc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"tabWidth": 2,
|
||||||
|
"singleQuote": true,
|
||||||
|
"semi": true
|
||||||
|
}
|
6
.vscode/settings.json
vendored
Normal file
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"[typescriptreact]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ import {
|
||||||
LogOut,
|
LogOut,
|
||||||
LogIn,
|
LogIn,
|
||||||
Earth,
|
Earth,
|
||||||
X
|
X,
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
|
@ -29,22 +29,19 @@ import { useEffect, useRef, useState } from 'react';
|
||||||
import Dropdown from './Dropdown';
|
import Dropdown from './Dropdown';
|
||||||
import { useUser } from '@/context/UserContext';
|
import { useUser } from '@/context/UserContext';
|
||||||
|
|
||||||
import {
|
import { Permission, hasPermission } from '@/utils/permissions';
|
||||||
Permission,
|
|
||||||
hasPermission
|
|
||||||
} from '@/utils/permissions';
|
|
||||||
|
|
||||||
export default function NavBar({ currentPage }: { currentPage: string }) {
|
export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
const { user, isLoggedIn } = useUser();
|
const { user, isLoggedIn } = useUser();
|
||||||
|
|
||||||
const [ navOpen, setNavOpen ] = useState(false);
|
const [navOpen, setNavOpen] = useState(false);
|
||||||
|
|
||||||
const { publicRuntimeConfig } = getConfig();
|
const { publicRuntimeConfig } = getConfig();
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const server = {
|
const server = {
|
||||||
version: '1.15.2'
|
version: '1.15.2',
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildDiscordUrl = (): string => {
|
const buildDiscordUrl = (): string => {
|
||||||
|
@ -52,8 +49,14 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
|
|
||||||
url.searchParams.append('client_id', publicRuntimeConfig.discord.clientId);
|
url.searchParams.append('client_id', publicRuntimeConfig.discord.clientId);
|
||||||
url.searchParams.append('response_type', 'code');
|
url.searchParams.append('response_type', 'code');
|
||||||
url.searchParams.append('redirect_uri', publicRuntimeConfig.discord.redirectUri);
|
url.searchParams.append(
|
||||||
url.searchParams.append('scope', publicRuntimeConfig.discord.scopes.join(' '));
|
'redirect_uri',
|
||||||
|
publicRuntimeConfig.discord.redirectUri
|
||||||
|
);
|
||||||
|
url.searchParams.append(
|
||||||
|
'scope',
|
||||||
|
publicRuntimeConfig.discord.scopes.join(' ')
|
||||||
|
);
|
||||||
|
|
||||||
url.searchParams.append('state', router.asPath);
|
url.searchParams.append('state', router.asPath);
|
||||||
|
|
||||||
|
@ -72,15 +75,17 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="ip">
|
<label htmlFor="ip">Server Address:</label>
|
||||||
Server Address:
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<input type="text" value="play.crss.cc" id="ip" readOnly size={8} />
|
<input
|
||||||
|
type="text"
|
||||||
|
value="play.crss.cc"
|
||||||
|
id="ip"
|
||||||
|
readOnly
|
||||||
|
size={8}
|
||||||
|
/>
|
||||||
|
|
||||||
<label htmlFor="ip">
|
<label htmlFor="ip">Version: {server.version}</label>
|
||||||
Version: {server.version}
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -89,79 +94,99 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
<nav className={`${styles.navBar} ${navOpen ? styles.navOpen : ''}`}>
|
<nav className={`${styles.navBar} ${navOpen ? styles.navOpen : ''}`}>
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.navMobileContainer}>
|
<div className={styles.navMobileContainer}>
|
||||||
<button className={styles.navToggle} onClick={() => { setNavOpen(!navOpen); }}>
|
<button
|
||||||
{ !navOpen ? <Menu /> : <X /> }
|
className={styles.navToggle}
|
||||||
|
onClick={() => {
|
||||||
|
setNavOpen(!navOpen);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{!navOpen ? <Menu /> : <X />}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.navCollapse}>
|
<div className={styles.navCollapse}>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'home' ? '#' : '/'} className={currentPage == 'home' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'home' ? '#' : '/'}
|
||||||
|
className={currentPage == 'home' ? styles.active : ''}
|
||||||
|
>
|
||||||
<Home />
|
<Home />
|
||||||
|
|
||||||
Home
|
Home
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'rules' ? '#' : '/rules'} className={currentPage == 'rules' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'rules' ? '#' : '/rules'}
|
||||||
|
className={currentPage == 'rules' ? styles.active : ''}
|
||||||
|
>
|
||||||
<Scale />
|
<Scale />
|
||||||
|
|
||||||
Rules
|
Rules
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'about' ? '#' : '/about'} className={currentPage == 'about' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'about' ? '#' : '/about'}
|
||||||
|
className={currentPage == 'about' ? styles.active : ''}
|
||||||
|
>
|
||||||
<AtSign />
|
<AtSign />
|
||||||
|
|
||||||
About
|
About
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'gallery' ? '#' : '/gallery'} className={currentPage == 'gallery' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'gallery' ? '#' : '/gallery'}
|
||||||
|
className={currentPage == 'gallery' ? styles.active : ''}
|
||||||
|
>
|
||||||
<Images />
|
<Images />
|
||||||
|
|
||||||
Gallery
|
Gallery
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'map' ? '#' : '/map'} className={currentPage == 'map' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'map' ? '#' : '/map'}
|
||||||
|
className={currentPage == 'map' ? styles.active : ''}
|
||||||
|
>
|
||||||
<Map />
|
<Map />
|
||||||
|
|
||||||
Map
|
Map
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<Link href={currentPage == 'nations' ? '#' : '/nations'} className={currentPage == 'nations' ? styles.active : ''}>
|
<Link
|
||||||
|
href={currentPage == 'nations' ? '#' : '/nations'}
|
||||||
|
className={currentPage == 'nations' ? styles.active : ''}
|
||||||
|
>
|
||||||
<Earth />
|
<Earth />
|
||||||
|
|
||||||
Nations
|
Nations
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
{(isLoggedIn && user) && (
|
{isLoggedIn && user && (
|
||||||
<li>
|
<li>
|
||||||
{hasPermission(user.permissions, Permission.Admin) && (
|
{(hasPermission(user.permissions, Permission.Admin) && (
|
||||||
<Dropdown items={[
|
<Dropdown
|
||||||
|
items={[
|
||||||
{
|
{
|
||||||
icon: User,
|
icon: User,
|
||||||
label: 'Profile',
|
label: 'Profile',
|
||||||
href: `/u/${user ? user.names.username : 'Loading...'}`
|
href: `/u/${
|
||||||
|
user ? user.names.username : 'Loading...'
|
||||||
|
}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Settings,
|
icon: Settings,
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
href: '/settings'
|
href: '/settings',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
divider: true
|
divider: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: LayoutDashboard,
|
icon: LayoutDashboard,
|
||||||
label: 'Admin',
|
label: 'Admin',
|
||||||
href: '/admin'
|
href: '/admin',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: LogOut,
|
icon: LogOut,
|
||||||
|
@ -170,31 +195,36 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
await fetch('/api/v1/session', {
|
await fetch('/api/v1/session', {
|
||||||
method: 'DELETE'
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
|
|
||||||
router.reload();
|
router.reload();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]} className={styles.dropDown}>
|
]}
|
||||||
|
className={styles.dropDown}
|
||||||
|
>
|
||||||
<User />
|
<User />
|
||||||
|
|
||||||
{user ? user.names.global_name : 'Loading...'}
|
{user ? user.names.global_name : 'Loading...'}
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
) || (
|
)) || (
|
||||||
<Dropdown items={[
|
<Dropdown
|
||||||
|
items={[
|
||||||
{
|
{
|
||||||
icon: User,
|
icon: User,
|
||||||
label: 'Profile',
|
label: 'Profile',
|
||||||
href: `/u/${user ? user.names.username : 'Loading...'}`
|
href: `/u/${
|
||||||
|
user ? user.names.username : 'Loading...'
|
||||||
|
}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: Settings,
|
icon: Settings,
|
||||||
label: 'Settings',
|
label: 'Settings',
|
||||||
href: '/settings'
|
href: '/settings',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
divider: true
|
divider: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: LogOut,
|
icon: LogOut,
|
||||||
|
@ -203,13 +233,15 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
await fetch('/api/v1/session', {
|
await fetch('/api/v1/session', {
|
||||||
method: 'DELETE'
|
method: 'DELETE',
|
||||||
});
|
});
|
||||||
|
|
||||||
router.reload();
|
router.reload();
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]} className={styles.dropDown}>
|
]}
|
||||||
|
className={styles.dropDown}
|
||||||
|
>
|
||||||
<User />
|
<User />
|
||||||
|
|
||||||
{user ? user.names.global_name : 'Loading...'}
|
{user ? user.names.global_name : 'Loading...'}
|
||||||
|
@ -217,11 +249,10 @@ export default function NavBar({ currentPage }: { currentPage: string }) {
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
{(!isLoggedIn && !user) && (
|
{!isLoggedIn && !user && (
|
||||||
<li>
|
<li>
|
||||||
<Link href={buildDiscordUrl()}>
|
<Link href={buildDiscordUrl()}>
|
||||||
<LogIn />
|
<LogIn />
|
||||||
|
|
||||||
Login
|
Login
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -6,7 +6,7 @@ import NavBar from '@/components/NavBar';
|
||||||
import PageContent from '@/components/PageContent';
|
import PageContent from '@/components/PageContent';
|
||||||
|
|
||||||
export default function Rules() {
|
export default function Rules() {
|
||||||
const nations = [ ];
|
const nations = [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -18,50 +18,62 @@ export default function Rules() {
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
The use of modified clients that give an unfair advantage to players, such as hacked clients, is not permitted.
|
The use of modified clients that give an unfair advantage to
|
||||||
|
players, such as hacked clients, is not permitted.
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
You are not allowed to use them even for their legitimate features, such as a "fullbright" option.
|
You are not allowed to use them even for their legitimate
|
||||||
|
features, such as a "fullbright" option.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
If admins suspect you are hacking you will be immediately banned.
|
If admins suspect you are hacking you will be immediately
|
||||||
|
banned.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Do not modify or destroy (grief) other player's constructions without their consent, or steal any of their items.
|
Do not modify or destroy (grief) other player's constructions
|
||||||
|
without their consent, or steal any of their items.
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
You are allowed to visit any build, as long as you don't take anything, and if you do you pay them back.
|
You are allowed to visit any build, as long as you don't
|
||||||
|
take anything, and if you do you pay them back.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
You should ask permission in the discord or the in-game chat before modifying builds.
|
You should ask permission in the discord or the in-game chat
|
||||||
|
before modifying builds.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Follow the laws of the nations you are in to avoid issues with other players and making the server not fun to play.
|
Follow the laws of the nations you are in to avoid issues with other
|
||||||
|
players and making the server not fun to play.
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
If you feel the laws are too vague, feel free to ask the people in charge of them what they mean with something, and feel free to contribute to them. Complaining that they don't make sense won't get you anywhere.
|
If you feel the laws are too vague, feel free to ask the people
|
||||||
|
in charge of them what they mean with something, and feel free
|
||||||
|
to contribute to them. Complaining that they don't make
|
||||||
|
sense won't get you anywhere.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Breaking laws won't necessarily get you banned, the nation you are in will take measures and punish you for your actions as they see fit.
|
Breaking laws won't necessarily get you banned, the nation
|
||||||
|
you are in will take measures and punish you for your actions as
|
||||||
|
they see fit.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Do not attempt to make nations where the territory is already owned by another nation.
|
Do not attempt to make nations where the territory is already owned
|
||||||
|
by another nation.
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
You can make it near the borders of a nation but never inside one, you can't just take existing territory as your own.
|
You can make it near the borders of a nation but never inside
|
||||||
|
one, you can't just take existing territory as your own.
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
Other nations are free to claim more territory whenever they feel like it, as long as it doesn't take other nations' territory with it.
|
Other nations are free to claim more territory whenever they
|
||||||
|
feel like it, as long as it doesn't take other
|
||||||
|
nations' territory with it.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
5723
pnpm-lock.yaml
5723
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue