Show code change
This commit is contained in:
parent
2374023667
commit
a77074b29e
|
@ -5,6 +5,7 @@
|
|||
import { getGraphs, getPermissions } from "../lib/api";
|
||||
|
||||
let add = false;
|
||||
let showCode = false;
|
||||
let graphsPromise: ReturnType<typeof getGraphs> = new Promise(() => {});
|
||||
$: if ($login !== undefined) {
|
||||
graphsPromise = getGraphs($login?.token);
|
||||
|
@ -12,6 +13,9 @@
|
|||
if (checkPermissions([Permissions.ADD_GRAPH], permissions)) {
|
||||
add = true;
|
||||
}
|
||||
if (checkPermissions([Permissions.MANUAL_GRAPH], permissions)) {
|
||||
showCode = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
@ -25,8 +29,10 @@
|
|||
{#each graphs as graph}
|
||||
<a class="item" href="{hrefPrefix}/graph/{graph.graph}">
|
||||
<h2>{graph.data.name} <span>#{graph.graph}</span></h2>
|
||||
<p>{graph.data.style}</p>
|
||||
<code>{graph.data.value}</code>
|
||||
<p><strong>Style: </strong>{graph.data.style}</p>
|
||||
{#if showCode}
|
||||
<code>{graph.data.value}</code>
|
||||
{/if}
|
||||
</a>
|
||||
{/each}
|
||||
<!-- svelte-ignore a11y-missing-content -->
|
||||
|
|
Loading…
Reference in New Issue