Fix breadcrumb navigation links and add request management dialog functionality (clicking row brings up modal w/ related details)
This commit is contained in:
@@ -2,8 +2,8 @@ import React from "react";
|
|||||||
|
|
||||||
export default function BreadcrumbNav({ currentPage }) {
|
export default function BreadcrumbNav({ currentPage }) {
|
||||||
const pages = [
|
const pages = [
|
||||||
{ key: "request", label: "Request Media", href: "../" },
|
{ key: "request", label: "Request Media", href: "/qs2" },
|
||||||
{ key: "management", label: "Manage Requests", href: "requests" },
|
{ key: "management", label: "Manage Requests", href: "/qs2/requests" },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -4,6 +4,7 @@ import { Column } from "primereact/column";
|
|||||||
import { Dropdown } from "primereact/dropdown";
|
import { Dropdown } from "primereact/dropdown";
|
||||||
import { Button } from "@mui/joy";
|
import { Button } from "@mui/joy";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
import { Dialog } from "primereact/dialog";
|
||||||
import { confirmDialog, ConfirmDialog } from "primereact/confirmdialog";
|
import { confirmDialog, ConfirmDialog } from "primereact/confirmdialog";
|
||||||
import BreadcrumbNav from "./BreadcrumbNav";
|
import BreadcrumbNav from "./BreadcrumbNav";
|
||||||
|
|
||||||
@@ -19,14 +20,11 @@ const initialRequests = [
|
|||||||
album: "",
|
album: "",
|
||||||
track: "",
|
track: "",
|
||||||
status: "Pending",
|
status: "Pending",
|
||||||
},
|
details: {
|
||||||
{
|
requestedBy: "codey",
|
||||||
id: 2,
|
timestamp: "2025-07-01T12:00:00Z",
|
||||||
type: "Album",
|
comments: "",
|
||||||
artist: "Pink Floyd",
|
},
|
||||||
album: "Dark Side of the Moon",
|
|
||||||
track: "",
|
|
||||||
status: "Completed",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
@@ -35,22 +33,36 @@ const initialRequests = [
|
|||||||
album: "Das Album",
|
album: "Das Album",
|
||||||
track: "20 km/h",
|
track: "20 km/h",
|
||||||
status: "Failed",
|
status: "Failed",
|
||||||
|
details: {
|
||||||
|
requestedBy: "codey",
|
||||||
|
timestamp: "2025-06-11T09:00:00Z",
|
||||||
|
comments: "Track not found in external database.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 3,
|
||||||
type: "Track",
|
type: "Track",
|
||||||
artist: "Chappell Roan",
|
artist: "We Butter The Bread With Butter",
|
||||||
album: "Pink Pony Club",
|
album: "Das Album",
|
||||||
track: "Pink Pony Club",
|
track: "20 km/h",
|
||||||
status: "Completed",
|
status: "Completed",
|
||||||
|
details: {
|
||||||
|
requestedBy: "codey",
|
||||||
|
timestamp: "2025-06-11T09:00:00Z",
|
||||||
|
comments: "Track retrieved succesfully.",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
export default function RequestManagement() {
|
export default function RequestManagement() {
|
||||||
const [requests, setRequests] = useState(initialRequests);
|
const [requests, setRequests] = useState(initialRequests);
|
||||||
const [filterType, setFilterType] = useState(null);
|
const [filterType, setFilterType] = useState(null);
|
||||||
const [filterStatus, setFilterStatus] = useState(null);
|
const [filterStatus, setFilterStatus] = useState(null);
|
||||||
const [filteredRequests, setFilteredRequests] = useState(initialRequests);
|
const [filteredRequests, setFilteredRequests] = useState(initialRequests);
|
||||||
|
const [selectedRequest, setSelectedRequest] = useState(null);
|
||||||
|
const [isDialogVisible, setIsDialogVisible] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let filtered = [...requests];
|
let filtered = [...requests];
|
||||||
@@ -329,6 +341,32 @@ export default function RequestManagement() {
|
|||||||
[data-theme='dark'] .p-dialog-header-icon {
|
[data-theme='dark'] .p-dialog-header-icon {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
/* PrimeReact Dialog Theming */
|
||||||
|
.p-dialog {
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] .p-dialog {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] .p-dialog .p-dialog-header {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
border-bottom: 1px solid #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] .p-dialog .p-dialog-content {
|
||||||
|
background-color: #2a2a2a;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] .p-dialog .p-dialog-footer {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
border-top: 1px solid #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
`}</style>
|
`}</style>
|
||||||
<BreadcrumbNav currentPage="management" />
|
<BreadcrumbNav currentPage="management" />
|
||||||
@@ -368,6 +406,10 @@ export default function RequestManagement() {
|
|||||||
emptyMessage="No requests found."
|
emptyMessage="No requests found."
|
||||||
rowClassName="!py-4"
|
rowClassName="!py-4"
|
||||||
className="min-w-full bg-white dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100"
|
className="min-w-full bg-white dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100"
|
||||||
|
onRowClick={(e) => {
|
||||||
|
setSelectedRequest(e.data);
|
||||||
|
setIsDialogVisible(true);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Column field="id" header="ID" sortable style={{ width: "5rem" }} />
|
<Column field="id" header="ID" sortable style={{ width: "5rem" }} />
|
||||||
<Column field="type" header="Type" sortable />
|
<Column field="type" header="Type" sortable />
|
||||||
@@ -388,6 +430,35 @@ export default function RequestManagement() {
|
|||||||
/>
|
/>
|
||||||
</DataTable>
|
</DataTable>
|
||||||
<ConfirmDialog />
|
<ConfirmDialog />
|
||||||
|
<Dialog
|
||||||
|
header="Request Details"
|
||||||
|
visible={isDialogVisible}
|
||||||
|
style={{ width: "500px" }}
|
||||||
|
onHide={() => setIsDialogVisible(false)}
|
||||||
|
breakpoints={{ '960px': '95vw' }}
|
||||||
|
>
|
||||||
|
{selectedRequest && (
|
||||||
|
<div className="space-y-4 text-sm">
|
||||||
|
<p><strong>ID:</strong> {selectedRequest.id}</p>
|
||||||
|
<p><strong>Type:</strong> {selectedRequest.type}</p>
|
||||||
|
<p><strong>Artist:</strong> {selectedRequest.artist}</p>
|
||||||
|
{selectedRequest.album && <p><strong>Album:</strong> {selectedRequest.album}</p>}
|
||||||
|
{selectedRequest.track && <p><strong>Track:</strong> {selectedRequest.track}</p>}
|
||||||
|
<p><strong>Status:</strong> {selectedRequest.status}</p>
|
||||||
|
{selectedRequest.details && (
|
||||||
|
<>
|
||||||
|
<p><strong>Requested By:</strong> {selectedRequest.details.requestedBy}</p>
|
||||||
|
<p><strong>Timestamp:</strong> {new Date(selectedRequest.details.timestamp).toLocaleString()}</p>
|
||||||
|
{selectedRequest.details.comments && (
|
||||||
|
<p><strong>Comments:</strong> {selectedRequest.details.comments}</p>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user