Add wiki section
This commit is contained in:
parent
2ad7e77273
commit
3e50e84b0e
|
@ -0,0 +1,7 @@
|
|||
.markdown {
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.markdown a {
|
||||
color: #00a8cc;
|
||||
}
|
|
@ -42,6 +42,13 @@ const listOfElements: Array<NavElement> = [{
|
|||
url: "#",
|
||||
show: "always",
|
||||
position: "top"
|
||||
}, {
|
||||
id: "wiki",
|
||||
title: getName(lang, "general", "nav-wiki"),
|
||||
type: "simple",
|
||||
url: "/wiki",
|
||||
show: "always",
|
||||
position: "top"
|
||||
}, {
|
||||
id: "login",
|
||||
title: getName(lang, "general", "nav-login"),
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
import WikiPageEntry from "../types/WikiPageEntry";
|
||||
|
||||
const { entry } = Astro.props as { entry: WikiPageEntry };
|
||||
---
|
||||
<li>
|
||||
<a href={entry.url}>{entry.title}</a>
|
||||
{entry.children.length > 0 && (
|
||||
<ul>
|
||||
{entry.children.map((child: WikiPageEntry) => <Astro.self entry={child} />)}
|
||||
</ul>
|
||||
)}
|
||||
</li>
|
||||
<style>
|
||||
a {
|
||||
color: lime;
|
||||
}
|
||||
|
||||
li {
|
||||
list-style-type: none;
|
||||
}
|
||||
</style>
|
|
@ -27,6 +27,7 @@ if(!Astro.cookies.has('language')) {
|
|||
<meta name="description" content="Astro description" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="stylesheet" href="/css/markdown.css" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title}</title>
|
||||
</head>
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
---
|
||||
import Layout from '../layouts/Layout.astro';
|
||||
import NavBar from '../components/NavBar.astro';
|
||||
import WikiEntry from '../components/WikiEntry.astro';
|
||||
import WikiPageEntry from '../types/WikiPageEntry';
|
||||
import { getUserByAccessToken } from '../lib/db/users';
|
||||
|
||||
let loggedIn = false;
|
||||
const loggedToken = Astro.cookies.get('sessionToken')?.value;
|
||||
const username = Astro.cookies.get('username')?.value;
|
||||
if(typeof loggedToken !== 'undefined' && typeof username !== 'undefined') {
|
||||
const checkUser = await getUserByAccessToken(loggedToken);
|
||||
if(checkUser !== null && checkUser.username === username) loggedIn = true;
|
||||
}
|
||||
|
||||
const wikiPages = await Astro.glob('../pages/wiki/**/*.md');
|
||||
|
||||
const pagesArray: Array<WikiPageEntry> = [{
|
||||
title: 'Home',
|
||||
url: '/wiki',
|
||||
depth: 0,
|
||||
parent: '',
|
||||
children: []
|
||||
}];
|
||||
|
||||
const tmp = [];
|
||||
|
||||
for(const page of wikiPages) {
|
||||
if(typeof page.url === 'undefined') continue;
|
||||
if(page.url === '/wiki') continue;
|
||||
const url = page.url?.split('/');
|
||||
const title = page.frontmatter.title;
|
||||
const parent = url.slice(0, url.length - 1).join('/');
|
||||
const data: WikiPageEntry = {
|
||||
title,
|
||||
url: page.url,
|
||||
depth: url.length - 2,
|
||||
parent,
|
||||
children: []
|
||||
}
|
||||
tmp.push(data);
|
||||
}
|
||||
|
||||
function findRecursively(tree: Array<WikiPageEntry>, value: string): WikiPageEntry | null {
|
||||
if(tree.length === 0) return null;
|
||||
for(const page of tree) {
|
||||
if(page.url === value) return page;
|
||||
const res = findRecursively(page.children, value)
|
||||
if(res !== null) return res;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
for(const page of tmp.sort((a, b) => a.depth - b.depth)) {
|
||||
if(page.depth === 1) {
|
||||
pagesArray.push(page);
|
||||
} else {
|
||||
const parent = findRecursively(pagesArray, page.parent);
|
||||
if(parent !== null) parent.children.push(page);
|
||||
}
|
||||
}
|
||||
|
||||
const { frontmatter } = Astro.props;
|
||||
---
|
||||
<Layout title="Wiki">
|
||||
<NavBar loggedIn=`${loggedIn}` active="wiki" />
|
||||
<div class="container">
|
||||
<div class="sidebar">
|
||||
<ul>
|
||||
{pagesArray.map(page => <WikiEntry entry={page} />)}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1>{frontmatter.title}</h1>
|
||||
<div class="markdown">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
<style>
|
||||
* {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 30rem;
|
||||
height: 100%;
|
||||
border-right: 3px solid rgb(77, 76, 78);
|
||||
}
|
||||
|
||||
.content {
|
||||
width: calc(100% - 30rem);
|
||||
margin-left: 8em;
|
||||
margin-right: 22em;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Fusion reactor
|
||||
---
|
||||
Fusion reactor is a type of reactor which uses nuclear fusion to generate heat, which is used for generating electricity. Their goal is to mimic the process ongoing inside the Sun, which theoretically could provide mankind with clean and sustainable energy source, without any radioactive waste.
|
||||
|
||||
## Real-life examples
|
||||
ITER (International Thermonuclear Experimental Reactor) located in France has ongoing research.
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Buildings
|
||||
---
|
||||
There are many types of buildings present in-game, many of which are possible to be built in real life.
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Fleet
|
||||
---
|
||||
Players can send their fleet to any planet for various tasks.
|
||||
|
||||
## Mission types
|
||||
- Attack - fight is initiated on destination. If there's at least one ship remaining after the fight, it will return to its origin
|
||||
- Transport - transports resources to selected planet/system. After dropping resources the fleet returns to its origin
|
||||
- Transfer - all ships will stay in destination planet and get added to this planet's available fleet
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: How to play
|
||||
---
|
||||
Welcome to AstroColony! To start, create an account [here](/register).
|
||||
|
||||
You'll be assigned a single planet, from which you'll have to expand your astronomical empire.
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: System management
|
||||
---
|
||||
System manager allows for player to quickly view summary of each planet inside. Player can also switch currently active planet (shown by its name in resource bar). It's also possible to view system-wide [megastructures](/wiki/megastructures), space stations and asteroid manager.
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Universe structure
|
||||
---
|
||||
In-game universe consists of 4 galaxies, each has 8 predefined sectors:
|
||||
|
||||
| Luminara | Thalor Prime | Zephyra | Nyxara |
|
||||
| ---------------- | ------------------ | ---------------- | ----------------- |
|
||||
| Voidcaller Reach | Dreamweaver Reach | Spectral Veil | Embered Fields |
|
||||
| Starfire Expanse | Azure Chasm | Galecrest Sector | Obsidian Rift |
|
||||
| Veil of Echoes | Ironclad Citadel | Sapphire Dunes | Lunar Shroud |
|
||||
| Crystal Nebula | Frostwing Quadrant | Aurora's Embrace | Phantom Outlands |
|
||||
| Whispering Abyss | Emberveil Rim | Nebulon Haven | Starlit Labyrinth |
|
||||
| Radiant Outpost | Shadow Nexus | Celestia's Gate | Thorned Garden |
|
||||
| Celestial Forge | Verdant Oasis | Mystic Falls | Infernal Depths |
|
||||
| Twilight Bastion | Cosmic Tides | Ethereal Spire | Echoing Plains |
|
||||
|
||||
Each player has their own solar system inside randomly-assigned sector in one of four galaxies.
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
layout: ../../layouts/Wiki.astro
|
||||
title: Main page
|
||||
---
|
||||
Welcome to AstroColony's built-in wiki! Here, you'll find various tips and tutorials for playing the game, but also a bit of trivia and interesting facts about various technologies described in the game.
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Dyson sphere
|
||||
---
|
||||
Dyson Sphere (named after Freeman Dyson who proposed the idea in 1960) is a megastructure that harvests energy from star by having lots of solar energy-harvesting satellites orbiting it.
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
layout: ../../../layouts/Wiki.astro
|
||||
title: Megastructures
|
||||
---
|
||||
Megastructure is a theoretical construct on a massive scale, designed to achieve specific functions, such as energy collection ([Dyson sphere](/wiki/megastructures/dyson-sphere)), habitat creation ([O'Neill cylinder](/wiki/megastructures/oneill-cylinder)) or planetary engineering. Construction of such megastructures requires astronomical number of resources, time, work and highly advanced technologies.
|
||||
|
||||
## Real-life examples
|
||||
There aren't any megastructures built by mankind yet. However, there's ongoing research into various materials and technologies that could allow creation of such megastructures.
|
|
@ -0,0 +1,7 @@
|
|||
export default interface Page {
|
||||
title: string;
|
||||
url: string;
|
||||
depth: number;
|
||||
parent: string;
|
||||
children: Page[];
|
||||
}
|
Loading…
Reference in New Issue