feat(org-inbox): implement join request inbox for platform and club admins
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 30s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 24s
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 30s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 7s
Test Suite / playwright-tests (push) Successful in 24s
- Added new API endpoint to retrieve join requests accessible by platform admins and club admins. - Implemented frontend components to display join requests in the inbox, including navigation updates and badge notifications. - Enhanced sidebar and navigation to conditionally show inbox based on user permissions. - Updated styles for inbox components and added responsive design for dashboard integration. - Introduced context management for inbox state and notifications on join request actions.
This commit is contained in:
1 parent
59fb8a5527
commit
58a38702b9
11 files changed
+631
-20
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { Inbox } from 'lucide-react'
|
||||
import { useOrgInbox } from '../context/OrgInboxContext'
|
||||
|
||||
/**
|
||||
* Desktop-Dashboard: Hinweis auf offene Beitrittsanträge (nur ab 1024px sichtbar via CSS).
|
||||
*/
|
||||
export default function DashboardOrgInboxWidget() {
|
||||
const { canAccessOrgInbox, inboxJoinRequests, inboxCount } = useOrgInbox()
|
||||
|
||||
if (!canAccessOrgInbox) return null
|
||||
|
||||
const preview = (inboxJoinRequests || []).slice(0, 5)
|
||||
|
||||
return (
|
||||
<section
|
||||
className="dashboard-org-inbox-widget"
|
||||
aria-labelledby="dash-org-inbox-title"
|
||||
>
|
||||
<div className="dashboard-org-inbox-widget__inner card">
|
||||
<div className="dashboard-org-inbox-widget__head">
|
||||
<h2 id="dash-org-inbox-title" className="dashboard-org-inbox-widget__title">
|
||||
<Inbox size={20} strokeWidth={2} aria-hidden className="dashboard-org-inbox-widget__icon" />
|
||||
Posteingang
|
||||
</h2>
|
||||
{inboxCount > 0 ? (
|
||||
<span className="dashboard-org-inbox-widget__badge" aria-live="polite">
|
||||
{inboxCount}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="muted dashboard-org-inbox-widget__lead">
|
||||
{inboxCount === 0
|
||||
? 'Keine offenen Beitrittsanträge.'
|
||||
: `${inboxCount} offene Beitrittsantrag${inboxCount === 1 ? '' : 'e'}.`}
|
||||
</p>
|
||||
{preview.length > 0 ? (
|
||||
<ul className="dashboard-org-inbox-widget__list">
|
||||
{preview.map((req) => (
|
||||
<li key={`${req.club_id}-${req.id}`} className="dashboard-org-inbox-widget__item">
|
||||
<span className="dashboard-org-inbox-widget__club">{req.club_name || 'Verein'}</span>
|
||||
<span className="dashboard-org-inbox-widget__applicant">
|
||||
{req.applicant_name || req.applicant_email || 'Bewerber/in'}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
<div className="dashboard-org-inbox-widget__footer">
|
||||
<Link to="/inbox" className="btn btn-secondary" style={{ textDecoration: 'none' }}>
|
||||
Zum Posteingang
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { NavLink, useLocation } from 'react-router-dom'
|
||||
import { LogOut } from 'lucide-react'
|
||||
import { getMainNavItems } from '../config/appNav'
|
||||
import { useOrgInbox } from '../context/OrgInboxContext'
|
||||
import ActiveClubSwitcher from './ActiveClubSwitcher'
|
||||
|
||||
function sidebarLinkActive(pathname, item, routerIsActive) {
|
||||
@@ -17,7 +18,8 @@ export default function DesktopSidebar({
|
||||
onLogout
|
||||
}) {
|
||||
const loc = useLocation()
|
||||
const items = getMainNavItems(isAdmin)
|
||||
const { canAccessOrgInbox, inboxCount } = useOrgInbox()
|
||||
const items = getMainNavItems(isAdmin, { showInbox: canAccessOrgInbox })
|
||||
const tier = user?.tier || ''
|
||||
|
||||
return (
|
||||
@@ -42,6 +44,11 @@ export default function DesktopSidebar({
|
||||
>
|
||||
<item.Icon size={20} strokeWidth={2} />
|
||||
<span>{item.label}</span>
|
||||
{item.to === '/inbox' && inboxCount > 0 ? (
|
||||
<span className="desktop-sidebar__badge" aria-label={`${inboxCount} offen`}>
|
||||
{inboxCount > 99 ? '99+' : inboxCount}
|
||||
</span>
|
||||
) : null}
|
||||
</NavLink>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
Reference in new issue
Block a user