
* 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>
45 lines
1 KiB
TypeScript
45 lines
1 KiB
TypeScript
import React, { ReactNode } from "react";
|
|
|
|
import { List } from "@components/List";
|
|
import Button from "@components/ui/Button";
|
|
|
|
import ConnectIntegration from "./ConnectIntegrations";
|
|
import IntegrationListItem from "./IntegrationListItem";
|
|
|
|
interface Props {
|
|
calendars: {
|
|
children?: ReactNode;
|
|
description: string;
|
|
imageSrc: string;
|
|
title: string;
|
|
type: string;
|
|
}[];
|
|
onChanged: () => void | Promise<void>;
|
|
}
|
|
|
|
const CalendarsList = (props: Props): JSX.Element => {
|
|
const { calendars, onChanged } = props;
|
|
return (
|
|
<List>
|
|
{calendars.map((item) => (
|
|
<IntegrationListItem
|
|
key={item.title}
|
|
{...item}
|
|
actions={
|
|
<ConnectIntegration
|
|
type={item.type}
|
|
render={(btnProps) => (
|
|
<Button color="secondary" {...btnProps}>
|
|
Connect
|
|
</Button>
|
|
)}
|
|
onOpenChange={onChanged}
|
|
/>
|
|
}
|
|
/>
|
|
))}
|
|
</List>
|
|
);
|
|
};
|
|
|
|
export default CalendarsList;
|