diff --git a/frontend/src/App.js b/frontend/src/App.js index f6b5113..42bed25 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -5,6 +5,7 @@ import { BrowserRouter as Router, Switch, Route } from 'react-router-dom'; import UploadedImage from './Components/Pages/UploadedImagePage'; import MultiUploadPage from './Components/Pages/MultiUploadPage'; import SlideshowPage from './Components/Pages/SlideshowPage'; +import GroupsOverviewPage from './Components/Pages/GroupsOverviewPage'; import ModerationGroupsPage from './Components/Pages/ModerationGroupsPage'; import ModerationGroupImagesPage from './Components/Pages/ModerationGroupImagesPage'; import PublicGroupImagesPage from './Components/Pages/PublicGroupImagesPage'; @@ -18,7 +19,7 @@ function App() { - {/* Groups overview removed; public group listing is handled elsewhere. */} + @@ -27,4 +28,4 @@ function App() { ); } -export default App; +export default App; \ No newline at end of file diff --git a/frontend/src/Components/Pages/GroupsOverviewPage.js b/frontend/src/Components/Pages/GroupsOverviewPage.js new file mode 100644 index 0000000..2ad0100 --- /dev/null +++ b/frontend/src/Components/Pages/GroupsOverviewPage.js @@ -0,0 +1,201 @@ +import React, { useState, useEffect } from 'react'; +import { useHistory } from 'react-router-dom'; +import { Helmet } from 'react-helmet'; +import '../Pages/Css/GroupsOverviewPage.css'; +import { + Container, + Card, + CardContent, + Typography, + Button, + Grid, + CardMedia, + Box, + CircularProgress, + Chip +} from '@material-ui/core'; +import { + Slideshow as SlideshowIcon, + Add as AddIcon, + Home as HomeIcon +} from '@material-ui/icons'; +import Swal from 'sweetalert2/dist/sweetalert2.js'; + +// Components +import Navbar from '../ComponentUtils/Headers/Navbar'; +import Footer from '../ComponentUtils/Footer'; +import GroupCard from '../ComponentUtils/GroupCard'; + +// Utils +import { fetchAllGroups, deleteGroup } from '../../Utils/batchUpload'; + +// Styles +import '../../App.css'; + +function GroupsOverviewPage() { + // use CSS classes from GroupsOverviewPage.css + const history = useHistory(); + + const [groups, setGroups] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + loadGroups(); + }, []); + + const loadGroups = async () => { + try { + setLoading(true); + const response = await fetchAllGroups(); + setGroups(response.groups || []); + setError(null); + } catch (err) { + setError(err.message); + console.error('Error loading groups:', err); + } finally { + setLoading(false); + } + }; + + const handleViewSlideshow = (groupId) => { + history.push(`/slideshow/${groupId}`); + }; + + const handleCreateNew = () => { + history.push('/multi-upload'); + }; + + const handleGoHome = () => { + history.push('/'); + }; + + const formatDate = (dateString) => { + return new Date(dateString).toLocaleDateString('de-DE', { + year: 'numeric', + month: 'short', + day: 'numeric' + }); + }; + + if (loading) { + return ( +
+ + +
+ + + Slideshows werden geladen... + +
+
+
+
+ ); + } + + return ( +
+ + Gruppenübersicht - Interne Verwaltung + + + + + + + + {/* Header */} + + + Alle Slideshows + + + Verwalte deine hochgeladenen Bildersammlungen + + +
+ + + +
+
+ + {/* Groups Grid */} + {error ? ( +
+ + 😕 Fehler beim Laden + + + {error} + + +
+ ) : groups.length === 0 ? ( +
+ + 📸 Keine Slideshows vorhanden + + + Erstellen Sie Ihre erste Slideshow, indem Sie mehrere Bilder hochladen. + + +
+ ) : ( + <> + + + 📊 {groups.length} Slideshow{groups.length !== 1 ? 's' : ''} gefunden + + + +
+ {groups.map((group) => ( +
+ { /* no-op on public page */ }} + onViewImages={() => handleViewSlideshow(group.groupId)} + onDelete={() => { /* no-op on public page */ }} + isPending={false} + showActions={false} + /> +
+ ))} +
+ + )} +
+ +
+
+
+ ); +} + +export default GroupsOverviewPage; \ No newline at end of file