merge: branch 'main' into reports
This commit is contained in:
commit
244c13cd84
30 changed files with 207 additions and 435 deletions
11
frontend/src/lib/api/markdown.ts
Normal file
11
frontend/src/lib/api/markdown.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
import MarkdownIt from "markdown-it";
|
||||
import sanitize from "sanitize-html";
|
||||
|
||||
const md = new MarkdownIt({
|
||||
html: false,
|
||||
breaks: true,
|
||||
}).disable(["heading", "link", "table"]);
|
||||
|
||||
export default function renderMarkdown(src: string | null) {
|
||||
return src ? sanitize(md.render(src)) : null;
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
<script lang="ts">
|
||||
import { Card, CardHeader, CardTitle, ListGroup, ListGroupItem } from "sveltestrap";
|
||||
|
||||
import type { Field } from "$lib/api/entities";
|
||||
|
||||
import StatusIcon from "./StatusIcon.svelte";
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
</script>
|
||||
|
||||
<div>
|
||||
<FallbackImage urls={memberAvatars(member)} width={200} alt="Avatar for {member.name}" />
|
||||
<a href="/@{user.name}/{member.name}">
|
||||
<FallbackImage urls={memberAvatars(member)} width={200} alt="Avatar for {member.name}" />
|
||||
</a>
|
||||
<p class="m-2">
|
||||
<a class="text-reset fs-5" href="/@{user.name}/{member.name}">
|
||||
{member.display_name ?? member.name}
|
||||
|
|
|
@ -4,18 +4,25 @@
|
|||
export let pronouns: Pronoun;
|
||||
|
||||
let pronounText: string;
|
||||
if (pronouns.display_text) {
|
||||
pronounText = pronouns.display_text;
|
||||
} else {
|
||||
const split = pronouns.pronouns.split("/");
|
||||
if (split.length < 2) pronounText = split.join("/");
|
||||
else pronounText = split.slice(0, 2).join("/");
|
||||
}
|
||||
$: pronounText = updatePronouns(pronouns);
|
||||
|
||||
const link = pronouns.display_text
|
||||
const updatePronouns = (pronouns: Pronoun) => {
|
||||
if (pronouns.display_text) {
|
||||
return pronouns.display_text;
|
||||
} else {
|
||||
const split = pronouns.pronouns.split("/");
|
||||
if (split.length < 2) return split.join("/");
|
||||
else return split.slice(0, 2).join("/");
|
||||
}
|
||||
};
|
||||
|
||||
let link: string;
|
||||
let shouldLink: boolean;
|
||||
|
||||
$: link = pronouns.display_text
|
||||
? `${pronouns.pronouns},${pronouns.display_text}`
|
||||
: pronouns.pronouns;
|
||||
const shouldLink = pronouns.pronouns.split("/").length === 5;
|
||||
$: shouldLink = pronouns.pronouns.split("/").length === 5;
|
||||
</script>
|
||||
|
||||
{#if shouldLink}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue