Refactor Org Inbox Context and Enhance Club Creation Management
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Failing after 1m21s
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Successful in 42s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Failing after 1m21s
- Updated the OrgInboxContext to include handling for club creation requests, allowing for better management of inbox items. - Refactored components to utilize the new `canShowInboxNav` and `canAccessClubCreationInbox` flags for improved access control. - Enhanced the InboxPage to display club creation requests with appropriate actions for approval and rejection. - Updated the DashboardOrgInboxWidget to show both club creation and join requests, improving the user interface for managing inbox items.
This commit is contained in:
1 parent
8ee8f52e0f
commit
37785135b1
5 files changed
+206
-28
No files matched your search
@@ -6,11 +6,30 @@ 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()
|
||||
const {
|
||||
canShowInboxNav,
|
||||
inboxJoinRequests,
|
||||
inboxClubCreationRequests,
|
||||
clubCreationRequestCount,
|
||||
inboxCount,
|
||||
} = useOrgInbox()
|
||||
|
||||
if (!canAccessOrgInbox) return null
|
||||
if (!canShowInboxNav) return null
|
||||
|
||||
const preview = (inboxJoinRequests || []).slice(0, 5)
|
||||
const preview = [
|
||||
...(inboxClubCreationRequests || []).map((req) => ({
|
||||
key: `creation-${req.id}`,
|
||||
club: req.proposed_name || 'Neuer Verein',
|
||||
applicant: req.applicant_name || req.applicant_email || 'Antragsteller/in',
|
||||
kind: 'creation',
|
||||
})),
|
||||
...(inboxJoinRequests || []).map((req) => ({
|
||||
key: `${req.club_id}-${req.id}`,
|
||||
club: req.club_name || 'Verein',
|
||||
applicant: req.applicant_name || req.applicant_email || 'Bewerber/in',
|
||||
kind: 'join',
|
||||
})),
|
||||
].slice(0, 5)
|
||||
|
||||
return (
|
||||
<section
|
||||
@@ -31,17 +50,27 @@ export default function DashboardOrgInboxWidget() {
|
||||
</div>
|
||||
<p className="muted dashboard-org-inbox-widget__lead">
|
||||
{inboxCount === 0
|
||||
? 'Keine offenen Beitrittsanträge.'
|
||||
: `${inboxCount} offene Beitrittsantrag${inboxCount === 1 ? '' : 'e'}.`}
|
||||
? 'Keine offenen Anträge.'
|
||||
: [
|
||||
clubCreationRequestCount > 0
|
||||
? `${clubCreationRequestCount} Gründungsantrag${clubCreationRequestCount === 1 ? '' : 'e'}`
|
||||
: null,
|
||||
(inboxJoinRequests || []).length > 0
|
||||
? `${(inboxJoinRequests || []).length} Beitrittsantrag${(inboxJoinRequests || []).length === 1 ? '' : 'e'}`
|
||||
: null,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' · ')}
|
||||
</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'}
|
||||
<li key={req.key} className="dashboard-org-inbox-widget__item">
|
||||
<span className="dashboard-org-inbox-widget__club">
|
||||
{req.kind === 'creation' ? 'Gründung: ' : ''}
|
||||
{req.club}
|
||||
</span>
|
||||
<span className="dashboard-org-inbox-widget__applicant">{req.applicant}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -19,9 +19,9 @@ export default function DesktopSidebar({
|
||||
onLogout
|
||||
}) {
|
||||
const loc = useLocation()
|
||||
const { canAccessOrgInbox, inboxCount } = useOrgInbox()
|
||||
const { canShowInboxNav, inboxCount } = useOrgInbox()
|
||||
const items = getMainNavItems(showAdminNav, {
|
||||
showInbox: canAccessOrgInbox,
|
||||
showInbox: canShowInboxNav,
|
||||
onboardingOnly,
|
||||
})
|
||||
const tier = user?.tier || ''
|
||||
|
||||
Reference in new issue
Block a user