Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG - Events dates are dynamic (different timezones), but time is static! #2966

Merged
merged 43 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7e9bd8b
feat: added timepicker
igorgoldobin Aug 17, 2024
dd652c2
Regenerate lockfile
bradystroud Sep 6, 2024
4330c69
Merge branch 'main' of https://github.com/SSWConsulting/SSW.Website i…
igorgoldobin Sep 6, 2024
148083c
update tina lock
igorgoldobin Sep 6, 2024
357605e
Update components/training/eventBooking.tsx
fenix2222 Sep 13, 2024
5873407
Merge branch 'main' of https://github.com/SSWConsulting/SSW.Website i…
igorgoldobin Sep 14, 2024
bee3254
lock file update
igorgoldobin Sep 14, 2024
2acbb80
lint fix
igorgoldobin Sep 14, 2024
98c3c34
resolved merge debt
Calinator444 Mar 7, 2025
21e7a7b
💄 Added custom time picker component for a smoother editing experience
Calinator444 Mar 7, 2025
e6cac10
updated default start times in boxes for better UX
Calinator444 Mar 7, 2025
5a632ed
updated default value for event finish time to be 5PM rather than 5AM
Calinator444 Mar 9, 2025
3ebecc0
fixed bug causing event start time to change to 10AM for no reason
Calinator444 Mar 9, 2025
3074c50
removed unreachable code in time formatting method
Calinator444 Mar 9, 2025
6714e7b
Fixed null reference exception when event does not have a booking URL
Calinator444 Mar 9, 2025
bb8490a
WIP: updating event location to show when there's no direct link
Calinator444 Mar 9, 2025
9a58926
Merge branch 'main' into add-timepicker-for-events
Calinator444 Mar 10, 2025
6298dfd
added class in tina editor to eslintrc
Calinator444 Mar 10, 2025
067cd2f
added shadow outline to custom classes
Calinator444 Mar 10, 2025
8976f1e
fixed booking location not rendering properly
Calinator444 Mar 11, 2025
88dd014
Merge branch 'main' into add-timepicker-for-events
Calinator444 Mar 11, 2025
45095ae
fixed date time formatting inconsistency between editor & page
Calinator444 Mar 12, 2025
a7d386e
changed node version to 22 (usually defaults to 20.18)
Calinator444 Mar 12, 2025
2eae646
Merge branch 'add-timepicker-for-events' of https://github.com/SSWCon…
Calinator444 Mar 12, 2025
9eef6a3
separated event booking schema into a separate file for better develo…
Calinator444 Mar 12, 2025
d2f2a1b
fixed default time not showing up properly in time picker.
Calinator444 Mar 12, 2025
0de17fd
removed console logs and commented code
Calinator444 Mar 12, 2025
e0b653c
refactored logic for dealing with UTC times
Calinator444 Mar 13, 2025
f9a2464
Added todos & PBIs for adding UTC support in Tina
Calinator444 Mar 13, 2025
11179e8
resolved merge conflicts
Calinator444 Mar 13, 2025
46e46aa
Merge branch 'main' into add-timepicker-for-events
Calinator444 Mar 13, 2025
f9ae9a6
reverted nvrmc to state in main
Calinator444 Mar 13, 2025
ee2d13a
Merge branch 'add-timepicker-for-events' of https://github.com/SSWCon…
Calinator444 Mar 13, 2025
9d07497
removed moment, timezone & utc
Calinator444 Mar 13, 2025
e4c7e42
Merge branch 'main' into add-timepicker-for-events
Calinator444 Mar 13, 2025
0ffa7b5
commiting regenerated tina lock file
Calinator444 Mar 13, 2025
3dcf2f3
removed white space changes
Calinator444 Mar 13, 2025
1f175d8
removed accidental change to useSeo
Calinator444 Mar 13, 2025
21bc4d3
removed unused imports
Calinator444 Mar 13, 2025
9153fc5
💄 moved AEST next to text & changed to AEDT
Calinator444 Mar 13, 2025
eefe172
TinaCMS content update
tina-cloud-app[bot] Mar 13, 2025
a2c8113
Revert "TinaCMS content update"
Calinator444 Mar 14, 2025
76662d4
Merge branch 'main' into add-timepicker-for-events
Calinator444 Mar 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { tweetEmbedSchema } from "../embeds/tweetEmbed";
import { interestFormSchema } from "../events/interestForm";
import { inlineJotFormSchema } from "../inlineJotForm/inlineJotForm";
import { agreementFormBlockSchema } from "../terms-and-conditions/agreementForm";
import { eventBookingSchema } from "../training/eventBooking";
import eventBookingSchema from "../training/eventBooking.schema";
import { locationBlockSchema } from "../training/locationBlock";
import { presenterBlockSchema } from "../training/presenterBlock";
import { trainingInformationSchema } from "../training/trainingInformation";
Expand Down
165 changes: 165 additions & 0 deletions components/training/eventBooking.schema.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
import { Template, wrapFieldsWithMeta } from "tinacms";

