-
-
-
-
-
+
+
+
+
);
}
diff --git a/src/components/Reminder/Embed/Fields/Field.tsx b/src/components/Reminder/Embed/Fields/Field.tsx
new file mode 100644
index 0000000..ee9749e
--- /dev/null
+++ b/src/components/Reminder/Embed/Fields/Field.tsx
@@ -0,0 +1,55 @@
+export const Field = ({ title, value, inlined, index, onUpdate }) => {
+ return (
+
+
+
+
+
+
+
+
+
+
+ );
+};
diff --git a/src/components/Reminder/Embed/Fields/index.tsx b/src/components/Reminder/Embed/Fields/index.tsx
new file mode 100644
index 0000000..114612c
--- /dev/null
+++ b/src/components/Reminder/Embed/Fields/index.tsx
@@ -0,0 +1,37 @@
+import { useReminder } from "../../ReminderContext";
+import { Field } from "./Field";
+
+export const Fields = () => {
+ const [{ embed_fields }, setReminder] = useReminder();
+
+ return (
+
+ {[...embed_fields, { value: "", title: "", inlined: true }].map((field, index) => (
+ {
+ setReminder((reminder) => ({
+ ...reminder,
+ embed_fields: [
+ ...reminder.embed_fields,
+ { value: "", title: "", inlined: true },
+ ]
+ .map((f, i) => {
+ if (i === index) {
+ return {
+ ...f,
+ ...props,
+ };
+ } else {
+ return f;
+ }
+ })
+ .filter((f) => f.value || f.title),
+ }));
+ }}
+ >
+ ))}
+
+ );
+};
diff --git a/src/components/Reminder/Embed/index.tsx b/src/components/Reminder/Embed/index.tsx
index 50e82f0..4397995 100644
--- a/src/components/Reminder/Embed/index.tsx
+++ b/src/components/Reminder/Embed/index.tsx
@@ -3,6 +3,7 @@ import { Title } from "./Title";
import { Description } from "./Description";
import { Footer } from "./Footer";
import { Color } from "./Color";
+import { Fields } from "./Fields";
import { Reminder } from "../../../api";
import { ImagePicker } from "../ImagePicker";
import { useReminder } from "../ReminderContext";
@@ -55,37 +56,7 @@ export const Embed = () => {
>
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/components/TimezonePicker/index.tsx b/src/components/TimezonePicker/index.tsx
index df0398e..ae1ed8f 100644
--- a/src/components/TimezonePicker/index.tsx
+++ b/src/components/TimezonePicker/index.tsx
@@ -1,8 +1,9 @@
-import { DateTime } from "luxon";
-import { useQuery } from "react-query";
-import { fetchUserInfo } from "../../api";
+import { DateTime, SystemZone } from "luxon";
+import { useMutation, useQuery, useQueryClient } from "react-query";
+import { fetchUserInfo, patchUserInfo } from "../../api";
import { Modal } from "../Modal";
import { useState } from "preact/hooks";
+import { useTimezone } from "../App/TimezoneProvider";
type DisplayProps = {
timezone: string;
@@ -51,15 +52,23 @@ export const TimezonePicker = () => {
};
const TimezoneModal = ({ setModalOpen }) => {
- const browserTimezone = DateTime.now().zone.name;
+ const browserTimezone = SystemZone.name;
+ const [selectedZone, setSelectedZone] = useTimezone();
+ const queryClient = useQueryClient();
const { isLoading, isError, data } = useQuery(fetchUserInfo());
+ const userInfoMutation = useMutation({
+ ...patchUserInfo(),
+ onSuccess: () => {
+ queryClient.invalidateQueries(["USER_INFO"]);
+ },
+ });
return (
Your configured timezone is:{" "}
-
+
Your browser timezone is:{" "}
@@ -78,19 +87,37 @@ const TimezoneModal = ({ setModalOpen }) => {
-