diff --git a/Pasted image.png b/Pasted image.png new file mode 100644 index 0000000..caf7ed2 Binary files /dev/null and b/Pasted image.png differ diff --git a/backend/holy_backend/settings.py b/backend/holy_backend/settings.py index f5168d5..ff73469 100644 --- a/backend/holy_backend/settings.py +++ b/backend/holy_backend/settings.py @@ -69,7 +69,7 @@ ROOT_URLCONF = 'holy_backend.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [os.path.join(BASE_DIR, '..', 'frontend', 'dist')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -142,6 +142,7 @@ USE_TZ = True STATIC_URL = 'static/' STATIC_ROOT = BASE_DIR / 'staticfiles' +STATICFILES_DIRS = [os.path.join(BASE_DIR, '..', 'frontend', 'dist')] STATICFILES_STORAGE = 'whitenoise.storage.CompressedStaticFilesStorage' WHITENOISE_INDEX_PAGE = True diff --git a/backend/holy_backend/urls.py b/backend/holy_backend/urls.py index ce0dbf7..acc148f 100644 --- a/backend/holy_backend/urls.py +++ b/backend/holy_backend/urls.py @@ -5,15 +5,14 @@ from rest_framework.authtoken.views import obtain_auth_token from django.conf import settings from django.conf.urls.static import static from django.views.static import serve -from django.views.static import serve -from django.conf import settings +from django.views.generic.base import TemplateView import os # Clean the admin path admin_url = os.environ.get('ADMIN_URL', 'admin').strip('/') -def serve_index(request, resource=None): - return serve(request, 'index.html', document_root=settings.STATIC_ROOT) +# Catch-all view for React +index_view = TemplateView.as_view(template_name="index.html") urlpatterns = [ # Robots.txt @@ -30,6 +29,6 @@ urlpatterns = [ path('media/', serve, {'document_root': settings.MEDIA_ROOT}), # Catch-all for React Frontend - path('', serve_index, name='index'), - path('', serve_index), + path('', index_view, name='index'), + path('', index_view), ] diff --git a/frontend/src/pages/AdminDashboard.tsx b/frontend/src/pages/AdminDashboard.tsx index 240aaac..7afd594 100644 --- a/frontend/src/pages/AdminDashboard.tsx +++ b/frontend/src/pages/AdminDashboard.tsx @@ -11,7 +11,6 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import SettingsIcon from '@mui/icons-material/Settings'; import PeopleIcon from '@mui/icons-material/People'; import WallpaperIcon from '@mui/icons-material/Wallpaper'; -import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import api from '../api'; @@ -273,7 +272,7 @@ const AdminDashboard: React.FC = () => { {currentTab === 2 && ( - {t('admin.banners')} + {t('admin.banners')} ({banners.length}) {banners.length === 0 ? ( @@ -287,57 +286,44 @@ const AdminDashboard: React.FC = () => { ) : ( - + {banners.map((banner) => ( - - - {banner.is_active && ( - } - label="Active" - color="success" - size="small" - sx={{ position: 'absolute', top: 12, right: 12, zIndex: 2 }} - /> - )} - - {banner.name} - {banner.description} - - - Settings: -
-                                                    {JSON.stringify(banner.settings, null, 2)}
-                                                
-
-
- - + + + + {banner.name} (Slug: {banner.slug}) + {banner.is_active && } + + + {banner.description} + + +
{JSON.stringify(banner.settings, null, 2)}
+
+ + + + {!banner.is_active && ( - - -
-
-
+ )} +
+ + ))} -
+ )}
)}