feat: Allow super-admins to retrieve courses across organizations and update navigation link styles to text-sm and text-slate-600.
This commit is contained in:
@@ -2415,17 +2415,27 @@ pub struct CourseWithOutline {
|
||||
|
||||
pub async fn get_course_outline(
|
||||
Org(org_ctx): Org,
|
||||
claims: common::auth::Claims,
|
||||
State(pool): State<PgPool>,
|
||||
Path(id): Path<Uuid>,
|
||||
) -> Result<Json<CourseWithOutline>, StatusCode> {
|
||||
let is_super_admin = claims.role == "admin"
|
||||
&& claims.org == Uuid::parse_str("00000000-0000-0000-0000-000000000001").unwrap();
|
||||
|
||||
// 1. Fetch Course
|
||||
let course =
|
||||
let course = if is_super_admin {
|
||||
sqlx::query_as::<_, Course>("SELECT * FROM courses WHERE id = $1")
|
||||
.bind(id)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
} else {
|
||||
sqlx::query_as::<_, Course>("SELECT * FROM courses WHERE id = $1 AND organization_id = $2")
|
||||
.bind(id)
|
||||
.bind(org_ctx.id)
|
||||
.fetch_one(&pool)
|
||||
.await
|
||||
.map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
}
|
||||
.map_err(|_| StatusCode::NOT_FOUND)?;
|
||||
|
||||
// 2. Fetch Modules
|
||||
let modules =
|
||||
|
||||
@@ -56,7 +56,7 @@ body {
|
||||
}
|
||||
|
||||
.nav-link-standard {
|
||||
@apply text-xs font-bold uppercase tracking-widest transition-colors flex items-center gap-2;
|
||||
@apply text-sm font-bold uppercase tracking-wider transition-colors flex items-center gap-2;
|
||||
}
|
||||
|
||||
.glass-card:hover {
|
||||
|
||||
@@ -46,13 +46,13 @@ export default function AppHeader() {
|
||||
|
||||
<div className="flex items-center gap-4">
|
||||
<nav className="hidden md:flex items-center gap-8 mr-4" aria-label="Navegación principal">
|
||||
<Link href="/" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
<Link href="/" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
{t('nav.catalog')}
|
||||
</Link>
|
||||
<Link href="/my-learning" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
<Link href="/my-learning" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
{t('nav.myLearning')}
|
||||
</Link>
|
||||
<Link href="/bookmarks" className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
<Link href="/bookmarks" className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">
|
||||
{t('nav.bookmarks')}
|
||||
</Link>
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ body {
|
||||
}
|
||||
|
||||
.nav-link-standard {
|
||||
@apply text-xs font-bold uppercase tracking-widest transition-colors flex items-center gap-2;
|
||||
@apply text-sm font-bold uppercase tracking-wider transition-colors flex items-center gap-2;
|
||||
}
|
||||
|
||||
.btn-premium {
|
||||
|
||||
@@ -42,9 +42,9 @@ export default function CourseEditorLayout({ children, activeTab }: CourseEditor
|
||||
<Link
|
||||
href={tab.href}
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
className={`flex items-center gap-1.5 px-4 py-3 text-xs font-bold uppercase tracking-widest transition-all whitespace-nowrap flex-shrink-0 border-b-2 ${isActive
|
||||
? "border-blue-600 dark:border-blue-500 bg-black/5 dark:bg-white/5 text-blue-600 dark:text-white"
|
||||
: "border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
|
||||
className={`nav-link-standard px-4 py-3 border-b-2 whitespace-nowrap ${isActive
|
||||
? "border-blue-600 dark:border-blue-500 text-blue-600 dark:text-white"
|
||||
: "border-transparent text-slate-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"
|
||||
}`}
|
||||
>
|
||||
<Icon className="w-4 h-4 flex-shrink-0" aria-hidden="true" />
|
||||
|
||||
@@ -44,7 +44,7 @@ export function Navbar() {
|
||||
<div className="flex items-center gap-4">
|
||||
<Link
|
||||
href="/"
|
||||
className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||
>
|
||||
<LayoutDashboard className="w-4 h-4" />
|
||||
{t('nav.courses')}
|
||||
@@ -52,7 +52,7 @@ export function Navbar() {
|
||||
|
||||
<Link
|
||||
href="/library/assets"
|
||||
className="nav-link-standard text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"
|
||||
>
|
||||
<Library className="w-4 h-4" aria-hidden="true" />
|
||||
{t('nav.library') || 'Library'}
|
||||
@@ -64,7 +64,7 @@ export function Navbar() {
|
||||
{user.organization_id === '00000000-0000-0000-0000-000000000001' && (
|
||||
<Link
|
||||
href="/admin"
|
||||
className="text-xs font-black text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-2 bg-indigo-500/10 px-3 py-1.5 rounded-lg border border-indigo-500/20 shadow-glow-sm uppercase tracking-widest"
|
||||
className="text-sm font-black text-indigo-400 hover:text-indigo-300 transition-colors flex items-center gap-2 bg-indigo-500/10 px-3 py-1.5 rounded-lg border border-indigo-500/20 shadow-glow-sm uppercase tracking-wider"
|
||||
>
|
||||
<ShieldCheck className="w-4 h-4" aria-hidden="true" />
|
||||
{t('nav.globalControl')}
|
||||
@@ -72,14 +72,14 @@ export function Navbar() {
|
||||
)}
|
||||
<Link
|
||||
href="/settings/webhooks"
|
||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
||||
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||
>
|
||||
<Webhook className="w-4 h-4" />
|
||||
{t('nav.webhooks')}
|
||||
</Link>
|
||||
<Link
|
||||
href="/profile"
|
||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
||||
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||
>
|
||||
<Settings className="w-4 h-4" />
|
||||
{t('nav.profile')}
|
||||
@@ -89,7 +89,7 @@ export function Navbar() {
|
||||
|
||||
<Link
|
||||
href="/settings"
|
||||
className="nav-link-standard text-gray-400 hover:text-blue-400"
|
||||
className="nav-link-standard text-slate-600 dark:text-gray-400 hover:text-blue-400"
|
||||
>
|
||||
<Settings className="w-4 h-4" />
|
||||
Settings
|
||||
|
||||
Reference in New Issue
Block a user