Feature(reviews): parse reviews with markdown, make sure paragraphs are shown

This commit is contained in:
Pieter Vander Vennet 2025-07-10 03:03:25 +02:00
parent c76b9b4ff6
commit 9a94670737
4 changed files with 34 additions and 10 deletions

View file

@ -5723,6 +5723,11 @@ svg.apply-fill path {
height: calc(2.5rem - 1px); height: calc(2.5rem - 1px);
} }
.in-markdown p, .in-markdown ol, .in-markdown ul {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
@media (min-width: 640px) { @media (min-width: 640px) {
.compass_arrow { .compass_arrow {
width: calc(2.75rem - 1px); width: calc(2.75rem - 1px);
@ -8577,6 +8582,10 @@ svg.apply-fill path {
display: none; display: none;
} }
.md\:h-6 {
height: 1.5rem;
}
.md\:h-64 { .md\:h-64 {
height: 16rem; height: 16rem;
} }
@ -8637,6 +8646,10 @@ svg.apply-fill path {
width: 12rem; width: 12rem;
} }
.md\:w-6 {
width: 1.5rem;
}
.md\:w-6\/12 { .md\:w-6\/12 {
width: 50%; width: 50%;
} }

View file

@ -14,5 +14,7 @@
</script> </script>
{#if src?.length > 0} {#if src?.length > 0}
{@html marked.parse(src)} <div class="in-markdown">
{@html marked.parse(src)}
</div>
{/if} {/if}

View file

@ -6,6 +6,8 @@
import Tr from "../Base/Tr.svelte" import Tr from "../Base/Tr.svelte"
import { ariaLabel } from "../../Utils/ariaLabel" import { ariaLabel } from "../../Utils/ariaLabel"
import ThemeViewState from "../../Models/ThemeViewState" import ThemeViewState from "../../Models/ThemeViewState"
import Markdown from "../Base/Markdown.svelte"
import AccordionSingle from "../Flowbite/AccordionSingle.svelte"
export let state: ThemeViewState = undefined export let state: ThemeViewState = undefined
export let review: Review & { export let review: Review & {
@ -43,6 +45,7 @@
<h3>{sub}</h3> <h3>{sub}</h3>
</button> </button>
{/if} {/if}
<div class="flex w-full items-center justify-between"> <div class="flex w-full items-center justify-between">
<div <div
tabindex="0" tabindex="0"
@ -50,7 +53,7 @@
n: "" + Math.round(review.rating / 10) / 2, n: "" + Math.round(review.rating / 10) / 2,
})} })}
> >
<StarsBar readonly={true} score={review.rating} /> <StarsBar starSize="w-4 h-4 md:w-6 md:h-6" readonly={true} score={review.rating} />
</div> </div>
<div class="flex flex-wrap space-x-2"> <div class="flex flex-wrap space-x-2">
<a <a
@ -66,22 +69,23 @@
</span> </span>
{/if} {/if}
</a> </a>
<span class="subtle">
{date}
</span>
</div>
</div>
{#if review.opinion}
<div class="link-no-underline">
<a <a
class="subtle"
target="_blank" target="_blank"
rel="noopener nofollow" rel="noopener nofollow"
href={`https://mangrove.reviews/list?signature=${encodeURIComponent(review.signature)}`} href={`https://mangrove.reviews/list?signature=${encodeURIComponent(review.signature)}`}
> >
{review.opinion} {date}
</a> </a>
</div> </div>
</div>
{#if review.opinion}
<div class="disable-links">
<Markdown src= {review.opinion}/>
</div>
{/if} {/if}
{#if review.metadata.is_affiliated} {#if review.metadata.is_affiliated}
<Tr t={Translations.t.reviews.affiliated_reviewer_warning} /> <Tr t={Translations.t.reviews.affiliated_reviewer_warning} />
{/if} {/if}

View file

@ -617,6 +617,11 @@ svg.apply-fill path {
height: calc(2.5rem - 1px); height: calc(2.5rem - 1px);
} }
.in-markdown p, .in-markdown ol, .in-markdown ul {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
@media (min-width: 640px) { @media (min-width: 640px) {
.compass_arrow { .compass_arrow {
width: calc(2.75rem - 1px); width: calc(2.75rem - 1px);