import { For, createSignal, onMount } from "solid-js";
import { Trans } from "@lingui-solid/solid/macro";
import {
Checkbox,
Column,
Dialog,
DialogProps,
List,
Row,
Text,
Time,
} from "@revolt/ui";
import { Symbol } from "@revolt/ui/components/utils/Symbol";
import MdPolicy from "@material-design-icons/svg/outlined/policy.svg?component-solid";
import { useModals } from "..";
import { Modals } from "../types";
let shownForSession = false;
export function PolicyChangeModal(
props: DialogProps & Modals & { type: "policy_change" },
) {
const { showError } = useModals();
const [confirm, setConfirm] = createSignal(false);
// automatically close if we've already shown this modal in this session
const allowDisplay = !shownForSession;
shownForSession = true;
onMount(() => !allowDisplay && props.onClose());
return (
}
show={allowDisplay && props.show}
onClose={props.onClose}
title={Review policy changes}
actions={[
{ text: Close },
{
text: Acknowledge,
isDisabled: !confirm(),
async onClick() {
await props.acknowledge().catch(showError);
},
},
]}
>
Click on the items below to learn more about different changes!
{(change) => (
window.open(change.url, "_blank")}>
{change.description}
Effective{" "}
(
)
open_in_new
)}
setConfirm((checked) => !checked)}
>
I've read and reviewed the changes.
);
}