
* Type fixes * Type fixes * Attemp to prevent unknown error in prod * Type fixes * Type fixes for onboarding * Extracts ConnectIntegration * Extracts IntegrationListItem * Extracts CalendarsList * Uses CalendarList on onboarding * Removes deprecated Alert * Extracts DisconnectIntegration * Extracts CalendarSwitch * Extracts ConnectedCalendarsList * Extracted connectedCalendar logic for reuse * Extracted SubHeadingTitleWithConnections * Type fixes * Fetched connected calendars in onboarding * Refreshes data on when adding/removing calendars on onboarding * Removed testing code * Type fixes * Feedback * Moved integration helpers * I was sleepy Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
29 lines
679 B
TypeScript
29 lines
679 B
TypeScript
import { ReactNode } from "react";
|
|
|
|
import Badge from "@components/ui/Badge";
|
|
|
|
function pluralize(opts: { num: number; plural: string; singular: string }) {
|
|
if (opts.num === 0) {
|
|
return opts.singular;
|
|
}
|
|
return opts.singular;
|
|
}
|
|
|
|
export default function SubHeadingTitleWithConnections(props: { title: ReactNode; numConnections?: number }) {
|
|
const num = props.numConnections;
|
|
return (
|
|
<>
|
|
<span>{props.title}</span>
|
|
{num ? (
|
|
<Badge variant="success">
|
|
{num}{" "}
|
|
{pluralize({
|
|
num,
|
|
singular: "connection",
|
|
plural: "connections",
|
|
})}
|
|
</Badge>
|
|
) : null}
|
|
</>
|
|
);
|
|
}
|