mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 19:01:35 +01:00
Create nix derivations for building and running web app
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import { ALLOWED_MIME_TYPES } from "$lib/utils";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
import type { ActionData, PageServerData } from "./$types";
|
||||
import Modal from "$lib/components/Modal.svelte";
|
||||
|
||||
const { data, form } = $props<{ data: PageServerData; form: ActionData }>();
|
||||
</script>
|
||||
@@ -47,10 +48,20 @@
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Favicon:
|
||||
<input type="file" name="favicon" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
</label>
|
||||
<div class="file-field">
|
||||
<label>
|
||||
Favicon:
|
||||
<input type="file" name="favicon" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
</label>
|
||||
{#if data.globalSettings.media}
|
||||
<Modal id="preview-favicon-global-{data.globalSettings.website_id}" text="Preview">
|
||||
<img
|
||||
src={`http://localhost:5173/${data.globalSettings.media.file_system_path}`}
|
||||
alt={data.globalSettings.media.original_name}
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
@@ -86,15 +97,25 @@
|
||||
required={data.header.logo_type === "text"}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Logo image:
|
||||
<input
|
||||
type="file"
|
||||
name="logo-image"
|
||||
accept={ALLOWED_MIME_TYPES.join(", ")}
|
||||
required={data.header.logo_type === "image"}
|
||||
/>
|
||||
</label>
|
||||
<div class="file-field">
|
||||
<label>
|
||||
Logo image:
|
||||
<input
|
||||
type="file"
|
||||
name="logo-image"
|
||||
accept={ALLOWED_MIME_TYPES.join(", ")}
|
||||
required={data.header.logo_type === "image"}
|
||||
/>
|
||||
</label>
|
||||
{#if data.header.media}
|
||||
<Modal id="preview-logo-header-{data.header.website_id}" text="Preview">
|
||||
<img
|
||||
src={`http://localhost:5173/${data.header.media.file_system_path}`}
|
||||
alt={data.header.media.original_name}
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
@@ -2,14 +2,17 @@ import { handleFileUpload } from "$lib/server/utils.js";
|
||||
import type { Actions, PageServerLoad } from "./$types";
|
||||
|
||||
export const load: PageServerLoad = async ({ parent, params, cookies, fetch }) => {
|
||||
const articleData = await fetch(`http://localhost:3000/article?id=eq.${params.articleId}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${cookies.get("session_token")}`,
|
||||
Accept: "application/vnd.pgrst.object+json"
|
||||
const articleData = await fetch(
|
||||
`http://localhost:3000/article?id=eq.${params.articleId}&select=*,media(*)`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${cookies.get("session_token")}`,
|
||||
Accept: "application/vnd.pgrst.object+json"
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
const article = await articleData.json();
|
||||
const { website } = await parent();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { ALLOWED_MIME_TYPES } from "$lib/utils";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
import type { ActionData, PageServerData } from "./$types";
|
||||
import Modal from "$lib/components/Modal.svelte";
|
||||
|
||||
const { data, form } = $props<{ data: PageServerData; form: ActionData }>();
|
||||
</script>
|
||||
@@ -60,10 +61,20 @@
|
||||
Publication date:
|
||||
<input type="date" name="publication-date" value={data.article.publication_date} required />
|
||||
</label>
|
||||
<label>
|
||||
Cover image:
|
||||
<input type="file" name="cover-image" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
</label>
|
||||
<div class="file-field">
|
||||
<label>
|
||||
Cover image:
|
||||
<input type="file" name="cover-image" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
</label>
|
||||
{#if data.article.media}
|
||||
<Modal id="preview-cover-article-{data.article.id}" text="Preview">
|
||||
<img
|
||||
src={`http://localhost:5173/${data.article.media.file_system_path}`}
|
||||
alt={data.article.media.original_name}
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
</div>
|
||||
<label>
|
||||
Main content:
|
||||
<textarea name="main-content" rows="20" required>{data.article.main_content}</textarea>
|
||||
|
||||
Reference in New Issue
Block a user