forked from goonstation/goonstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MeggalBozale/wizardhelp
i think this works?
- Loading branch information
Showing
4 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,62 @@ | ||
/** | ||
* @file | ||
* @copyright 2024 | ||
* @author IPingu (https://github.com/IPling) | ||
* @license ISC | ||
*/ | ||
|
||
import { useBackend } from '../backend'; | ||
import { Section, Stack } from '../components'; | ||
import { Window } from '../layouts'; | ||
|
||
|
||
|
||
const Spell = (props, context) => { | ||
const { data } = useBackend(context); | ||
const { Spell_Data } = data; | ||
const { spell } = props; | ||
|
||
return ( | ||
<Stack vertical> | ||
<Stack.Item> | ||
{spell} | ||
</Stack.Item> | ||
</Stack> | ||
); | ||
}; | ||
|
||
const SpellCategory = (props, context) => { | ||
const { data } = useBackend(context); | ||
const { Spell_Data } = data; | ||
const { category } = props; | ||
|
||
let spells = []; | ||
for (let spell_name in Spell_Data[category]) { | ||
spells.push(spell_name); | ||
} | ||
return ( | ||
<Section title={category}> | ||
{spells.map((s) => (<Spell spell={s} key={s} />))} | ||
</Section> | ||
); | ||
}; | ||
|
||
export const Wizard_Spellbook = (props, context) => { | ||
const { data } = useBackend(context); | ||
const { | ||
Spell_Data, | ||
} = data; | ||
|
||
let spell_categories = []; | ||
for (let spell_category in Spell_Data) { | ||
spell_categories.push(spell_category); | ||
} | ||
|
||
return ( | ||
<Window> | ||
<Window.Content> | ||
{spell_categories.map((c) => (<SpellCategory category={c} key={c} />))} | ||
</Window.Content> | ||
</Window> | ||
); | ||
}; |