generated from stratosphereips/awesome-code-template
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dashboard client: campaign sidebar, detail, steps, solving
- Loading branch information
Showing
11 changed files
with
194 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
import { marked } from 'marked'; | ||
export let campaign; | ||
</script> | ||
|
||
<div> | ||
<h2>{campaign.name}</h2> | ||
<!-- eslint-disable-next-line svelte/no-at-html-tags --> | ||
{@html marked.parse(campaign.description)} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<script> | ||
import ChallengeDetail from '../ChallengeDetail.svelte'; | ||
export let step; | ||
</script> | ||
|
||
<div> | ||
{#if step.type === 'page'} | ||
{@html step.content} | ||
{:else} | ||
<ChallengeDetail challenge={step} /> | ||
{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script> | ||
import { onMount } from 'svelte'; | ||
import { campaigns, loadSingleCampaign } from '../stores'; | ||
import { chooseCampaignStep, chosenCampaignStep } from '../routing'; | ||
import { derived } from 'svelte/store'; | ||
export let id; | ||
let root; | ||
let campaign = derived([campaigns], ([campaigns]) => campaigns.find((camp) => camp.id === id)); | ||
const load = () => loadSingleCampaign(id).then(); | ||
onMount(() => { | ||
const parentCollapse = root.parentElement.parentElement; | ||
// lazy-load on expand | ||
parentCollapse.addEventListener('shown.bs.collapse', load); | ||
// if already expanded (e.g. from localstorage) | ||
if (parentCollapse.classList.contains('show')) { | ||
load(); | ||
} | ||
return () => parentCollapse.removeEventListener('shown.bs.collapse', load); | ||
}); | ||
</script> | ||
|
||
<div bind:this={root}> | ||
{#if $campaign && $campaign.steps} | ||
{#each $campaign.steps as step} | ||
<li class="mb-1"> | ||
<button | ||
on:click={() => chooseCampaignStep($campaign.id, step.id)} | ||
type="button" | ||
class="list-group-item list-group-item-action d-flex justify-content-between {$chosenCampaignStep?.campaignId === | ||
$campaign.id && $chosenCampaignStep?.id === step.id | ||
? 'fw-bold' | ||
: ''}" | ||
> | ||
{step.name} | ||
</button> | ||
</li> | ||
{/each} | ||
{:else}Loading...{/if} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters