move rules to their own route

This commit is contained in:
Ilion Beyst 2022-08-22 19:52:44 +02:00
parent a5399728c1
commit 947ced152e
3 changed files with 18 additions and 20 deletions

View file

@ -16,6 +16,9 @@
<div class="navbar-item"> <div class="navbar-item">
<a href="/leaderboard">Leaderboard</a> <a href="/leaderboard">Leaderboard</a>
</div> </div>
<div class="navbar-item">
<a href="/docs">How to play</a>
</div>
</div> </div>
<div class="navbar-right"> <div class="navbar-right">
<UserControls /> <UserControls />

View file

@ -0,0 +1,14 @@
<script>
import RulesView from "$lib/components/RulesView.svelte";
</script>
<div class="container">
<RulesView />
</div>
<style scoped lang="scss">
.container {
max-width: 800px;
margin: 0 auto;
}
</style>

View file

@ -18,7 +18,6 @@
enum ViewMode { enum ViewMode {
Editor, Editor,
MatchVisualizer, MatchVisualizer,
Rules,
} }
let matches = []; let matches = [];
@ -30,9 +29,6 @@
let editSession: Ace.EditSession; let editSession: Ace.EditSession;
onMount(() => { onMount(() => {
if (!hasBotCode()) {
viewMode = ViewMode.Rules;
}
init_editor(); init_editor();
}); });
@ -118,12 +114,6 @@
viewMode = viewMode_; viewMode = viewMode_;
} }
function selectRules() {
selectedMatchId = undefined;
selectedMatchLog = undefined;
viewMode = ViewMode.Rules;
}
function formatMatchTimestamp(timestampString: string): string { function formatMatchTimestamp(timestampString: string): string {
let timestamp = DateTime.fromISO(timestampString, { zone: "utc" }).toLocal(); let timestamp = DateTime.fromISO(timestampString, { zone: "utc" }).toLocal();
if (timestamp.startOf("day").equals(DateTime.now().startOf("day"))) { if (timestamp.startOf("day").equals(DateTime.now().startOf("day"))) {
@ -143,14 +133,7 @@
class:selected={viewMode === ViewMode.Editor} class:selected={viewMode === ViewMode.Editor}
on:click={() => setViewMode(ViewMode.Editor)} on:click={() => setViewMode(ViewMode.Editor)}
> >
Editor Code
</div>
<div
class="rules-button sidebar-item"
class:selected={viewMode === ViewMode.Rules}
on:click={() => setViewMode(ViewMode.Rules)}
>
Rules
</div> </div>
<div class="sidebar-header">match history</div> <div class="sidebar-header">match history</div>
<ul class="match-list"> <ul class="match-list">
@ -174,8 +157,6 @@
<Visualizer matchData={selectedMatch} matchLog={selectedMatchLog} /> <Visualizer matchData={selectedMatch} matchLog={selectedMatchLog} />
{:else if viewMode === ViewMode.Editor} {:else if viewMode === ViewMode.Editor}
<EditorView {editSession} /> <EditorView {editSession} />
{:else if viewMode === ViewMode.Rules}
<RulesView />
{/if} {/if}
</div> </div>
<div class="sidebar-right"> <div class="sidebar-right">