Fixed spell descriptions
This commit is contained in:
@@ -61,14 +61,21 @@ export interface Source {
|
||||
}
|
||||
|
||||
export interface Description {
|
||||
entries: EntryType[];
|
||||
// entries: EntryType[];
|
||||
entries: Entry[];
|
||||
}
|
||||
|
||||
type EntryType = string | Entry;
|
||||
// type EntryType = string | Entry;
|
||||
|
||||
export interface Entry {
|
||||
type: string;
|
||||
items: string[];
|
||||
text?: string;
|
||||
list?: string[];
|
||||
table?: EntryTable;
|
||||
}
|
||||
|
||||
export interface EntryTable {
|
||||
headers: string[];
|
||||
rows: string[][];
|
||||
}
|
||||
|
||||
export interface GetSpellResponse {
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
getGuilds,
|
||||
getTextChannels,
|
||||
getVoiceChannels,
|
||||
getVolume,
|
||||
pauseTrack,
|
||||
playTrack,
|
||||
resumeTrack,
|
||||
@@ -22,6 +23,7 @@ export default function Page() {
|
||||
const [activeGuild, setActiveGuild] = useState<GuildInfo | null>(null);
|
||||
const [textChannels, setTextChannels] = useState<GuildChannel[]>([]);
|
||||
const [voiceChannels, setVoiceChannels] = useState<GuildChannel[]>([]);
|
||||
const [guildVolume, setGuildVolume] = useState<number>(50.0);
|
||||
|
||||
useEffect(() => {
|
||||
getGuilds().then((g) => {
|
||||
@@ -36,6 +38,7 @@ export default function Page() {
|
||||
if (activeGuild) {
|
||||
getTextChannels(activeGuild.id).then((c) => setTextChannels(c));
|
||||
getVoiceChannels(activeGuild.id).then((c) => setVoiceChannels(c));
|
||||
getVolume(activeGuild.id).then((v) => setGuildVolume(v));
|
||||
}
|
||||
}, [activeGuild]);
|
||||
|
||||
@@ -117,7 +120,7 @@ export default function Page() {
|
||||
onSubmit={playForm.onSubmit((values) => setVolume(activeGuild!.id, values.volume))}
|
||||
>
|
||||
<Slider
|
||||
defaultValue={50}
|
||||
defaultValue={guildVolume}
|
||||
{...playForm.getInputProps('volume')}
|
||||
marks={[
|
||||
{ value: 25, label: '25%' },
|
||||
|
||||
@@ -129,23 +129,53 @@ function SpellDescription({ spell }: { spell: Spell }) {
|
||||
<>
|
||||
{spell.description && (
|
||||
<>
|
||||
{spell.description.entries.map((e) =>
|
||||
typeof e === 'string' ? (
|
||||
<p>{parseText(e)}</p>
|
||||
) : (
|
||||
<>
|
||||
{e.type == 'list' ? (
|
||||
<ul>
|
||||
{e.items.map((text) => (
|
||||
<li>{parseText(text)}</li>
|
||||
{spell.description.entries.map((e) => (
|
||||
// typeof e === 'string' ? (
|
||||
// <p>{parseText(e)}</p>
|
||||
// ) : (
|
||||
// <>
|
||||
// {e.list ? (
|
||||
// <ul>
|
||||
// {e.list.map((text) => (
|
||||
// <li>{parseText(text)}</li>
|
||||
// ))}
|
||||
// </ul>
|
||||
// ) : (
|
||||
// <></>
|
||||
// )}
|
||||
// </>
|
||||
// )
|
||||
<>
|
||||
{e.text && <p>{parseText(e.text)}</p>}
|
||||
{e.list && (
|
||||
<ul>
|
||||
{e.list.map((text) => (
|
||||
<li>{parseText(text)}</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{e.table && (
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{e.table.headers.map((label) => (
|
||||
<th>{label}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{e.table.rows.map((row) => (
|
||||
<tr>
|
||||
{row.map((cell) => (
|
||||
<td>{parseText(cell)}</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
)}
|
||||
</>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -18,6 +18,5 @@ export function rollDice(dice: string): number[] {
|
||||
for (let i = 0; i < parseInt(count); i++) {
|
||||
rolls.push(Math.floor(Math.random() * parseInt(sides)) + 1);
|
||||
}
|
||||
console.log(rolls);
|
||||
return rolls;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user