Add AboutModal

This commit is contained in:
Cooldude2606 committed 2026-06-10 22:35:00 +01:00
1 parent f7d3516c24
commit 0e36df8ae3
4 files changed
+258 -51

No files matched your search

@@ -1,61 +1,26 @@
import React, { useState, ReactNode } from "react";
import { Modal, Tooltip } from "antd";
import React from "react";
import { Modal } from "antd";
import ReactMarkdown from "react-markdown";
import webUiPackage from "../../package.json";
import changelog from "../../../../CHANGELOG.md";
const cleanedChangelog = changelog
.replace(/<!--[\s\S]*?-->/g, "") // remove comments
.replace(/^#\s+Changelog\s*\n?/i, ""); // remove top-level title
type Props = {
/** Optional tooltip text */
tooltip?: string;
/** Optional class for the clickable wrapper */
className?: string;
/** Custom clickable content */
children?: ReactNode;
};
/**
* Displays a clickable element which opens a modal containing the changelog.
* Defaults to showing the current version if no children are provided.
* Displays a modal element which contains the change log
*/
export default function ChangeLogModal({
tooltip = "View changelog",
className = "site-version",
children = webUiPackage.version,
}: Props) {
const [open, setOpen] = useState(false);
return (
<>
<Tooltip
title={tooltip}
placement="bottom"
align={{ offset: [0, -10] }}
>
<span
className={className}
style={{ cursor: "pointer" }}
onClick={() => setOpen(true)}
>
{children}
</span>
</Tooltip>
<Modal
title="Changelog"
open={open}
onCancel={() => setOpen(false)}
footer={null}
width={800}
>
<ReactMarkdown>
{cleanedChangelog}
</ReactMarkdown>
</Modal>
</>
);
export default function ChangeLogModal({ open, onClose }: any) {
return <Modal
title="Changelog"
open={open}
onCancel={onClose}
footer={null}
width={800}
>
<ReactMarkdown>
{cleanedChangelog}
</ReactMarkdown>
</Modal>;
}