handleItemClick(title, "MM")}
- selectedTitle={selectedMMTitle}
books={books}
/>
)}
diff --git a/src/pages/DataStudio.jsx b/src/pages/DataStudio.jsx
new file mode 100644
index 0000000..5efb649
--- /dev/null
+++ b/src/pages/DataStudio.jsx
@@ -0,0 +1,83 @@
+import { DndContext, DragOverlay } from "@dnd-kit/core";
+import { useState } from "react";
+import { Box, Flex, Text } from "@chakra-ui/react";
+import ItemGrid from "../components/DataStudio/ItemGrid.jsx";
+import ItemGroups from "../components/DataStudio/ItemGroups.jsx";
+import CardItem from "../components/Catalogue/cardItem.jsx";
+
+function DataStudio() {
+ const [droppedItems, setDroppedItems] = useState({});
+ const [activeItem, setActiveItem] = useState(null);
+
+ const handleDragStart = (event) => {
+ setActiveItem(event.active.data.current);
+ };
+
+ const handleDragEnd = (event) => {
+ const { active, over } = event;
+ setActiveItem(null);
+
+ if (over && active) {
+ const groupId = over.id;
+ const itemId = active.id;
+
+ setDroppedItems((prev) => {
+ // Avoid duplicates by checking if item already exists in the group
+ const existingItems = prev[groupId] || [];
+ if (existingItems.some((item) => item.id === itemId)) {
+ return prev;
+ }
+
+ return {
+ ...prev,
+ [groupId]: [...existingItems, active.data.current],
+ };
+ });
+ }
+ };
+
+ return (
+
+
+ {/* Left Panel (Draggable Items) */}
+
+
+ Data Studio
+ Batch
+
+
+
+
+
+
+ {/* Right Panel (Droppable Groups) */}
+
+
+
+
+
+ {/* Drag Preview */}
+
+ {activeItem ? (
+
+
+
+ ) : null}
+
+
+ );
+}
+
+export default DataStudio;
\ No newline at end of file
diff --git a/src/pages/GroupView.jsx b/src/pages/GroupView.jsx
new file mode 100644
index 0000000..575240f
--- /dev/null
+++ b/src/pages/GroupView.jsx
@@ -0,0 +1,9 @@
+import { useParams } from 'react-router-dom';
+
+function GroupView() {
+ const { artID, colID } = useParams();
+
+ return GroupView for collection {colID}, {artID}
;
+}
+
+export default GroupView;
diff --git a/src/pages/PublicGallery.jsx b/src/pages/PublicGallery.jsx
index de291d6..99d438c 100644
--- a/src/pages/PublicGallery.jsx
+++ b/src/pages/PublicGallery.jsx
@@ -1,42 +1,48 @@
import { Box, Text, Center } from "@chakra-ui/react";
import { useEffect, useState } from "react";
-import server, { JSONResponse } from '../networking'
+import server, { JSONResponse } from "../networking";
import Section from "../components/Catalogue/section.jsx";
import ProfileSection from "../components/Catalogue/ProfileSection.jsx";
-import CentredSpinner from "../components/centredSpinner.jsx";
+import CentredSpinner from "../components/CentredSpinner.jsx";
+import ToastWizard from "../components/toastWizard.js";
function PublicGallery() {
const [categories, setCategories] = useState({});
const [loading, setLoading] = useState(true);
- async function fetchCatalogue() {
+ const fetchCatalogue = async () => {
try {
const res = await server.get("/cdn/catalogue");
const data = res.data;
if (!(data instanceof JSONResponse) || data.isErrorStatus()) {
- ToastWizard.standard("error", "An error occurred", "Please try again later");
+ ToastWizard.standard(
+ "error",
+ "Couldn’t load gallery",
+ "Please try again later."
+ );
return;
}
- const { categories = {}, books = [] } = data.raw.data || {};
+ const { categories = {} } = data.raw.data || {};
setCategories(categories);
- setBooks(books.map(book => ({
- ...book,
- artefacts: book.mmArtefacts || [],
- })));
} catch (err) {
- ToastWizard.standard("error", "An error occurred", "Please try again later");
+ ToastWizard.standard(
+ "error",
+ "Connection issue",
+ "We couldn’t load the gallery. Please check your connection."
+ );
} finally {
setLoading(false);
}
- }
+ };
useEffect(() => {
fetchCatalogue();
}, []);
- const hasCategories = Object.keys(categories).length > 0;
+ const hasCategories =
+ categories && Object.values(categories).some(cat => Array.isArray(cat) && cat.length > 0);
if (loading) {
return ;
@@ -46,7 +52,7 @@ function PublicGallery() {
return (
- No Items Uploaded
+ No items uploaded yet.
);
@@ -60,7 +66,7 @@ function PublicGallery() {
))}