Fixes Apple Calendar onboarding and type fixes (#988)

* 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>
This commit is contained in:
Omar Lópezandkodiakhq[bot] authored and GitHub committed 2021-10-20 15:42:40 +00:00
1 parent bd99a06765
commit 85d7122e43
27 files changed
+698 -614

No files matched your search

+18 -8
View File
@@ -1,8 +1,13 @@
import React, { useEffect, useState } from "react";
export const WeekdaySelect = (props) => {
const [activeDays, setActiveDays] = useState(
[...Array(7).keys()].map((v, i) => (props.defaultValue || []).includes(i))
interface WeekdaySelectProps {
defaultValue: number[];
onSelect: (selected: number[]) => void;
}
export const WeekdaySelect = (props: WeekdaySelectProps) => {
const [activeDays, setActiveDays] = useState<boolean[]>(
Array.from(Array(7).keys()).map((v, i) => (props.defaultValue || []).includes(i))
);
const days = ["S", "M", "T", "W", "T", "F", "S"];
@@ -11,10 +16,9 @@ export const WeekdaySelect = (props) => {
props.onSelect(activeDays.map((v, idx) => (v ? idx : -1)).filter((v) => v !== -1));
}, [activeDays]);
const toggleDay = (e, idx: number) => {
e.preventDefault();
const toggleDay = (idx: number) => {
activeDays[idx] = !activeDays[idx];
setActiveDays([].concat(activeDays));
setActiveDays(([] as boolean[]).concat(activeDays));
};
return (
@@ -24,7 +28,10 @@ export const WeekdaySelect = (props) => {
activeDays[idx] ? (
<button
key={idx}
onClick={(e) => toggleDay(e, idx)}
onClick={(e) => {
e.preventDefault();
toggleDay(idx);
}}
className={`
w-10 h-10
bg-black text-white focus:outline-none px-3 py-1 rounded
@@ -38,7 +45,10 @@ export const WeekdaySelect = (props) => {
) : (
<button
key={idx}
onClick={(e) => toggleDay(e, idx)}
onClick={(e) => {
e.preventDefault();
toggleDay(idx);
}}
style={{ marginTop: "1px", marginBottom: "1px" }}
className={`w-10 h-10 bg-gray-50 focus:outline-none px-3 py-1 rounded-none ${
idx === 0 ? "rounded-l" : "border-l-0"