Skip to content

Commit f219b25

Browse files
martinvibesmartinvibes
andauthored
feat: enhance user management dashboard with new components and notifications (#81)
Co-authored-by: martinvibes <martinmachiebe21@gmail>
1 parent a95ed20 commit f219b25

9 files changed

Lines changed: 1135 additions & 21 deletions

File tree

public/strk.png.svg

Lines changed: 9 additions & 0 deletions
Loading

src/app/dashboard/admin/user-management/readers/[id]/page.tsx

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import Image from "next/image";
77

88
import { Header } from "@/components/dashboard/header";
99
import reader1_img from "@/assets/images/reader1.png";
10+
import DirectNotificationContent from "@/components/dashboard/DirectNotificationContent";
11+
import ReviewsAndFeedbackContent from "@/components/dashboard/ReviewsAndFeedbackContent";
12+
import TransactionContent from "@/components/dashboard/TransactionContent";
1013

1114
import { Search } from "lucide-react";
1215

@@ -67,9 +70,9 @@ const UserProfilePage = () => {
6770
const [activeTab, setActiveTab] = useState("Library");
6871
const [activeFilter, setActiveFilter] = useState("All");
6972

70-
const setShowModal = (show: boolean) => {
73+
const setShowModal = (show: boolean) => {
7174
setSuspendModalOpen(show);
72-
}
75+
};
7376

7477
const stats = [
7578
{ label: "Following", value: "4", color: "text-blue-600" },
@@ -229,9 +232,11 @@ const UserProfilePage = () => {
229232
return (
230233
<>
231234
<Header title="Reader's Profile" />
232-
{suspendModalOpen && <div className="min-h-screen h-full p-4 md:p-6 absolute top-0 left-0 right-0 z-50">
233-
<SuspendUserModal setShow={setShowModal} />
234-
</div>}
235+
{suspendModalOpen && (
236+
<div className="min-h-screen h-full p-4 md:p-6 absolute top-0 left-0 right-0 z-50">
237+
<SuspendUserModal setShow={setShowModal} />
238+
</div>
239+
)}
235240
<div className="min-h-screen bg-gray-50 p-4 md:p-6">
236241
<div className="w-full mx-auto">
237242
{/* Header Section */}
@@ -290,7 +295,10 @@ const UserProfilePage = () => {
290295
{/* Stats Grid */}
291296
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mt-12">
292297
{stats.map((stat, index) => (
293-
<div key={index} className=" border p-4 rounded-lg">
298+
<div
299+
key={index}
300+
className=" border border-[#E9F7FF] p-4 rounded-lg"
301+
>
294302
<div className="text-sm text-gray-500 mt-1 mb-2">
295303
{stat.label}
296304
</div>
@@ -340,7 +348,10 @@ const UserProfilePage = () => {
340348
{/* Library Stats */}
341349
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
342350
{libraryStats.map((stat, index) => (
343-
<div key={index} className=" border p-6 rounded-lg">
351+
<div
352+
key={index}
353+
className=" border border-[#E9F7FF] p-6 rounded-lg"
354+
>
344355
<div className="text-xs text-gray-500">{stat.label}</div>
345356

346357
<div className="text-lg font-bold text-gray-700">
@@ -388,14 +399,30 @@ const UserProfilePage = () => {
388399
</div>
389400
)}
390401

402+
{/* Direct Notification Content */}
403+
{activeTab === "Direct Notification" && (
404+
<DirectNotificationContent />
405+
)}
406+
407+
{/* Transaction Content */}
408+
{activeTab === "Transactions" && <TransactionContent />}
409+
410+
{/* Reviews & Feedback Content */}
411+
{activeTab === "Reviews & Feedback" && (
412+
<ReviewsAndFeedbackContent />
413+
)}
414+
391415
{/* Other Tab Contents */}
392-
{activeTab !== "Library" && (
393-
<div className="p-6">
394-
<div className="text-center text-gray-500 py-8">
395-
{activeTab} content would go here
416+
{activeTab !== "Library" &&
417+
activeTab !== "Direct Notification" &&
418+
activeTab !== "Transactions" &&
419+
activeTab !== "Reviews & Feedback" && (
420+
<div className="p-6">
421+
<div className="text-center text-gray-500 py-8">
422+
{activeTab} content would go here
423+
</div>
396424
</div>
397-
</div>
398-
)}
425+
)}
399426
</div>
400427
</div>
401428
</div>

src/components/blockchain/wallet-connect-context.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
"use client"
2-
import React, { createContext, useContext, ReactNode, useState, useEffect } from "react";
1+
"use client";
2+
import React, {
3+
createContext,
4+
useContext,
5+
ReactNode,
6+
useState,
7+
useEffect,
8+
} from "react";
39
import { AccountStatus, useAccount, useConnect } from "@starknet-react/core";
410

511
// Define the context type
@@ -27,13 +33,13 @@ export function WalletProvider({ children }: { children: ReactNode }) {
2733

2834
// Check if any wallet is available in the browser
2935
useEffect(() => {
30-
const hasWallet = connectors.some(connector => connector.available());
36+
const hasWallet = connectors.some((connector) => connector.available());
3137
setIsWalletDetected(hasWallet);
3238
}, [connectors]);
3339

3440
// Handle connection errors
3541
useEffect(() => {
36-
if (status === "error" as AccountStatus) {
42+
if (status === ("error" as AccountStatus)) {
3743
setError(new Error("Failed to connect wallet"));
3844
} else {
3945
setError(null);
@@ -59,13 +65,11 @@ export function WalletProvider({ children }: { children: ReactNode }) {
5965
error,
6066
isModalOpen,
6167
openConnectModal,
62-
closeConnectModal
68+
closeConnectModal,
6369
};
6470

6571
return (
66-
<WalletContext.Provider value={value}>
67-
{children}
68-
</WalletContext.Provider>
72+
<WalletContext.Provider value={value}>{children}</WalletContext.Provider>
6973
);
7074
}
7175

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
"use client";
2+
3+
import React from "react";
4+
5+
interface DeleteReviewModalProps {
6+
isOpen: boolean;
7+
onClose: () => void;
8+
onConfirm: () => void;
9+
review?: {
10+
id: string;
11+
bookTitle: string;
12+
author: string;
13+
reviewerName: string;
14+
rating: number;
15+
reviewText: string;
16+
} | null;
17+
}
18+
19+
const DeleteReviewModal: React.FC<DeleteReviewModalProps> = ({
20+
isOpen,
21+
onClose,
22+
onConfirm,
23+
review,
24+
}) => {
25+
if (!isOpen || !review) return null;
26+
27+
return (
28+
<div className="fixed inset-0 z-50 flex items-center justify-center bg-[#00000098] bg-opacity-50">
29+
<div className="bg-white rounded-lg max-w-md w-full mx-4 p-6">
30+
{/* Warning Icon */}
31+
<div className="flex justify-center mb-6">
32+
<div className="w-24 h-24 bg-gray-100 rounded-full flex items-center justify-center">
33+
<div className="w-20 h-20 bg-gray-600 rounded-full flex items-center justify-center">
34+
<div className="w-10 h-10 bg-gray-800 rounded-sm flex items-center justify-center">
35+
<span className="text-white text-xl font-bold">!</span>
36+
</div>
37+
</div>
38+
</div>
39+
</div>
40+
41+
{/* Warning Message */}
42+
<div className="text-center mb-8 px-8">
43+
<p className="text-gray-700 leading-relaxed">
44+
You are about to delete{" "}
45+
<span className="text-blue-600 font-medium">
46+
@{review.reviewerName}'s
47+
</span>{" "}
48+
Review on the book{" "}
49+
<span className="font-medium">
50+
{review.bookTitle} by {review.author}
51+
</span>
52+
</p>
53+
</div>
54+
55+
{/* Action Buttons */}
56+
<div className="flex items-center justify-center gap-4">
57+
<button
58+
onClick={onConfirm}
59+
className="px-6 py-2 bg-blue-100 text-blue-600 rounded-lg hover:bg-blue-200 transition-colors font-medium"
60+
>
61+
Delete
62+
</button>
63+
<button
64+
onClick={onClose}
65+
className="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium"
66+
>
67+
Cancel
68+
</button>
69+
</div>
70+
</div>
71+
</div>
72+
);
73+
};
74+
75+
export default DeleteReviewModal;

0 commit comments

Comments
 (0)