Skip to content

Commit

Permalink
Is this the problem? (#817)
Browse files Browse the repository at this point in the history
* Is this the problem?

* Just confirming something

* No SSR the description

* Is it the header?

* dispatch

* Clean field description

* href

* remove preview config

* code

* Update src/routes/(app)/add-ons/[owner]/[repo]/+page.ts

Co-authored-by: Allan Lasser <[email protected]>

---------

Co-authored-by: Allan Lasser <[email protected]>
  • Loading branch information
eyeseast and allanlasser authored Nov 8, 2024
1 parent 972c354 commit f5d7c31
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 72 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ build-browser-test:
dev:
docker compose -f local.yml up documentcloud_frontend

preview:
docker compose -f local.yml up preview

down:
docker compose -f local.yml down

build-serve:
docker compose -f local.yml up documentcloud_frontend_build

clean:
@echo deleting Webpack chunks
rm -f public/index.html public/[0-9]*.*.* public/bundle.*.js public/bundle.*.css public/bundle.*.txt public/*.map public/*.*.js
Expand Down
54 changes: 6 additions & 48 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,25 @@ services:
DOCKER: true
NODE_TLS_REJECT_UNAUTHORIZED: 0 # todo: solve local certificate chain issues
NODE_ENV: development
PUPPETEER_SKIP_DOWNLOAD: true

documentcloud_frontend_app:
preview:
image: node:20
volumes:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run dev
networks:
default:
aliases:
- internal.www.dev.documentcloud.org
squarelet_default:
aliases:
- internal.www.dev.documentcloud.org

documentcloud_frontend_embed:
image: node:20
volumes:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run dev
networks:
default:
aliases:
- internal.www.dev.documentcloud.org
squarelet_default:
aliases:
- internal.www.dev.documentcloud.org

documentcloud_frontend_build:
image: node:20
volumes:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run build-serve
networks:
default:
aliases:
- internal.www.dev.documentcloud.org
squarelet_default:
aliases:
- internal.www.dev.documentcloud.org

documentcloud_frontend_analyze:
image: node:20
volumes:
- nodemodules:/app/node_modules
- .:/app
working_dir: /app
command: npm run build-analyze
command: npm run preview
networks:
default:
aliases:
- internal.www.dev.documentcloud.org
squarelet_default:
aliases:
- internal.www.dev.documentcloud.org
environment:
DOCKER: true
NODE_TLS_REJECT_UNAUTHORIZED: 0 # todo: solve local certificate chain issues
NODE_ENV: development

volumes:
nodemodules:
Expand Down
12 changes: 6 additions & 6 deletions src/lib/components/accounts/Mailkey.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@
</p>
{/if}
<Flex gap={1} wrap justify="center">
<Button mode="primary" on:click={create}
>{$_("mailkey.create.button")}</Button
>
<Button mode="danger" on:click={destroy}
>{$_("mailkey.destroy.button")}</Button
>
<Button mode="primary" on:click={create}>
{$_("mailkey.create.button")}
</Button>
<Button mode="danger" on:click={destroy}>
{$_("mailkey.destroy.button")}
</Button>
</Flex>
</Modal>

Expand Down
7 changes: 2 additions & 5 deletions src/lib/components/addons/AddOnMeta.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { MarkGithub16 } from "svelte-octicons";
import Button from "$lib/components/common/Button.svelte";
import Flex from "@/lib/components/common/Flex.svelte";
import Flex from "$lib/components/common/Flex.svelte";
import Metadata from "../common/Metadata.svelte";
import { ALLOWED_TAGS, ALLOWED_ATTR } from "@/config/config.js";
Expand All @@ -15,9 +15,6 @@
$: repo = new URL(addon.repository, "https://github.com/").href;
$: github_org = addon.repository.split("/")[0];
$: description = addon.parameters.description
? clean(addon.parameters.description)
: "";
$: instructions = addon.parameters.instructions
? clean(addon.parameters.instructions)
: "";
Expand All @@ -30,7 +27,7 @@
<div class="container">
<h2 class="name">{addon.name}</h2>
<div class="description">
{@html description}
{@html addon.parameters?.description}
</div>
{#if instructions}
<div class="instructions">
Expand Down
11 changes: 10 additions & 1 deletion src/lib/components/inputs/Field.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
<script lang="ts">
import DOMPurify from "isomorphic-dompurify";
export let title: string = "";
export let description: string = "";
export let inline = false;
export let required = false;
export let sronly = false;
function clean(html: string): string {
return DOMPurify.sanitize(html, {
ALLOWED_TAGS: ["a", "strong", "em", "code"],
ALLOWED_ATTR: ["href"],
});
}
</script>

<div class="field" class:inline class:required>
Expand All @@ -14,7 +23,7 @@
<slot />
</label>
{#if description}
<p class="help">{@html description}</p>
<p class="help">{@html clean(description ?? "")}</p>
{/if}
<slot name="error" />
</div>
Expand Down
9 changes: 4 additions & 5 deletions src/lib/components/navigation/Breadcrumbs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@
export let trail: Breadcrumb[] = [];
let width: number;
$: BREAKPOINTS = {
SHOW_BREADCRUMBS: width > remToPx(32),
};
let width: number = 1000;
$: SHOW_BREADCRUMBS = width > remToPx(32);
</script>

<div class="breadcrumbs" bind:clientWidth={width}>
<Flex gap={0.375} align="center">
<slot name="root">
<a href="/" class="logo crumb"><Logo /></a>
</slot>
{#if BREAKPOINTS.SHOW_BREADCRUMBS}
{#if SHOW_BREADCRUMBS}
{#each trail as { href, title }}
<span class="divider"><TriangleRight16 fill="var(--gray-3)" /></span>
{#if href}
Expand Down
2 changes: 0 additions & 2 deletions src/routes/(app)/add-ons/[owner]/[repo]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { DocumentResults } from "$lib/api/types";

import { error } from "@sveltejs/kit";

import * as addons from "$lib/api/addons";
Expand Down
2 changes: 0 additions & 2 deletions src/routes/(app)/add-ons/[owner]/[repo]/[event]/+page.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { DocumentResults } from "$lib/api/types";

import { error } from "@sveltejs/kit";

import * as addons from "$lib/api/addons";
Expand Down

0 comments on commit f5d7c31

Please sign in to comment.