Add disable attribute for no permission buttons and shorten query param names

This commit is contained in:
thiloho
2024-10-19 17:55:02 +02:00
parent 185aeea4e5
commit b1a59e38c1
22 changed files with 292 additions and 147 deletions

View File

@@ -10,7 +10,7 @@ import { join } from "node:path";
import { render } from "svelte/server";
import type { Actions, PageServerLoad } from "./$types";
export const load: PageServerLoad = async ({ params, fetch }) => {
export const load: PageServerLoad = async ({ params, fetch, parent }) => {
const websiteOverview: WebsiteOverview = (
await apiRequest(
fetch,
@@ -27,10 +27,13 @@ export const load: PageServerLoad = async ({ params, fetch }) => {
const { websitePreviewUrl, websiteProdUrl } = await generateStaticFiles(websiteOverview);
const { permissionLevel } = await parent();
return {
websiteOverview,
websitePreviewUrl,
websiteProdUrl
websiteProdUrl,
permissionLevel
};
};

View File

@@ -36,7 +36,7 @@
be published on the Internet.
</p>
<form method="POST" action="?/publishWebsite" use:enhance={enhanceForm()}>
<button type="submit">Publish</button>
<button type="submit" disabled={[10, 20].includes(data.permissionLevel)}>Publish</button>
</form>
</section>
@@ -73,7 +73,7 @@
required
/>
</label>
<button type="submit">Submit</button>
<button type="submit" disabled={[10, 20].includes(data.permissionLevel)}>Submit</button>
</form>
{#if data.websiteOverview.domain_prefix?.prefix}
<Modal id="delete-domain-prefix" text="Delete">
@@ -87,7 +87,9 @@
<strong>Caution!</strong>
This action will remove the domain prefix and reset it to its initial value.
</p>
<button type="submit">Delete domain prefix</button>
<button type="submit" disabled={[10, 20].includes(data.permissionLevel)}
>Delete domain prefix</button
>
</form>
</Modal>
{/if}