[SPA] Angular app-shell + host/player routing skeleton (#157) #164

Merged
integrator-bot merged 6 commits from dev/issue-157-angular-shell-v2 into main 2026-03-01 13:14:30 +01:00
3 changed files with 34 additions and 0 deletions
Showing only changes of commit 5bdbdbd837 - Show all commits

View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="da">
<head>
<meta charset="utf-8">
<title>WPP SPA Shell</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="{{ spa_asset_base }}/styles.css">
</head>
<body data-wpp-shell-route="{{ shell_route }}">
<app-root>Indlæser Angular app-shell…</app-root>
<script src="{{ spa_asset_base }}/main.js" type="module"></script>
</body>
</html>

View File

@@ -1,14 +1,32 @@
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from fupogfakta.models import Category
def _render_spa_shell(request, shell_route: str):
return render(
request,
"lobby/spa_shell.html",
{
"shell_route": shell_route,
"spa_asset_base": settings.WPP_SPA_ASSET_BASE,
},
)
@login_required
def host_screen(request, spa_path=None):
if settings.WPP_SPA_ENABLED:
return _render_spa_shell(request, "/host")
categories = Category.objects.filter(is_active=True).order_by("name")
return render(request, "lobby/host_screen.html", {"categories": categories})
def player_screen(request):
if settings.WPP_SPA_ENABLED:
return _render_spa_shell(request, "/player")
return render(request, "lobby/player_screen.html")

View File

@@ -99,6 +99,9 @@ STATIC_ROOT = BASE_DIR / 'staticfiles'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
WPP_SPA_ENABLED = env('WPP_SPA_ENABLED', 'false').lower() == 'true'
WPP_SPA_ASSET_BASE = env('WPP_SPA_ASSET_BASE', '/static/frontend/angular/browser').rstrip('/')
CHANNEL_REDIS_HOST = env('CHANNEL_REDIS_HOST', '127.0.0.1')
CHANNEL_REDIS_PORT = int(env('CHANNEL_REDIS_PORT', '6379'))
CHANNEL_LAYERS = {