diff --git a/src/components/elements/favorites-list.tsx b/src/components/elements/favorites-list.tsx index bfd080bf..e3c7634b 100644 --- a/src/components/elements/favorites-list.tsx +++ b/src/components/elements/favorites-list.tsx @@ -1,10 +1,56 @@ "use client"; import useFavorites from "@lib/hooks/useFavorites"; -import {ChatBubbleLeftEllipsisIcon, ClipboardDocumentIcon, EnvelopeIcon, HeartIcon} from "@heroicons/react/24/outline"; +import { ChatBubbleLeftEllipsisIcon, ClipboardDocumentIcon, EnvelopeIcon, HeartIcon} from "@heroicons/react/24/outline"; import {useIsClient} from "usehooks-ts"; import { XMarkIcon } from "@heroicons/react/20/solid"; +const ShareButtons = () => { + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(window.location.href); + alert("URL copied to clipboard!"); + } catch (error) { + console.error("Failed to copy URL: ", error); + alert("Failed to copy URL. Please try again."); + } + }; + + const handleSendEmail = () => { + const subject = "Check out these summer courses!"; + const body = `Here is the link: ${window.location.href}`; + window.location.href = `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`; + }; + + const handleSendSMS = () => { + const body = `Check out this link: ${window.location.href}`; + window.location.href = `sms:?body=${encodeURIComponent(body)}`; + }; + + return ( + <> + + + + + ); +}; + const FavoritesList = () => { const { favs, removeFav } = useFavorites(); @@ -16,22 +62,22 @@ const FavoritesList = () => { return (
-
Favorites
+
Favorites List
{favs.length > 0 ? <> -
+
Total units {totalUnits}
@@ -43,25 +89,7 @@ const FavoritesList = () => {
}
- {/* Shareable options: Text, Email, Copy Link */} - - - +
); diff --git a/src/components/paragraphs/sum-course-filter/course-filtering-form.tsx b/src/components/paragraphs/sum-course-filter/course-filtering-form.tsx index 8d86e161..4d0d700a 100644 --- a/src/components/paragraphs/sum-course-filter/course-filtering-form.tsx +++ b/src/components/paragraphs/sum-course-filter/course-filtering-form.tsx @@ -15,6 +15,7 @@ import {RefinementListItem} from "instantsearch.js/es/connectors/refinement-list import {clsx} from "clsx"; import {AlgoliaHit} from "@components/algolia-results/default"; import SummerCourse from "@components/algolia-results/summer-course/summer-course"; +import FavoritesList from "@components/elements/favorites-list"; type Props = { appId: string @@ -197,7 +198,9 @@ const SearchForm = () => { -

Favorites List

+
+ +