Update clean inactive workspaces (#3600)
* Fix typo * Add dry-run option in clean inactive workspaces * Add logs * Chunk workspace metadata * Add BCC to clean workspace notification email * Send workspace to delete ids in one email * Update example * Update function naming
This commit is contained in:
@ -3,11 +3,11 @@ import { Container, Html } from '@react-email/components';
|
||||
import { BaseHead } from 'src/components/BaseHead';
|
||||
import { Logo } from 'src/components/Logo';
|
||||
|
||||
export const BaseEmail = ({ children }) => {
|
||||
export const BaseEmail = ({ children, width = 290 }) => {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<BaseHead />
|
||||
<Container width={290}>
|
||||
<Container width={width}>
|
||||
<Logo />
|
||||
{children}
|
||||
</Container>
|
||||
|
||||
@ -1,27 +1,38 @@
|
||||
import * as React from 'react';
|
||||
import { Column, Row, Section } from '@react-email/components';
|
||||
import { BaseEmail } from 'src/components/BaseEmail';
|
||||
import { CallToAction } from 'src/components/CallToAction';
|
||||
import { HighlightedText } from 'src/components/HighlightedText';
|
||||
import { MainText } from 'src/components/MainText';
|
||||
import { Title } from 'src/components/Title';
|
||||
|
||||
type DeleteInactiveWorkspaceEmailData = {
|
||||
daysSinceDead: number;
|
||||
daysSinceInactive: number;
|
||||
workspaceId: string;
|
||||
};
|
||||
|
||||
export const DeleteInactiveWorkspaceEmail = ({
|
||||
daysSinceDead,
|
||||
workspaceId,
|
||||
}: DeleteInactiveWorkspaceEmailData) => {
|
||||
export const DeleteInactiveWorkspaceEmail = (
|
||||
workspacesToDelete: DeleteInactiveWorkspaceEmailData[],
|
||||
) => {
|
||||
const minDaysSinceInactive = Math.min(
|
||||
...workspacesToDelete.map(
|
||||
(workspaceToDelete) => workspaceToDelete.daysSinceInactive,
|
||||
),
|
||||
);
|
||||
return (
|
||||
<BaseEmail>
|
||||
<Title value="Dead Workspace 😵" />
|
||||
<HighlightedText value={`Inactive since ${daysSinceDead} day(s)`} />
|
||||
<BaseEmail width={350}>
|
||||
<Title value="Dead Workspaces 😵 that should be deleted" />
|
||||
<MainText>
|
||||
Workspace <b>{workspaceId}</b> should be deleted.
|
||||
List of <b>workspaceIds</b> inactive since at least{' '}
|
||||
<b>{minDaysSinceInactive} days</b>:
|
||||
<Section>
|
||||
{workspacesToDelete.map((workspaceToDelete) => {
|
||||
return (
|
||||
<Row key={workspaceToDelete.workspaceId}>
|
||||
<Column>{workspaceToDelete.workspaceId}</Column>
|
||||
</Row>
|
||||
);
|
||||
})}
|
||||
</Section>
|
||||
</MainText>
|
||||
<CallToAction href="https://app.twenty.com" value="Connect to Twenty" />
|
||||
</BaseEmail>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user