From 39f80846713dad9033b1a54e922493506ed3002b Mon Sep 17 00:00:00 2001 From: avvvvvv Date: Tue, 19 Nov 2024 15:45:25 +0100 Subject: [PATCH] Feature/calendar updates (#151) * add copy handles button to insta text popup * add back button to daily schedule generator --- pages/admin/daily-schedule-generator.tsx | 86 +++++++++++------------- views/admin/calendarInsta.tsx | 49 ++++++++++---- 2 files changed, 77 insertions(+), 58 deletions(-) diff --git a/pages/admin/daily-schedule-generator.tsx b/pages/admin/daily-schedule-generator.tsx index 49b9c40..f114610 100644 --- a/pages/admin/daily-schedule-generator.tsx +++ b/pages/admin/daily-schedule-generator.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from "react"; import { NextPage } from "next"; import { TfiReload, TfiDownload } from "react-icons/tfi"; import { AiOutlineLoading3Quarters } from "react-icons/ai"; - +import BackButton from "../../components/backButton"; const ScheduleArtworkPage: NextPage & { getLayout?: (page: React.ReactNode) => React.ReactNode; } = () => { @@ -34,51 +34,28 @@ const ScheduleArtworkPage: NextPage & { }, []); return ( -
-
- {imageUrl ? ( - Schedule Artwork - ) : ( -

Loading...

- )} -
+
+
+
-
- - {imageUrl && ( +

Loading...

+ )} +
+
+
- )} + {imageUrl && ( + + )} +
); diff --git a/views/admin/calendarInsta.tsx b/views/admin/calendarInsta.tsx index cd5237e..a132718 100644 --- a/views/admin/calendarInsta.tsx +++ b/views/admin/calendarInsta.tsx @@ -8,6 +8,7 @@ import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; import timezone from "dayjs/plugin/timezone"; import { useRef } from "react"; +import toast from "react-hot-toast"; dayjs.extend(utc); dayjs.extend(timezone); @@ -17,6 +18,7 @@ export default function CalendarInsta() { const [data, setData] = useState(null); const [isLoading, setLoading] = useState(true); const instaText = useRef(null); + const instaHandles = useRef(null); const [copied, setCopied] = useState(false); useEffect(() => { @@ -32,10 +34,21 @@ export default function CalendarInsta() { navigator.clipboard .writeText(instaText.current?.innerText) .then(() => { - setCopied(true); + toast.success("Copied to your clipboard"); }) .catch(() => { - alert("something went wrong"); + toast.error("Uh oh, something went wrong :/"); + }); + }; + + const copyHandles = () => { + navigator.clipboard + .writeText(instaHandles.current?.innerText) + .then(() => { + toast.success("Copied to your clipboard"); + }) + .catch(() => { + toast.error("Uh oh, something went wrong :/"); }); }; @@ -100,18 +113,28 @@ export default function CalendarInsta() {
🎙Roll call:
- {data.map((show) => ( - <> - {show.instagramHandles}
- - ))} +
+ {data.map((show) => ( + <> + {show.instagramHandles}
+ + ))} +

- +
+ + +
)}