swornforged/lib/swornforged_web/controllers/srd_html/oracles.html.heex

63 lines
2.6 KiB
Plaintext

<.srd_type_container>
<.srd_type_title>Oracles</.srd_type_title>
<div :for={oracle_category <- @oracles} id={oracle_category["$id"]}>
<.srd_subtype_title>
<%= get_in(oracle_category, ["Display", "Title"]) %>
</.srd_subtype_title>
<ul class="flex flex-col gap-6">
<li :for={oracle <- oracle_category["Oracles"]} id={oracle["$id"]}>
<.srd_item item={oracle}>
<:title><%= get_in(oracle, ["Display", "Title"]) %></:title>
<div :if={oracle["Table"]} class="text-justify max-w-none prose dark:prose-invert prose-p:m-0">
<div :if={str = oracle["Description"]} class="text-justify">
<%= raw(Markdown.get_cache_html!(str, oracle["$id"], compact_output: true)) %>
</div>
<table>
<thead>
<tr>
<th>Roll</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr :for={row <- get_in(oracle, ["Table"], [])} id={row["$id"]}>
<td style="text-align: left;"><%= row["Floor"] %>-<%= row["Ceiling"] %></td>
<td style="text-align: left;">
<%= raw(Markdown.get_cache_html!(row["Result"], row["$id"], compact_output: true)) %>
</td>
</tr>
</tbody>
</table>
</div>
<div :if={oracle["Oracles"]}>
<div
:for={inner_oracle <- oracle["Oracles"]} class="p-2 md:p-4"
>
<.srd_item item={inner_oracle}>
<:title><%= get_in(inner_oracle, ["Display", "Title"]) %></:title>
<div class="prose text-justify max-w-none dark:prose-invert prose-p:m-0">
<table>
<thead>
<tr>
<th>Roll</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr :for={row <- get_in(inner_oracle, ["Table"], [])} id={row["$id"]}>
<td style="text-align: left;"><%= row["Floor"] %>-<%= row["Ceiling"] %></td>
<td style="text-align: left;">
<%= raw(Markdown.get_cache_html!(row["Result"], row["$id"] || row["Result"], compact_output: true)) %>
</td>
</tr>
</tbody>
</table>
</div>
</.srd_item>
</div>
</div>
</.srd_item>
</li>
</ul>
</div>
</.srd_type_container>