Displaying files as well.
This commit is contained in:
parent
91b351ef2e
commit
5041a3c5a3
@ -1,8 +1,10 @@
|
|||||||
<div class="py-6 px-12">
|
<div class="py-6 px-12 w-full h-full">
|
||||||
<header>
|
<header>
|
||||||
<h3 class="text-xl font-bold mb-4 uppercase"><slot name="header" /></h3>
|
<h3 class="text-xl font-bold mb-4 uppercase">
|
||||||
|
<slot name="header" />
|
||||||
|
</h3>
|
||||||
</header>
|
</header>
|
||||||
<main>
|
<main class="w-full h-full overflow-hidden">
|
||||||
<slot name="main" />
|
<slot name="main" />
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import HeaderMain from "$lib/layouts/HeaderMain.svelte";
|
|
||||||
import { createQuery } from "../../../lib/wundergraph";
|
import { createQuery } from "../../../lib/wundergraph";
|
||||||
|
import HeaderMain from "$lib/layouts/HeaderMain.svelte";
|
||||||
const filesQuery = createQuery({
|
const filesQuery = createQuery({
|
||||||
operationName: "Files",
|
operationName: "Files",
|
||||||
});
|
});
|
||||||
@ -12,18 +11,47 @@
|
|||||||
<h1>Files</h1>
|
<h1>Files</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div slot="main">
|
<div slot="main" class="h-full w-full overflow-scroll">
|
||||||
<div class="w-full h-full overflow-y-auto">
|
<div class="w-full h-full overflow-scroll">
|
||||||
<div class="w-full h-full results">
|
{#if $filesQuery.isLoading}
|
||||||
{#if $filesQuery.isLoading}
|
<p>Loading...</p>
|
||||||
<p>Loading...</p>
|
{:else if $filesQuery.error}
|
||||||
{:else if $filesQuery.error}
|
<pre>Error: {JSON.stringify($filesQuery.error, null, 2)}</pre>
|
||||||
<pre>Error: {JSON.stringify($filesQuery.error, null, 2)}</pre>
|
{:else}
|
||||||
{:else}
|
<div class="space-y-4">
|
||||||
<pre>{JSON.stringify($filesQuery.data, null, 2)}</pre>
|
{#each $filesQuery.data.system_db_files as file}
|
||||||
{#each $filesQuery.data.system_db_files as file}{/each}
|
<div class="flex">
|
||||||
{/if}
|
<div class="w-1/4">
|
||||||
</div>
|
{#if file.type === "application/pdf"}
|
||||||
|
<object
|
||||||
|
data={`https://directus.andert.me/assets/${
|
||||||
|
file.id
|
||||||
|
}?access_token=${
|
||||||
|
import.meta.env.VITE_DIRECTUS_TEMPORARY_ACCESS_TOKEN
|
||||||
|
}`}
|
||||||
|
type="application/pdf"
|
||||||
|
width="100%"
|
||||||
|
height="200px"
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<img
|
||||||
|
src={`https://directus.andert.me/assets/${
|
||||||
|
file.id
|
||||||
|
}?access_token=${
|
||||||
|
import.meta.env.VITE_DIRECTUS_TEMPORARY_ACCESS_TOKEN
|
||||||
|
}`}
|
||||||
|
width="200"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div class="w-3/4 p-4">
|
||||||
|
<h2>{file.title}</h2>
|
||||||
|
<p>{file.id}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</HeaderMain>
|
</HeaderMain>
|
||||||
|
@ -12,17 +12,15 @@
|
|||||||
<h1>Projects</h1>
|
<h1>Projects</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div slot="main">
|
<div slot="main" class="h-full w-full overflow-scroll">
|
||||||
<div class="w-full h-full overflow-y-auto">
|
<div class="w-full h-full overflow-scroll">
|
||||||
<div class="w-full h-full results">
|
{#if $projectsQuery.isLoading}
|
||||||
{#if $projectsQuery.isLoading}
|
<p>Loading...</p>
|
||||||
<p>Loading...</p>
|
{:else if $projectsQuery.error}
|
||||||
{:else if $projectsQuery.error}
|
<pre>Error: {JSON.stringify($projectsQuery.error, null, 2)}</pre>
|
||||||
<pre>Error: {JSON.stringify($projectsQuery.error, null, 2)}</pre>
|
{:else}
|
||||||
{:else}
|
<pre>{JSON.stringify($projectsQuery.data, null, 2)}</pre>
|
||||||
<pre>{JSON.stringify($projectsQuery.data, null, 2)}</pre>
|
{/if}
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</HeaderMain>
|
</HeaderMain>
|
||||||
|
Loading…
Reference in New Issue
Block a user