feat(releases-widget): show project description when release description is missing (#3635)

Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
Andre Silva
2025-07-15 17:21:37 +01:00
committed by GitHub
parent fc207b17dc
commit 47806c180e
2 changed files with 33 additions and 16 deletions

View File

@@ -2309,6 +2309,7 @@
"openProjectPage": "Open Project Page", "openProjectPage": "Open Project Page",
"openReleasePage": "Open Release Page", "openReleasePage": "Open Release Page",
"releaseDescription": "Release Description", "releaseDescription": "Release Description",
"projectDescription": "Project Description",
"created": "Created", "created": "Created",
"error": { "error": {
"label": "Error", "label": "Error",

View File

@@ -18,7 +18,7 @@ import ReactMarkdown from "react-markdown";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import { useRequiredBoard } from "@homarr/boards/context"; import { useRequiredBoard } from "@homarr/boards/context";
import { isDateWithin, splitToChunksWithNItems } from "@homarr/common"; import { isDateWithin, isNullOrWhitespace, splitToChunksWithNItems } from "@homarr/common";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { MaskedOrNormalImage } from "@homarr/ui"; import { MaskedOrNormalImage } from "@homarr/ui";
@@ -572,23 +572,39 @@ const ExpandedDisplay = ({ repository, hasIconColor }: ExtendedDisplayProps) =>
</Text> </Text>
</> </>
)} )}
{repository.releaseDescription && (
<> {repository.releaseDescription ? (
<Divider className="releases-repository-expanded-description-divider" my={10} mx="30%" /> <Description title={t("releaseDescription")} description={repository.releaseDescription} />
<Title className="releases-repository-expanded-description-title" order={4} ta="center"> ) : (
{t("releaseDescription")} <Description title={t("projectDescription")} description={repository.projectDescription ?? null} />
</Title>
<Text
className={combineClasses("releases-repository-expanded-description-text", classes.releasesDescription)}
component="div"
size="xs"
ff="monospace"
>
<ReactMarkdown skipHtml>{repository.releaseDescription}</ReactMarkdown>
</Text>
</>
)} )}
</Stack> </Stack>
</> </>
); );
}; };
interface DescriptionProps {
title: string;
description: string | null;
}
const Description = ({ title, description }: DescriptionProps) => {
if (isNullOrWhitespace(description)) return null;
return (
<>
<Divider className="releases-repository-expanded-description-divider" my={10} mx="30%" />
<Title className="releases-repository-expanded-description-title" order={4} ta="center">
{title}
</Title>
<Text
className={combineClasses("releases-repository-expanded-description-text", classes.releasesDescription)}
component="div"
size="xs"
ff="monospace"
>
<ReactMarkdown skipHtml>{description}</ReactMarkdown>
</Text>
</>
);
};