Truncate prop added
This commit is contained in:
@@ -19,6 +19,7 @@ type DialogProps = {
|
|||||||
formValues: FormValue[];
|
formValues: FormValue[];
|
||||||
setLoading: (loading: boolean) => void;
|
setLoading: (loading: boolean) => void;
|
||||||
icon: React.ReactNode;
|
icon: React.ReactNode;
|
||||||
|
trunate: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function Dialog({
|
export function Dialog({
|
||||||
@@ -29,11 +30,17 @@ export function Dialog({
|
|||||||
formValues,
|
formValues,
|
||||||
setLoading,
|
setLoading,
|
||||||
icon,
|
icon,
|
||||||
|
trunate = true,
|
||||||
}: DialogProps) {
|
}: DialogProps) {
|
||||||
const unsentEmailsLength = formValues.filter(
|
const unsentEmailsLength = formValues.filter(
|
||||||
(s: any) => s.email && s.sendStatus != "SENT"
|
(s: any) => s.email && s.sendStatus != "SENT"
|
||||||
).length;
|
).length;
|
||||||
|
|
||||||
|
if (trunate && document.title.length > 20) {
|
||||||
|
document.title = document.title.substring(0, 7) + "..." +
|
||||||
|
document.title.substring(document.title.length - 7);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Transition.Root show={open} as={Fragment}>
|
<Transition.Root show={open} as={Fragment}>
|
||||||
<DialogComponent as="div" className="relative z-10" onClose={setOpen}>
|
<DialogComponent as="div" className="relative z-10" onClose={setOpen}>
|
||||||
@@ -71,9 +78,7 @@ export function Dialog({
|
|||||||
</DialogComponent.Title>
|
</DialogComponent.Title>
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
{`"${document.title.length > 20 ? document.title.substring(0, 7) + "..." +
|
{`"${document.title}" will be sent to ${unsentEmailsLength} recipients.`}
|
||||||
document.title.substring(document.title.length - 7) : document.title}"
|
|
||||||
will be sent to ${unsentEmailsLength} recipients.`}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user