diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 45d6d8679cc..7646f44884c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,6 +2,8 @@ import { HTTP_INTERCEPTORS, HttpRequest, HttpHandler, HttpInterceptor } from '@a import { Injectable, NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { FormsModule } from '@angular/forms'; +import { PublicLibraryComponent } from './modules/library/public-library/public-library.component'; +import { PersonalLibraryComponent } from './modules/library/personal-library/personal-library.component'; const routes: Routes = [ { path: '', loadChildren: () => import('./home/home.module').then((m) => m.HomeModule) }, @@ -16,7 +18,13 @@ const routes: Routes = [ { path: 'curriculum', loadComponent: () => - import('./curriculum/curriculum.component').then((m) => m.CurriculumComponent) + import('./curriculum/curriculum.component').then((m) => m.CurriculumComponent), + children: [ + { path: '', redirectTo: 'public', pathMatch: 'full' }, + { path: 'public', component: PublicLibraryComponent }, + { path: 'personal', component: PersonalLibraryComponent }, + { path: '**', redirectTo: 'public' } + ] }, { path: 'features', diff --git a/src/app/curriculum/curriculum.component.html b/src/app/curriculum/curriculum.component.html index 5be0aa9fd2e..7b32d50c9eb 100644 --- a/src/app/curriculum/curriculum.component.html +++ b/src/app/curriculum/curriculum.component.html @@ -1,20 +1,20 @@
-
+

menu_book Unit Library

@if (showMyUnits) { - Authoring Tool + }

@@ -28,16 +28,25 @@

@if (showMyUnits) { - - - - - - - - + + + + + } @else { - + }
diff --git a/src/app/curriculum/curriculum.component.scss b/src/app/curriculum/curriculum.component.scss index 7d88b8df3a6..04bc86bef56 100644 --- a/src/app/curriculum/curriculum.component.scss +++ b/src/app/curriculum/curriculum.component.scss @@ -5,3 +5,7 @@ @apply md:rounded-md md:rounded-se-none md:rounded-ee-none; } + +.mat-headline-4 { + margin-bottom: 0; +} diff --git a/src/app/curriculum/curriculum.component.spec.ts b/src/app/curriculum/curriculum.component.spec.ts index 78372dd2a0c..6593c020dc7 100644 --- a/src/app/curriculum/curriculum.component.spec.ts +++ b/src/app/curriculum/curriculum.component.spec.ts @@ -8,6 +8,7 @@ import { MockComponents, MockProvider, MockProviders } from 'ng-mocks'; import { PersonalLibraryComponent } from '../modules/library/personal-library/personal-library.component'; import { PublicLibraryComponent } from '../modules/library/public-library/public-library.component'; import { UserService } from '../services/user.service'; +import { provideRouter } from '@angular/router'; describe('CurriculumComponent', () => { let component: CurriculumComponent; @@ -26,7 +27,8 @@ describe('CurriculumComponent', () => { communityLibraryProjectsSource$: of([]), numberOfPublicProjectsVisible$: of(3), numberOfPersonalProjectsVisible$: of(2) - }) + }), + provideRouter([]) ] }).compileComponents(); spyOn(TestBed.inject(ConfigService), 'getAuthoringToolLink').and.returnValue(''); @@ -41,23 +43,23 @@ describe('CurriculumComponent', () => { component.ngOnInit(); fixture.detectChanges(); expect(numAuthoringToolButtonElements(fixture)).toEqual(0); - expect(numTabGroupElements(fixture)).toEqual(0); + expect(numTabNavBarElements(fixture)).toEqual(0); }); - it('should show My Units tab and authoring tool link when logged in as teacher', () => { + it('should show My Units tab and teacher home and authoring tool links when logged in as teacher', () => { spyOn(TestBed.inject(UserService), 'isTeacher').and.returnValue(true); component.ngOnInit(); fixture.detectChanges(); - expect(numAuthoringToolButtonElements(fixture)).toEqual(1); - expect(numTabGroupElements(fixture)).toEqual(1); + expect(numAuthoringToolButtonElements(fixture)).toEqual(2); + expect(numTabNavBarElements(fixture)).toEqual(1); expect(component['showMyUnits']).toBeTruthy(); }); }); function numAuthoringToolButtonElements(fixture: ComponentFixture) { - return fixture.debugElement.nativeElement.querySelectorAll('a').length; + return fixture.debugElement.nativeElement.querySelectorAll('header * a').length; } -function numTabGroupElements(fixture: ComponentFixture) { - return fixture.debugElement.nativeElement.querySelectorAll('mat-tab-group').length; +function numTabNavBarElements(fixture: ComponentFixture) { + return fixture.debugElement.nativeElement.querySelectorAll('nav').length; } diff --git a/src/app/curriculum/curriculum.component.ts b/src/app/curriculum/curriculum.component.ts index a70a147d7b5..03f41e9f68f 100644 --- a/src/app/curriculum/curriculum.component.ts +++ b/src/app/curriculum/curriculum.component.ts @@ -10,6 +10,7 @@ import { PublicLibraryComponent } from '../modules/library/public-library/public import { Subscription } from 'rxjs'; import { UserService } from '../services/user.service'; import { MatButtonModule } from '@angular/material/button'; +import { Router, RouterModule } from '@angular/router'; @Component({ imports: [ @@ -19,7 +20,8 @@ import { MatButtonModule } from '@angular/material/button'; MatIconModule, MatTabsModule, PersonalLibraryComponent, - PublicLibraryComponent + PublicLibraryComponent, + RouterModule ], styleUrl: './curriculum.component.scss', templateUrl: './curriculum.component.html' @@ -33,7 +35,8 @@ export class CurriculumComponent { constructor( protected configService: ConfigService, private libraryService: LibraryService, - private userService: UserService + private userService: UserService, + private router: Router ) {} ngOnInit(): void { @@ -76,4 +79,12 @@ export class CurriculumComponent { protected getMyUnitsTabLabel(): string { return $localize`My Units (${this.numMyUnitsVisible})`; } + + protected isPublicRoute(): boolean { + return this.router.url === '/curriculum/public'; + } + + protected isPersonalRoute(): boolean { + return this.router.url === '/curriculum/personal'; + } } diff --git a/src/app/modules/header/header-links/header-links.component.html b/src/app/modules/header/header-links/header-links.component.html index 91a8f359540..c88a980c7dd 100644 --- a/src/app/modules/header/header-links/header-links.component.html +++ b/src/app/modules/header/header-links/header-links.component.html @@ -1,9 +1,7 @@ -