feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { page } from "$app/state";
|
2026-03-06 16:49:30 +01:00
|
|
|
import { _ } from "svelte-i18n";
|
feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
|
|
|
|
|
const { children } = $props();
|
|
|
|
|
|
2026-03-06 16:49:30 +01:00
|
|
|
const navLinks = $derived([
|
|
|
|
|
{ name: $_("admin.nav.users"), href: "/admin/users", icon: "icon-[ri--team-line]" },
|
|
|
|
|
{ name: $_("admin.nav.videos"), href: "/admin/videos", icon: "icon-[ri--film-line]" },
|
|
|
|
|
{ name: $_("admin.nav.articles"), href: "/admin/articles", icon: "icon-[ri--article-line]" },
|
|
|
|
|
]);
|
feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
|
|
|
|
|
function isActive(href: string) {
|
|
|
|
|
return page.url.pathname.startsWith(href);
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-03-06 13:22:15 +01:00
|
|
|
<div class="min-h-screen bg-background">
|
|
|
|
|
<div class="container mx-auto px-4">
|
2026-03-06 14:36:52 +01:00
|
|
|
|
|
|
|
|
<!-- Mobile top nav -->
|
|
|
|
|
<div class="lg:hidden flex items-center gap-2 py-3 border-b border-border/40">
|
|
|
|
|
<a href="/" class="text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 mr-2">
|
2026-03-06 16:49:30 +01:00
|
|
|
{$_("admin.nav.back_mobile")}
|
2026-03-06 14:36:52 +01:00
|
|
|
</a>
|
|
|
|
|
{#each navLinks as link (link.href)}
|
|
|
|
|
<a
|
|
|
|
|
href={link.href}
|
|
|
|
|
class={`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium transition-colors ${
|
|
|
|
|
isActive(link.href)
|
|
|
|
|
? "bg-primary/10 text-primary"
|
|
|
|
|
: "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<span class={`${link.icon} h-4 w-4`}></span>
|
|
|
|
|
{link.name}
|
|
|
|
|
</a>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Desktop layout -->
|
2026-03-06 13:22:15 +01:00
|
|
|
<div class="flex min-h-screen">
|
2026-03-06 14:36:52 +01:00
|
|
|
<!-- Sidebar (desktop only) -->
|
|
|
|
|
<aside class="hidden lg:flex w-56 shrink-0 flex-col border-r border-border/40">
|
2026-03-06 13:22:15 +01:00
|
|
|
<div class="px-4 py-5 border-b border-border/40">
|
|
|
|
|
<a href="/" class="text-xs text-muted-foreground hover:text-foreground transition-colors">
|
2026-03-06 16:49:30 +01:00
|
|
|
{$_("admin.nav.back_to_site")}
|
2026-03-06 13:22:15 +01:00
|
|
|
</a>
|
2026-03-06 16:49:30 +01:00
|
|
|
<h1 class="mt-2 text-base font-bold text-foreground">{$_("admin.nav.title")}</h1>
|
2026-03-06 13:22:15 +01:00
|
|
|
</div>
|
feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
|
2026-03-06 13:22:15 +01:00
|
|
|
<nav class="flex-1 p-3 space-y-1">
|
|
|
|
|
{#each navLinks as link (link.href)}
|
|
|
|
|
<a
|
|
|
|
|
href={link.href}
|
|
|
|
|
class={`flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${
|
|
|
|
|
isActive(link.href)
|
|
|
|
|
? "bg-primary/10 text-primary"
|
|
|
|
|
: "text-muted-foreground hover:text-foreground hover:bg-muted/50"
|
|
|
|
|
}`}
|
|
|
|
|
>
|
|
|
|
|
<span class={`${link.icon} h-4 w-4`}></span>
|
|
|
|
|
{link.name}
|
|
|
|
|
</a>
|
|
|
|
|
{/each}
|
|
|
|
|
</nav>
|
|
|
|
|
</aside>
|
feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
|
2026-03-06 13:22:15 +01:00
|
|
|
<!-- Main content -->
|
2026-03-06 14:36:52 +01:00
|
|
|
<main class="flex-1 min-w-0">
|
2026-03-06 13:22:15 +01:00
|
|
|
{@render children()}
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
feat: role-based ACL + admin management UI
Backend:
- Add acl.ts with requireAuth/requireRole/requireOwnerOrAdmin helpers
- Gate premium videos from unauthenticated users in videos query/resolver
- Fix updateVideoPlay to verify ownership before updating
- Add admin mutations: adminListUsers, adminUpdateUser, adminDeleteUser
- Add admin mutations: createVideo, updateVideo, deleteVideo, setVideoModels, adminListVideos
- Add admin mutations: createArticle, updateArticle, deleteArticle, adminListArticles
- Add deleteComment mutation (owner or admin only)
- Add AdminUserListType to GraphQL types
- Fix featured filter on articles query
Frontend:
- Install marked for markdown rendering
- Add /admin/* section with sidebar layout and admin-only guard
- Admin users page: paginated table with search, role filter, inline role change, delete
- Admin videos pages: list, create form, edit form with file upload and model assignment
- Admin articles pages: list, create form, edit form with split-pane markdown editor
- Add admin nav link in header (desktop + mobile) for admin users
- Render article content through marked in magazine detail page
- Add all admin GraphQL service functions to services.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:31:33 +01:00
|
|
|
</div>
|