diff --git a/src/components/common/CreatorCard.tsx b/src/components/common/CreatorCard.tsx index 82669935..c812e0af 100644 --- a/src/components/common/CreatorCard.tsx +++ b/src/components/common/CreatorCard.tsx @@ -2,8 +2,9 @@ import { useAccount } from 'wagmi'; import { Button } from '@/components/ui/button'; import type { Course } from '@/services/course.service'; import { cn } from '@/lib/utils'; -import { ShoppingCart, Wallet } from 'lucide-react'; +import { ShoppingCart, Wallet, Link as LinkIcon } from 'lucide-react'; import toast from 'react-hot-toast'; +import showToast from '@/utils/toast.util'; interface CreatorCardProps { creator: Course; @@ -22,10 +23,14 @@ const CreatorCard: React.FC = ({ creator, className }) => { return; } - toast.success(`Purchasing keys for ${creator.title}...`, { - duration: 3000, - }); + showToast.loading(`Purchasing keys for ${creator.title}...`); // Implementation for contract interaction would go here + setTimeout(() => { + showToast.transactionSuccess( + 'Purchase Successful!', + `You successfully bought a key for ${creator.title}` + ); + }, 1500); }; return ( @@ -51,6 +56,17 @@ const CreatorCard: React.FC = ({ creator, className }) => {

@{creator.instructorId || 'creator'}

+ {creator.socialHandle ? ( +
+ + @{creator.socialHandle} +
+ ) : ( +
+ + No public handle +
+ )}
diff --git a/src/services/course.service.ts b/src/services/course.service.ts index 8407ba5c..ca1e377f 100644 --- a/src/services/course.service.ts +++ b/src/services/course.service.ts @@ -10,6 +10,7 @@ export interface Course { thumbnail?: string; category: string; level: 'BEGINNER' | 'INTERMEDIATE' | 'ADVANCED'; + socialHandle?: string; } export interface GetCoursesParams { diff --git a/src/utils/toast.util.ts b/src/utils/toast.util.ts deleted file mode 100644 index 1e29ebaa..00000000 --- a/src/utils/toast.util.ts +++ /dev/null @@ -1,22 +0,0 @@ -import toast from "react-hot-toast"; - -const showToast = { - message: (message: string) => { - toast.remove(); - toast(message); - }, - success: (message: string) => { - toast.remove(); - toast.success(message); - }, - error: (message: string) => { - toast.remove(); - toast.error(message); - }, - loading: (message: string) => { - toast.remove(); - toast.loading(message); - }, -}; - -export default showToast; diff --git a/src/utils/toast.util.tsx b/src/utils/toast.util.tsx new file mode 100644 index 00000000..9688dc56 --- /dev/null +++ b/src/utils/toast.util.tsx @@ -0,0 +1,47 @@ +import toast from "react-hot-toast"; + +const showToast = { + message: (message: string) => { + toast.remove(); + toast(message); + }, + success: (message: string) => { + toast.remove(); + toast.success(message); + }, + error: (message: string) => { + toast.remove(); + toast.error(message); + }, + loading: (message: string) => { + toast.remove(); + toast.loading(message); + }, + transactionSuccess: (title: string, message?: string) => { + toast.remove(); + toast.custom((t) => ( +
+
+
+
+

+ {title} +

+ {message && ( +

+ {message} +

+ )} +
+
+
+
+ ), { duration: 4000 }); + }, +}; + +export default showToast;