Skip to content

Commit

Permalink
On-site archival notice
Browse files Browse the repository at this point in the history
  • Loading branch information
encode42 committed Dec 18, 2023
1 parent dc42b1e commit f4caf54
Show file tree
Hide file tree
Showing 5 changed files with 12,133 additions and 137 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/.next/
.blitz.config.compiled.js

/node_modules
298 changes: 163 additions & 135 deletions app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { Center, Group, Paper, Text, TextInput, Switch, Code, ActionIcon, useMantineColorScheme, Select } from "@mantine/core";
import { Anchor, Button, Center, Group, Paper, Text, TextInput, Title, Switch, Code, ActionIcon, useMantineColorScheme, Select } from "@mantine/core";
import { InputCaption, Label, MarkedSlider, saveText, SelectDescription, SideBySide } from "@encode42/mantine-extras";
import { IconAlertCircle, IconArchive, IconDownload, IconTool } from "@tabler/icons";
import { IconAlertCircle, IconArchive, IconDownload, IconTool, IconArrowRight } from "@tabler/icons";
import { Prism } from "@mantine/prism";
import { Layout } from "../core/layout/Layout";
import { PageTitle } from "../core/components/PageTitle";
Expand Down Expand Up @@ -131,150 +131,178 @@ function Home({ environmentTabs, flagSelectors }: HomeProps) {
<Center sx={{
"height": "100%"
}}>
<Paper padding="md" shadow="sm" withBorder sx={theme => ({
"width": "100%",
"backgroundColor": isDark ? theme.colors.dark[6] : theme.colors.gray[0]
})}>
<Group direction="column" grow>
<PageTitle />
<Group grow sx={{
"alignItems": "flex-start"
}}>
{/* Left options */}
<Group direction="column" grow>
{/* Filename selector */}
<InputCaption text="The file used to launch the server. Located in the same directory as your configuration files.">
<Label label="Filename">
<TextInput defaultValue={defaultFilename} error={invalidFilename} icon={<IconArchive />} onChange={event => {
const value = event.target.value;

// Ensure the input is valid
if (!value.includes(".jar")) {
setInvalidFilename("Filename must end with .jar");
} else {
setInvalidFilename(false);
setFileName(event.target.value);
}
<Group direction="column" grow>
<Paper padding="md" shadow="sm" withBorder sx={theme => ({
"width": "100%",
"backgroundColor": isDark ? theme.colors.dark[6] : theme.colors.gray[0]
})}>
<Group direction="column" grow>
<Title>🔒 Archival Notice</Title>
<Text>
This domain has been archived. However, <Text weight="bold" inherit component="span">the project is not dead</Text>! Instead, it lives on through <Anchor href="https://www.simplymc.art/flags"><Text weight="bold" inherit component="span">SimplyMC</Text></Anchor>, where a team is able to maintain it, alongside many other useful Minecraft tools.
</Text>
<Text sx={theme => ({
"borderLeft": `2px solid ${theme.colors.yellow[6]}`,
"paddingLeft": theme.spacing.md
})}>
This means that the current domain, <Code>flags.sh</Code>, will eventually cease to function. It will redirect to <Code>simplymc.art/flags</Code> until expiry. It's strongly recommended to switch any <Code>flags.sh</Code> links over to <Code>simplymc.art/flags</Code> as soon as possible!
</Text>
<a href="https://simplymc.art/flags">
<Button variant="gradient" gradient={{
"from": "green",
"to": "lime",
"deg": 45
}} rightIcon={<IconArrowRight />}>
Bring me there!
</Button>
</a>
</Group>
</Paper>
<Paper padding="md" shadow="sm" withBorder sx={theme => ({
"width": "100%",
"backgroundColor": isDark ? theme.colors.dark[6] : theme.colors.gray[0]
})}>
<Group direction="column" grow>
<PageTitle />
<Group grow sx={{
"alignItems": "flex-start"
}}>
{/* Left options */}
<Group direction="column" grow>
{/* Filename selector */}
<InputCaption text="The file used to launch the server. Located in the same directory as your configuration files.">
<Label label="Filename">
<TextInput defaultValue={defaultFilename} error={invalidFilename} icon={<IconArchive />} onChange={event => {
const value = event.target.value;

// Ensure the input is valid
if (!value.includes(".jar")) {
setInvalidFilename("Filename must end with .jar");
} else {
setInvalidFilename(false);
setFileName(event.target.value);
}
}}/>
</Label>
</InputCaption>

{/* Memory selector */}
<Label label="Memory" icon={
<ActionIcon size="xs" variant="transparent" onClick={() => {
setOpenMemoryModal(true);
}}>
<IconTool />
</ActionIcon>
}>
<MarkedSlider interval={4} step={0.5} min={0.5} max={24} value={memory} thumbLabel="Memory allocation slider" label={value => {
return `${value.toFixed(1)} GB`;
}} intervalLabel={value => {
return `${value} GB`;
}} onChange={value => {
setMemory(value);
}}/>
</Label>
</InputCaption>
</Group>

{/* Memory selector */}
<Label label="Memory" icon={
<ActionIcon size="xs" variant="transparent" onClick={() => {
setOpenMemoryModal(true);
}}>
<IconTool />
</ActionIcon>
}>
<MarkedSlider interval={4} step={0.5} min={0.5} max={24} value={memory} thumbLabel="Memory allocation slider" label={value => {
return `${value.toFixed(1)} GB`;
}} intervalLabel={value => {
return `${value} GB`;
}} onChange={value => {
setMemory(value);
}}/>
</Label>
</Group>
{/* Right options */}
<Group direction="column" grow>
{/* Flags selector */}
<Label label="Flags" icon={
<ActionIcon size="xs" variant="transparent" onClick={() => {
setOpenFlagModal(true);
}}>
<IconTool />
</ActionIcon>
}>
<Select value={selectedFlags.key} itemComponent={SelectDescription} styles={theme => ({
"dropdown": {
"background": isDark ? theme.colors.dark[8] : theme.colors.gray[0]
}
})} onChange={value => {
if (!value) {
return;
}

{/* Right options */}
<Group direction="column" grow>
{/* Flags selector */}
<Label label="Flags" icon={
<ActionIcon size="xs" variant="transparent" onClick={() => {
setOpenFlagModal(true);
}}>
<IconTool />
</ActionIcon>
}>
<Select value={selectedFlags.key} itemComponent={SelectDescription} styles={theme => ({
"dropdown": {
"background": isDark ? theme.colors.dark[8] : theme.colors.gray[0]
}
})} onChange={value => {
if (!value) {
return;
}
setSelectedFlags(Flags.types[value] ?? selectedFlags);
}} data={flagSelectors} />
</Label>

setSelectedFlags(Flags.types[value] ?? selectedFlags);
}} data={flagSelectors} />
</Label>

{/* Misc toggles */}
<InputCaption text="Enables the server's GUI control panel. Automatically disabled in environments without a desktop.">
<Switch label="GUI" checked={!disabled.gui && toggles.gui} disabled={disabled.gui} onChange={event => {
setToggles({ ...toggles, "gui": event.target.checked });
}} />
</InputCaption>
<InputCaption text={`Automatically restarts the server after it crashes or is stopped. Press CTRL + C to exit the script.`}>
<Switch label="Auto-restart" checked={!disabled.autoRestart && toggles.autoRestart} disabled={disabled.autoRestart} onChange={event => {
setToggles({ ...toggles, "autoRestart": event.target.checked });
}} />
</InputCaption>
{/* Misc toggles */}
<InputCaption text="Enables the server's GUI control panel. Automatically disabled in environments without a desktop.">
<Switch label="GUI" checked={!disabled.gui && toggles.gui} disabled={disabled.gui} onChange={event => {
setToggles({ ...toggles, "gui": event.target.checked });
}} />
</InputCaption>
<InputCaption text={`Automatically restarts the server after it crashes or is stopped. Press CTRL + C to exit the script.`}>
<Switch label="Auto-restart" checked={!disabled.autoRestart && toggles.autoRestart} disabled={disabled.autoRestart} onChange={event => {
setToggles({ ...toggles, "autoRestart": event.target.checked });
}} />
</InputCaption>
</Group>
</Group>
</Group>

{/* Resulting flags */}
<Label label={<Text size="xl" weight={700}>Result</Text>}>
<Prism.Tabs styles={theme => ({
"copy": {
"backgroundColor": isDark ? theme.colors.dark[6] : theme.colors.gray[0],
"borderRadius": theme.radius.xs
},
"line": {
"whiteSpace": "pre-wrap"
}
})} onTabChange={active => {
// Get the selected type from the tab
const key = Object.keys(Environments.types)[active]; // TODO: This is unreliable, but tabKey does not work
if (!key) {
return;
}

// Toggle the non-applicable components
const env = Environments.types[key];
if (!env) {
return;
}

setEnvironment(env);
}}>
{environmentTabs.map(env => (
<Prism.Tab key={env.key} label={env.label} icon={getIcon(env.icon)} withLineNumbers language="bash">
{result}
</Prism.Tab>
))}
</Prism.Tabs>
</Label>

{/* Footer links */}
<SideBySide leftSide={
<Group noWrap>
{/* Download button */}
<ActionIcon color="green" variant="filled" size="lg" title="Download current script" disabled={disabled.download} onClick={() => {
if (environment.file) {
saveText(result, environment.file);
{/* Resulting flags */}
<Label label={<Text size="xl" weight={700}>Result</Text>}>
<Prism.Tabs styles={theme => ({
"copy": {
"backgroundColor": isDark ? theme.colors.dark[6] : theme.colors.gray[0],
"borderRadius": theme.radius.xs
},
"line": {
"whiteSpace": "pre-wrap"
}
})} onTabChange={active => {
// Get the selected type from the tab
const key = Object.keys(Environments.types)[active]; // TODO: This is unreliable, but tabKey does not work
if (!key) {
return;
}

// Toggle the non-applicable components
const env = Environments.types[key];
if (!env) {
return;
}
}}>
<IconDownload />
</ActionIcon>

{/* Low memory alert */}
<Group spacing="xs" noWrap sx={{
"display": memory < 4 ? "" : "none"
setEnvironment(env);
}}>
<IconAlertCircle />
<Text sx={{
"whiteSpace": "pre-wrap"
}}>It is recommended to allocate at least <Code>4 GB</Code> of memory.</Text>
{environmentTabs.map(env => (
<Prism.Tab key={env.key} label={env.label} icon={getIcon(env.icon)} withLineNumbers language="bash">
{result}
</Prism.Tab>
))}
</Prism.Tabs>
</Label>

{/* Footer links */}
<SideBySide leftSide={
<Group noWrap>
{/* Download button */}
<ActionIcon color="green" variant="filled" size="lg" title="Download current script" disabled={disabled.download} onClick={() => {
if (environment.file) {
saveText(result, environment.file);
}
}}>
<IconDownload />
</ActionIcon>

{/* Low memory alert */}
<Group spacing="xs" noWrap sx={{
"display": memory < 4 ? "" : "none"
}}>
<IconAlertCircle />
<Text sx={{
"whiteSpace": "pre-wrap"
}}>It is recommended to allocate at least <Code>4 GB</Code> of memory.</Text>
</Group>
</Group>
</Group>
} rightSide={
/* Misc links */
<FooterRow />
} />
</Group>
</Paper>
} rightSide={
/* Misc links */
<FooterRow />
} />
</Group>
</Paper>
</Group>
</Center>

{/* Modals */}
Expand Down
Loading

0 comments on commit f4caf54

Please sign in to comment.