Skip to content

Commit

Permalink
Patch
Browse files Browse the repository at this point in the history
Patched not-showing images in articles due to <br /> mishandling.
  • Loading branch information
gregory-buffard committed Dec 4, 2024
1 parent ecd7dec commit d948535
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 33 deletions.
2 changes: 1 addition & 1 deletion web/actions/articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const fetchArticle = async (id: string, locale: string) => {
const { data } = await client.query({
query: gql`
query Article($id: String!, $locale: LocaleInputType!) {
Article(id: $id, locale: $locale) {
Article(id: $id, locale: $locale, limit: 0) {
id
title
date
Expand Down
7 changes: 6 additions & 1 deletion web/components/article/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export const ContentRenderer = ({
};

const renderNode = (node: ArticleContentBlock) => {
if (node.children.length === 1 && node.children[0].text === "") return <br />;
if (
node.children.length === 1 &&
node.children[0].text === "" &&
node.type != "upload"
)
return <br />;
switch (node.type) {
case "h1":
return <h1>{node.children.map(renderLeaf)}</h1>;
Expand Down
43 changes: 12 additions & 31 deletions web/components/yachts/yacht/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,14 @@ const Details = () => {
}
>
<SwitchView props={{ view: "info", label: t("info") }} />
{(data.keyFeatures && data.keyFeatures.length > 0) ||
(data.customKeyFeatures && data.customKeyFeatures.length > 0) ? (
<SwitchView props={{ view: "features", label: t("features") }} />
) : (
<></>
)}
{
/*(data.keyFeatures && data.keyFeatures.length > 0) ||*/
data.customKeyFeatures && data.customKeyFeatures.length > 0 ? (
<SwitchView props={{ view: "features", label: t("features") }} />
) : (
<></>
)
}
<button
type={"button"}
onClick={async () => {
Expand Down Expand Up @@ -316,33 +318,12 @@ const Details = () => {
),
)
: view === "features" && (
<div
className={"w-full grid grid-cols-2 md:grid-cols-3 gap-[2vh]"}
>
{characteristics
.filter(
(property) =>
property &&
data.keyFeatures &&
data.keyFeatures.includes(property.key),
)
.map(
(property, i) =>
property && (
<div
key={i}
className={
"flex flex-col justify-center items-start"
}
>
<h3>{property.value}</h3>
<p className={"text-rock-300"}>{property.label}</p>
</div>
),
)}
<div className={"w-full grid grid-cols-1 gap-[2vh]"}>
{data.customKeyFeatures &&
data.customKeyFeatures.map((customFeature, i) => (
<h3 key={i}>{customFeature}</h3>
<p key={i} className={"text-lg"}>
{customFeature}
</p>
))}
</div>
)}
Expand Down

0 comments on commit d948535

Please sign in to comment.