Displaying files as well.
This commit is contained in:
		| @@ -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} | ||||||
|           <pre>{JSON.stringify($filesQuery.data, null, 2)}</pre> |         <div class="space-y-4"> | ||||||
|           {#each $filesQuery.data.system_db_files as file}{/each} |           {#each $filesQuery.data.system_db_files as file} | ||||||
|  |             <div class="flex"> | ||||||
|  |               <div class="w-1/4"> | ||||||
|  |                 {#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} |       {/if} | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|   </div> |  | ||||||
| </HeaderMain> | </HeaderMain> | ||||||
|   | |||||||
| @@ -12,9 +12,8 @@ | |||||||
|     <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} | ||||||
| @@ -24,5 +23,4 @@ | |||||||
|       {/if} |       {/if} | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
|   </div> |  | ||||||
| </HeaderMain> | </HeaderMain> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user