@@ -38,6 +60,9 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
maxlength={2}
placeholder=""
value={months || ""}
+ onInput={(ev) => {
+ setMonths(parseInt(ev.currentTarget.value));
+ }}
>{" "}
months,
@@ -51,6 +76,9 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
maxlength={4}
placeholder=""
value={days || ""}
+ onInput={(ev) => {
+ setDays(parseInt(ev.currentTarget.value));
+ }}
>{" "}
days,
@@ -66,6 +94,9 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
maxlength={2}
placeholder="HH"
value={hours || ""}
+ onInput={(ev) => {
+ setHours(parseInt(ev.currentTarget.value));
+ }}
>
:
@@ -79,6 +110,9 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
maxlength={2}
placeholder="MM"
value={minutes || ""}
+ onInput={(ev) => {
+ setMinutes(parseInt(ev.currentTarget.value));
+ }}
>
:
@@ -91,7 +125,10 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
name="interval_seconds"
maxlength={2}
placeholder="SS"
- value={secondsRem || ""}
+ value={seconds || ""}
+ onInput={(ev) => {
+ setSeconds(parseInt(ev.currentTarget.value));
+ }}
>
@@ -102,6 +139,8 @@ export const IntervalSelector = ({ months: monthsProp, days: daysProp, seconds:
setMonths(0);
setDays(0);
setSeconds(0);
+ setMinutes(0);
+ setHours(0);
}}
>
Clear interval
diff --git a/src/components/Reminder/Message.tsx b/src/components/Reminder/Message.tsx
index a61f67d..b963ffd 100644
--- a/src/components/Reminder/Message.tsx
+++ b/src/components/Reminder/Message.tsx
@@ -27,17 +27,9 @@ export const Message = () => {
diff --git a/src/components/Reminder/Name.tsx b/src/components/Reminder/Name.tsx
index e82cba8..244c66d 100644
--- a/src/components/Reminder/Name.tsx
+++ b/src/components/Reminder/Name.tsx
@@ -1,17 +1,29 @@
-export const Name = ({ value }) => (
-
-
-
-
-
+import { useReminder } from "./ReminderContext";
+
+export const Name = () => {
+ const [reminder, setReminder] = useReminder();
+
+ return (
+
-
-);
+ );
+};
diff --git a/src/components/Reminder/Settings.tsx b/src/components/Reminder/Settings.tsx
index f002b08..a289695 100644
--- a/src/components/Reminder/Settings.tsx
+++ b/src/components/Reminder/Settings.tsx
@@ -22,7 +22,15 @@ export const Settings = () => {
Channel*
-
+
{
+ setReminder((reminder) => ({
+ ...reminder,
+ channel: channel,
+ }));
+ }}
+ />
@@ -65,6 +73,22 @@ export const Settings = () => {
months={reminder.interval_months}
days={reminder.interval_days}
seconds={reminder.interval_seconds}
+ setInterval={({ seconds, days, months }) => {
+ setReminder((reminder) => ({
+ ...reminder,
+ interval_months: months,
+ interval_days: days,
+ interval_seconds: seconds,
+ }));
+ }}
+ clearInterval={() => {
+ setReminder((reminder) => ({
+ ...reminder,
+ interval_months: null,
+ interval_days: null,
+ interval_seconds: null,
+ }));
+ }}
>
diff --git a/src/components/Reminder/TopBar.tsx b/src/components/Reminder/TopBar.tsx
index 2ed6df6..db1a618 100644
--- a/src/components/Reminder/TopBar.tsx
+++ b/src/components/Reminder/TopBar.tsx
@@ -10,13 +10,15 @@ export const TopBar = ({ toggleCollapsed }) => {
const { isSuccess, data: guildChannels } = useQuery(fetchGuildChannels(guild));
- const channelName = (reminder: Reminder) =>
- guildChannels.find((c) => c.id === reminder.channel);
+ const channelName = (reminder: Reminder) => {
+ const channel = guildChannels.find((c) => c.id === reminder.channel);
+ return channel === undefined ? "" : channel.name;
+ };
return (
{isSuccess &&
#{channelName(reminder)}
}
-
+