from __future__ import annotations from typing import Any from django.conf import settings from django.http import HttpRequest from apps.profiles.models import SearchProfile def navigation_context(request: HttpRequest) -> dict[str, Any]: match = request.resolver_match route_key = (match.namespace, match.url_name) if match else (None, None) page_contexts = { ("dashboard", "today"): "Dagoverzicht", ("dashboard", "system"): "Automatisering", ("jobs", "list"): "Vacatureverkenner", ("jobs", "detail"): "Vacatureanalyse", ("jobs", "applications"): "Sollicitatiepipeline", ("jobs", "application-edit"): "Sollicitatiedossier", ("jobs", "skill-insights"): "Skillsradar", ("jobs", "activity"): "Activiteit", ("jobs", "employers"): "Werkgevers", ("jobs", "employer-detail"): "Werkgeveranalyse", ("profiles", "list"): "Zoekprofiel", ("profiles", "edit"): "Radarconfiguratie", ("sources", "list"): "Bronbeheer", } context = { "app_name": "VacatureRadar", "app_version": "0.3.9", "app_owner_name": settings.VACATURERADAR_OWNER_NAME, "page_context_label": page_contexts.get(route_key, "Persoonlijke cockpit"), } if request.user.is_authenticated: context["navigation_profile"] = ( SearchProfile.objects.filter(user=request.user, is_active=True) .only("id", "name") .first() ) return context