import { utcDateToHoursMinutes } from "@/services/client/date.service";
import React, { useState } from "react";

const gstTypeOptions = ["inc GST", "+ GST"];

export const eventBookingBlock = {
eventBooking: "EventBooking",
eventDurationInDays: "eventDurationInDays",
price: "price",
discountPrice: "discountPrice",
discountNote: "discountNote",
suffix: "suffix",
eventList: {
value: "eventList",
city: "city",
date: "date",
endDate: "endDate",
bookingURL: "bookingURL",
location: "location",
},
gstText: "gstText",
};

const TimePicker = ({ input, defaultValue }) => {
const { onChange, value: inputValue, ...props } = input;
const [value, setValue] = useState(
inputValue ? utcDateToHoursMinutes(inputValue) : defaultValue
);
return (
<input
className="focus:shadow-outline block w-full rounded-md border border-gray-200 bg-white px-3 py-2 text-base text-gray-600 shadow-inner transition-all duration-150 ease-out placeholder:text-gray-300 focus:border-blue-500 focus:text-gray-900 focus:outline-none"
value={value}
{...props}
onChange={(e) => {
setValue(e.target.value);
const time = e.target.value.split(":");
const hours = time[0];
const minutes = time[1];
const date = new Date(
Date.UTC(0, 0, 0, Number(hours), Number(minutes))
).toISOString();
onChange(date);
}}
type="time"
/>
);
};

const eventBookingSchema: Template = {
name: eventBookingBlock.eventBooking,
label: "Events Booking",
ui: {
previewSrc: "/images/thumbs/tina/events-booking.jpg",
},
fields: [
{
type: "number",
label: "Duration (In Days)",
name: eventBookingBlock.eventDurationInDays,
required: true,
},
{
type: "number",
label: "Price",
name: eventBookingBlock.price,
required: true,
},
{
type: "number",
label: "Discount Price",
name: eventBookingBlock.discountPrice,
},
{
type: "string",
name: eventBookingBlock.gstText,
label: "Select GST Option",
options: gstTypeOptions,
required: true,
},

{
type: "string",
label: "Discount Note",
name: eventBookingBlock.discountNote,
},
{
type: "object",
label: "Event",
name: eventBookingBlock.eventList.value,
ui: {
itemProps: (item) => {
return { label: item?.city };
},
},
list: true,
fields: [
{
type: "string",
label: "City",
name: eventBookingBlock.eventList.city,
},
{
type: "datetime",
label: "Start Date",
name: eventBookingBlock.eventList.date,
ui: {
//@ts-expect-error - TODO: update when tina datetime picker is updated to support utc https://github.com/tinacms/tina.io/issues/2989
utc: true,
format: (value) => {
const val =
value && dateFormat.format(new Date(Date.parse(value)));
return val;
},
},
},
{
label: "Start Time",
type: "datetime",
ui: {
component: wrapFieldsWithMeta(({ input }) => (
<TimePicker defaultValue={"09:00"} input={input} />
)),
//@ts-expect-error - TODO: update when tina datetime picker is updated to support utc https://github.com/tinacms/tina.io/issues/2989
utc: true,
},
name: "startTime",
},
{
label: "End Time",
type: "datetime",
ui: {
component: wrapFieldsWithMeta(({ input }) => (
<TimePicker input={input} defaultValue={"17:00"} />
)),
//@ts-expect-error - TODO: update when tina datetime picker is updated to support utc https://github.com/tinacms/tina.io/issues/2989
utc: true,
},
name: "endTime",
},
{
type: "string",
label: "Booking URL",
name: eventBookingBlock.eventList.bookingURL,
},
{
type: "reference",
label: "Location",
name: eventBookingBlock.eventList.location,
collections: ["locations"],
},
],
},
],
};

const dateFormat = Intl.DateTimeFormat("en-AU", {
timeZone: "UTC",
day: "numeric",
year: "numeric",
month: "short",
});

export default eventBookingSchema;
Loading
Loading