Skip to content

The open alternative to Salesforce, designed for AI.

1.3 KB
Raw Blame
import { SettingsTableCard } from '@/settings/components/SettingsTableCard';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { Section } from 'twenty-ui/components/layout';
import { themeCssVariables } from 'twenty-ui/theme';

const StyledSettingsTableCard = styled(SettingsTableCard)`
  padding-left: ${themeCssVariables.spacing[2]};
  padding-right: ${themeCssVariables.spacing[2]};
`;

export const SettingsAdminHealthAccountSyncCountersTable = ({
  details,
  title,
  description,
}: {
  details: Record<string, any> | null;
  title: string;
  description: string;
}) => {
  const { t } = useLingui();

  if (!details) {
    return null;
  }

  const items = [
    {
      label: t`Active Sync`,
      value: details.counters.ACTIVE,
    },
    {
      label: t`Total Jobs`,
      value: details.totalJobs,
    },
    {
      label: t`Failed Jobs`,
      value: details.failedJobs,
    },
    {
      label: t`Failure Rate`,
      value: `${details.failureRate}%`,
    },
  ];

  return (
    <Section.Root>
      <Section.Header title={title} description={description} />
      <StyledSettingsTableCard
        items={items}
        gridAutoColumns="1fr 1fr"
        labelAlign="left"
        valueAlign="right"
      />
    </Section.Root>
  );
};