From 8b508b39c0495b7b127ac0be25580d095eaa47f8 Mon Sep 17 00:00:00 2001 From: jude Date: Thu, 14 Dec 2023 17:14:09 +0000 Subject: [PATCH] Importer --- src/components/Guild/GuildReminders.tsx | 2 +- src/components/Guild/index.tsx | 11 +++- src/components/Import/index.tsx | 81 +++++++++++++++++++++++-- src/components/Sidebar/index.tsx | 7 +-- 4 files changed, 90 insertions(+), 11 deletions(-) diff --git a/src/components/Guild/GuildReminders.tsx b/src/components/Guild/GuildReminders.tsx index 7d3aaa4..ba0e9b6 100644 --- a/src/components/Guild/GuildReminders.tsx +++ b/src/components/Guild/GuildReminders.tsx @@ -26,7 +26,7 @@ export const GuildReminders = () => {
Create Reminder
- +


diff --git a/src/components/Guild/index.tsx b/src/components/Guild/index.tsx index e7aa5ea..d775884 100644 --- a/src/components/Guild/index.tsx +++ b/src/components/Guild/index.tsx @@ -3,6 +3,8 @@ import { fetchGuildInfo } from "../../api"; import { useParams } from "wouter"; import { GuildReminders } from "./GuildReminders"; import { GuildError } from "./GuildError"; +import { createPortal } from "preact/compat"; +import { Import } from "../Import"; export const Guild = () => { const { guild } = useParams(); @@ -13,6 +15,13 @@ export const Guild = () => { } else if (guildInfo.error) { return ; } else { - return ; + const importModal = createPortal(, document.getElementById("bottom-sidebar")); + + return ( + <> + {importModal} + + + ); } }; diff --git a/src/components/Import/index.tsx b/src/components/Import/index.tsx index ac5ed23..c113688 100644 --- a/src/components/Import/index.tsx +++ b/src/components/Import/index.tsx @@ -1,5 +1,8 @@ import { Modal } from "../Modal"; -import { useState } from "preact/hooks"; +import { useRef, useState } from "preact/hooks"; +import { useParams } from "wouter"; +import axios from "axios"; +import { useFlash } from "../App/FlashContext"; export const Import = () => { const [modalOpen, setModalOpen] = useState(false); @@ -24,6 +27,14 @@ export const Import = () => { }; const ImportModal = ({ setModalOpen }) => { + const { guild } = useParams(); + + const aRef = useRef(); + const inputRef = useRef(); + const flash = useFlash(); + + const [isImporting, setIsImporting] = useState(false); + return ( {
Please first read the support page
- -
- - + - + - +