+
+
+
+
+
+ Die in deinem Account gespeicherte E-Mail-Adresse wird in der gesendeten Nachricht
+ angezeigt, damit die Empfängerin weiß, von wem die Nachricht stammt.
+
+
+ formValues.setFieldValue("recipients", val)}
+ error={formValues.errors.recipients}
+ />
+
+ }
+ variant={"filled"}
+ placeholder={"Betreff"}
+ required
+ {...formValues.getInputProps("subject")}
+ />
+
+ formValues.setFieldValue("content", value)}
+ error={formValues.errors.content}
+ />
+
+
+
+ >
+}
\ No newline at end of file
diff --git a/src/components/LoadInfinitQueryModal.tsx b/src/components/LoadInfinitQueryModal.tsx
new file mode 100644
index 0000000..3151ca1
--- /dev/null
+++ b/src/components/LoadInfinitQueryModal.tsx
@@ -0,0 +1,71 @@
+import {ListResult} from "pocketbase";
+import {InfiniteData, UseInfiniteQueryResult} from "@tanstack/react-query";
+import {Modal, Progress, Text} from "@mantine/core";
+import {useEffect} from "react";
+
+/**
+ * A modal component that handles the infinite query loading process.
+ * The modal will be opened when the start flag is set to true while the query is fetching data.
+ * When the data fetching is completed, the onSuccess callback will be called.
+ *
+ * During fetching, the modal will show the progress of the fetching process.
+ *
+ * @param {Object} props - The properties object.
+ * @param {boolean} props.start - A flag to start the loading process.
+ * @param {Function} [props.onSuccess] - A callback function to be called when all pages are fetched successfully.
+ * @param {Function} [props.onError] - A callback function to be called when an error occurs during fetching.
+ * @param {UseInfiniteQueryResult, Error>} props.query - The infinite query result object.
+ *
+ * @returns The modal component.
+ */
+export default function LoadInfinitQueryModal({start, query, onSuccess, onError}: {
+ start: boolean
+ onSuccess?: () => void
+ onError?: (error: Error) => void
+ query: UseInfiniteQueryResult, unknown>, Error>
+}) {
+
+ // Fetch all pages
+ useEffect(() => {
+ // Fetch next page if not fetching and hasNextPage
+ if (start && query.hasNextPage && !query.isFetchingNextPage) {
+ query.fetchNextPage().catch(onError)
+ }
+
+ // Call onSuccess when all pages are fetched
+ if (start && query.isFetched && !query.hasNextPage) {
+ onSuccess?.()
+ }
+ }, [start, query, onSuccess])
+
+ const totalItems = query.data?.pages?.[0].totalItems || 0
+ const fetchedItems = query.data?.pages?.reduce((acc, page) => acc + page.items.length, 0) || 0
+
+ const totalPages = query.data?.pages?.[0].totalPages || 0
+ const fetchedPages = query.data?.pages?.length || 0
+
+ const progress = (fetchedPages / totalPages * 100) || 0
+ const dataIsFetching = query.isFetching || query.isPending
+
+ return null}
+ size="xs"
+ centered
+ withCloseButton={false}
+ >
+
-
- Noch keine von dir gesendeten Ankündigungen
-
-
: null
- }
-
-
-}
\ No newline at end of file
diff --git a/src/pages/chat/ChatRouter.module.css b/src/pages/email/EmailRouter.module.css
similarity index 100%
rename from src/pages/chat/ChatRouter.module.css
rename to src/pages/email/EmailRouter.module.css
diff --git a/src/pages/chat/ChatRouter.tsx b/src/pages/email/EmailRouter.tsx
similarity index 54%
rename from src/pages/chat/ChatRouter.tsx
rename to src/pages/email/EmailRouter.tsx
index 58ab32a..4f67087 100644
--- a/src/pages/chat/ChatRouter.tsx
+++ b/src/pages/email/EmailRouter.tsx
@@ -1,24 +1,23 @@
import {Anchor, Breadcrumbs, Center} from "@mantine/core";
import {Link, Outlet, Route, Routes} from "react-router-dom";
-import classes from "./ChatRouter.module.css";
+import classes from "./EmailRouter.module.css";
-import ConversationSvg from "@/illustrations/conversation.svg?react";
+import EmailSVG from "@/illustrations/email.svg?react";
import {useMediaQuery} from "@mantine/hooks";
-import EventListMessagesList from "@/pages/chat/EventListMessagesList.tsx";
-import ListMessagesView from "@/pages/chat/ListMessagesView.tsx";
+import SentEmailsNavigation from "@/pages/email/SentEmailsNavigation.tsx";
import {usePB} from "@/lib/pocketbase.tsx";
import {useLogin} from "@/components/users/modals/hooks.ts";
-import Announcements from "@/pages/chat/components/Announcements.tsx";
import {useEffect} from "react";
-import SendAnnouncements from "@/pages/chat/components/SendAnnouncements.tsx";
+import NotFound from "@/pages/not-found/index.page.tsx";
+import EmailView from "@/pages/email/EmailView";
-const ChatIndex = () => {
+const EmailIndex = () => {
return
-
+
}
-export default function ChatRouter() {
+export default function EmailRouter() {
const isMobile = useMediaQuery("(max-width: 768px)")
const {user} = usePB()
@@ -38,7 +37,7 @@ export default function ChatRouter() {