diff --git a/Cargo.lock b/Cargo.lock index 7f910bc..48a0186 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2431,7 +2431,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reminder-rs" -version = "1.7.19" +version = "1.7.20" dependencies = [ "base64 0.22.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 008dbe2..3a67953 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.19" +version = "1.7.20" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" diff --git a/reminder-dashboard/src/components/App/Mentions.tsx b/reminder-dashboard/src/components/App/Mentions.tsx index 76161c3..edccd14 100644 --- a/reminder-dashboard/src/components/App/Mentions.tsx +++ b/reminder-dashboard/src/components/App/Mentions.tsx @@ -7,6 +7,10 @@ import { useGuild } from "./useGuild"; export const Mentions = ({ input }) => { const guild = useGuild(); + return <>{guild && <_Mentions guild={guild} input={input} />}; +}; + +const _Mentions = ({ guild, input }) => { const { data: roles } = useQuery(fetchGuildRoles(guild)); const { data: channels } = useQuery(fetchGuildChannels(guild)); const { data: emojis } = useQuery(fetchGuildEmojis(guild)); diff --git a/reminder-dashboard/src/components/Reminder/CreateReminder.tsx b/reminder-dashboard/src/components/Reminder/CreateReminder.tsx index 04445d9..cb197b6 100644 --- a/reminder-dashboard/src/components/Reminder/CreateReminder.tsx +++ b/reminder-dashboard/src/components/Reminder/CreateReminder.tsx @@ -45,6 +45,37 @@ function defaultReminder(): Reminder { export const CreateReminder = () => { const guild = useGuild(); + if (guild) { + return <_Guild guild={guild} />; + } else { + return <_User />; + } +}; + +const _User = () => { + const [reminder, setReminder] = useState(defaultReminder()); + const [collapsed, setCollapsed] = useState(false); + + return ( + +
+ { + setCollapsed(!collapsed); + }} + /> +
+ + +
+ +
+
+ ); +}; + +const _Guild = ({ guild }) => { const [reminder, setReminder] = useState(defaultReminder()); const [collapsed, setCollapsed] = useState(false); diff --git a/reminder-dashboard/src/components/TimezonePicker/index.tsx b/reminder-dashboard/src/components/TimezonePicker/index.tsx index 58655ac..5c60f37 100644 --- a/reminder-dashboard/src/components/TimezonePicker/index.tsx +++ b/reminder-dashboard/src/components/TimezonePicker/index.tsx @@ -53,7 +53,7 @@ export const TimezonePicker = () => { const TimezoneModal = ({ setModalOpen }) => { const browserTimezone = DateTime.now().zoneName; - const [selectedZone, setSelectedZone] = useTimezone(); + const [selectedZone] = useTimezone(); const queryClient = useQueryClient(); const { isLoading, isError, data } = useQuery(fetchUserInfo()); diff --git a/reminder-dashboard/src/components/User/UserReminders.tsx b/reminder-dashboard/src/components/User/UserReminders.tsx index da838d0..823db4e 100644 --- a/reminder-dashboard/src/components/User/UserReminders.tsx +++ b/reminder-dashboard/src/components/User/UserReminders.tsx @@ -11,12 +11,7 @@ enum Sort { } export const UserReminders = () => { - const { - isSuccess, - isFetching, - isFetched, - data: guildReminders, - } = useQuery(fetchUserReminders()); + const { isSuccess, isFetching, isFetched, data: reminders } = useQuery(fetchUserReminders()); const [collapsed, setCollapsed] = useState(false); const [sort, setSort] = useState(Sort.Time); @@ -85,7 +80,7 @@ export const UserReminders = () => {
{isSuccess && - guildReminders + reminders .sort((r1, r2) => { if (sort === Sort.Time) { return r1.utc_time > r2.utc_time ? 1 : -1; diff --git a/src/postman/mod.rs b/src/postman/mod.rs index b19fa5a..6bf6697 100644 --- a/src/postman/mod.rs +++ b/src/postman/mod.rs @@ -52,6 +52,7 @@ async fn _initialize(ctx: Context, pool: impl Executor<'_, Database = Database> for reminder in reminders { reminder.send(pool, ctx.clone()).await; + let _ = sd_notify::notify(false, &[NotifyState::Watchdog]); } } diff --git a/systemd/reminder-rs.service b/systemd/reminder-rs.service index 57c77df..b5b3121 100644 --- a/systemd/reminder-rs.service +++ b/systemd/reminder-rs.service @@ -9,7 +9,7 @@ WorkingDirectory=/etc/reminder-rs Restart=always RestartSec=10 Environment="reminder_rs=warn,postman=warn" -WatchdogSec=600 +WatchdogSec=120 [Install] WantedBy=multi-user.target