diff --git a/src/components/GuildReminders/index.tsx b/src/components/GuildReminders/index.tsx index 76b7f83..e273418 100644 --- a/src/components/GuildReminders/index.tsx +++ b/src/components/GuildReminders/index.tsx @@ -2,7 +2,8 @@ import { useParams } from "wouter"; import { useQuery } from "react-query"; import { fetchGuildReminders } from "../../api"; import { QueryKeys } from "../../consts"; -import { EditReminder } from "../EditReminder"; +import { EditReminder } from "../Reminder/EditReminder"; +import { CreateReminder } from "../Reminder/CreateReminder"; export const GuildReminders = () => { const { guild } = useParams(); @@ -16,7 +17,7 @@ export const GuildReminders = () => {
Create Reminder
- <> +


diff --git a/src/components/EditReminder/ChannelSelector.tsx b/src/components/Reminder/ChannelSelector.tsx similarity index 100% rename from src/components/EditReminder/ChannelSelector.tsx rename to src/components/Reminder/ChannelSelector.tsx diff --git a/src/components/EditReminder/Content.tsx b/src/components/Reminder/Content.tsx similarity index 100% rename from src/components/EditReminder/Content.tsx rename to src/components/Reminder/Content.tsx diff --git a/src/components/Reminder/CreateReminder.tsx b/src/components/Reminder/CreateReminder.tsx new file mode 100644 index 0000000..7b6d3ea --- /dev/null +++ b/src/components/Reminder/CreateReminder.tsx @@ -0,0 +1,231 @@ +import { useParams } from "wouter"; +import { useState } from "preact/hooks"; +import { useQueries } from "react-query"; +import { QueryKeys } from "../../consts"; +import { fetchGuildChannels, fetchUserInfo } from "../../api"; +import { Name } from "./Name"; +import { Username } from "./Username"; +import React from "react"; +import { Content } from "./Content"; +import { Embed } from "./Embed"; +import { ChannelSelector } from "./ChannelSelector"; +import { DateTime } from "luxon"; +import { IntervalSelector } from "./IntervalSelector"; + +export const CreateReminder = () => { + const { guild } = useParams(); + const [reminder, setReminder] = useState({}); + + const [ + { isSuccess: channelsFetched, data: guildChannels }, + { isSuccess: userFetched, data: userInfo }, + ] = useQueries([ + { + queryKey: [QueryKeys.GUILD_CHANNELS, guild], + queryFn: () => fetchGuildChannels(guild), + staleTime: 300, + }, + { + queryKey: [QueryKeys.USER_DATA], + queryFn: fetchUserInfo, + staleTime: Infinity, + }, + ]); + + const [collapsed, setCollapsed] = useState(false); + + if (!channelsFetched || !userFetched) { + // todo + return <>; + } + + return ( +
+
+ +
+ +
+
+
+
+
+
+

+ + Image for discord avatar + +

+
+
+
+ { + setReminder((reminder) => ({ + ...reminder, + username, + })); + }} + > + { + setReminder((reminder) => ({ + ...reminder, + content, + })); + }} + > + +
+
+
+
+
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+
+
+ Intervals available on{" "} + Patreon or{" "} + + self-hosting + +
+
+ + +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ ); +}; diff --git a/src/components/EditReminder/index.tsx b/src/components/Reminder/EditReminder.tsx similarity index 98% rename from src/components/EditReminder/index.tsx rename to src/components/Reminder/EditReminder.tsx index 6f4dfc9..54768d2 100644 --- a/src/components/EditReminder/index.tsx +++ b/src/components/Reminder/EditReminder.tsx @@ -137,7 +137,9 @@ export const EditReminder = ({ reminder: initialReminder }: Props) => {
-
+
Intervals available on{" "} Patreon or{" "} diff --git a/src/components/EditReminder/Embed/Author.tsx b/src/components/Reminder/Embed/Author.tsx similarity index 100% rename from src/components/EditReminder/Embed/Author.tsx rename to src/components/Reminder/Embed/Author.tsx diff --git a/src/components/EditReminder/Embed/Color.tsx b/src/components/Reminder/Embed/Color.tsx similarity index 100% rename from src/components/EditReminder/Embed/Color.tsx rename to src/components/Reminder/Embed/Color.tsx diff --git a/src/components/EditReminder/Embed/Description.tsx b/src/components/Reminder/Embed/Description.tsx similarity index 100% rename from src/components/EditReminder/Embed/Description.tsx rename to src/components/Reminder/Embed/Description.tsx diff --git a/src/components/EditReminder/Embed/Footer.tsx b/src/components/Reminder/Embed/Footer.tsx similarity index 100% rename from src/components/EditReminder/Embed/Footer.tsx rename to src/components/Reminder/Embed/Footer.tsx diff --git a/src/components/EditReminder/Embed/Title.tsx b/src/components/Reminder/Embed/Title.tsx similarity index 100% rename from src/components/EditReminder/Embed/Title.tsx rename to src/components/Reminder/Embed/Title.tsx diff --git a/src/components/EditReminder/Embed/index.tsx b/src/components/Reminder/Embed/index.tsx similarity index 100% rename from src/components/EditReminder/Embed/index.tsx rename to src/components/Reminder/Embed/index.tsx diff --git a/src/components/EditReminder/IntervalSelector.tsx b/src/components/Reminder/IntervalSelector.tsx similarity index 100% rename from src/components/EditReminder/IntervalSelector.tsx rename to src/components/Reminder/IntervalSelector.tsx diff --git a/src/components/EditReminder/Name.tsx b/src/components/Reminder/Name.tsx similarity index 100% rename from src/components/EditReminder/Name.tsx rename to src/components/Reminder/Name.tsx diff --git a/src/components/EditReminder/Username.tsx b/src/components/Reminder/Username.tsx similarity index 100% rename from src/components/EditReminder/Username.tsx rename to src/components/Reminder/Username.tsx