From 43b275bc30b6feb0448fe3d1aabf3be553f40c01 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Mon, 6 Sep 2021 10:14:01 +0100 Subject: [PATCH] Implemented Button, hide 'Prev step' on first step (#583) * Implemented Button, hide 'Prev step' on first step * Changed 00:00:00 -> 00:00 whilst keeping values unchanged * Updated to localizedFormat (future i18n) + remove unused const * Going native for now, can revisit later Co-authored-by: Bailey Pumfleet --- components/ui/Schedule/Schedule.tsx | 27 ++++++++----------- pages/getting-started.tsx | 41 +++++++++++------------------ 2 files changed, 26 insertions(+), 42 deletions(-) diff --git a/components/ui/Schedule/Schedule.tsx b/components/ui/Schedule/Schedule.tsx index 5d2f45b9..20e29eaa 100644 --- a/components/ui/Schedule/Schedule.tsx +++ b/components/ui/Schedule/Schedule.tsx @@ -8,7 +8,6 @@ export const toCalendsoAvailabilityFormat = (schedule: Schedule) => { return schedule; }; -export const AM_PM_TIME_FORMAT = `h:mm:ss a`; export const _24_HOUR_TIME_FORMAT = `HH:mm:ss`; const DEFAULT_START_TIME = "09:00:00"; @@ -30,7 +29,7 @@ const TIMES = (() => { let t: Dayjs = starting_time; while (t.isBefore(ending_time)) { - times.push(t.format(_24_HOUR_TIME_FORMAT)); + times.push(t); t = t.add(increment, "minutes"); } return times; @@ -213,6 +212,14 @@ const SchedulerForm = ({ schedule = DEFAULT_SCHEDULE, onSubmit }: Props) => { }; const TimeRangeField = ({ range, day, index }: { range: TimeRange; day: DayOfWeek; index: number }) => { + const timeOptions = (type: "start" | "end") => + TIMES.map((time) => ( + + )); return (
@@ -222,13 +229,7 @@ const SchedulerForm = ({ schedule = DEFAULT_SCHEDULE, onSubmit }: Props) => { defaultValue={range?.start || DEFAULT_START_TIME} onChange={handleSelectRangeChange} className="block px-4 pr-8 py-2 text-base border-gray-300 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm rounded-sm"> - {TIMES.map((time) => { - return ( - - ); - })} + {timeOptions("start")} -
diff --git a/pages/getting-started.tsx b/pages/getting-started.tsx index e46b07a4..3a08b6d8 100644 --- a/pages/getting-started.tsx +++ b/pages/getting-started.tsx @@ -31,6 +31,7 @@ import { AddCalDavIntegrationRequest } from "../lib/integrations/CalDav/componen import classnames from "classnames"; import { ArrowRightIcon } from "@heroicons/react/outline"; import { getSession } from "@lib/auth"; +import Button from "@components/ui/Button"; const DEFAULT_EVENT_TYPES = [ { @@ -146,11 +147,9 @@ export default function Onboarding(props: OnboardingProps) {
- +
); @@ -447,15 +446,9 @@ export default function Onboarding(props: OnboardingProps) { />
- +
), @@ -579,26 +572,22 @@ export default function Onboarding(props: OnboardingProps) { {!steps[currentStep].hideConfirm && (
- +
)}
-
- +
+ {currentStep !== 0 && ( + + )}