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 @@
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 @@
-
diff --git a/src/app/modules/header/header-links/header-links.component.spec.ts b/src/app/modules/header/header-links/header-links.component.spec.ts
index 0f3b01e9333..d8aa3be6406 100644
--- a/src/app/modules/header/header-links/header-links.component.spec.ts
+++ b/src/app/modules/header/header-links/header-links.component.spec.ts
@@ -14,14 +14,6 @@ describe('HeaderLinksComponent', () => {
});
fixture = TestBed.createComponent(HeaderLinksComponent);
component = fixture.componentInstance;
- const user: User = new User();
- user.id = 1;
- user.firstName = 'Amanda';
- user.lastName = 'Panda';
- user.roles = ['student'];
- user.username = 'AmandaP0101';
- component.user = user;
- component.location = 'student';
fixture.detectChanges();
});
@@ -29,8 +21,8 @@ describe('HeaderLinksComponent', () => {
expect(component).toBeTruthy();
});
- it('should show user welcome message', () => {
+ it('should show header sign in if no user is logged in', () => {
const compiled = fixture.debugElement.nativeElement;
- expect(compiled.querySelector('.header__links').textContent).toContain('Welcome Amanda!');
+ expect(compiled.querySelectorAll('app-header-signin').length).toBe(1);
});
});
diff --git a/src/app/modules/header/header-links/header-links.component.ts b/src/app/modules/header/header-links/header-links.component.ts
index 00099c490a6..46ac26ab644 100644
--- a/src/app/modules/header/header-links/header-links.component.ts
+++ b/src/app/modules/header/header-links/header-links.component.ts
@@ -7,10 +7,10 @@ import { FlexLayoutModule } from '@angular/flex-layout';
import { RouterModule } from '@angular/router';
@Component({
- selector: 'app-header-links',
- imports: [CommonModule, FlexLayoutModule, HeaderSigninComponent, MatButtonModule, RouterModule],
- templateUrl: './header-links.component.html',
- styleUrl: './header-links.component.scss'
+ selector: 'app-header-links',
+ imports: [CommonModule, FlexLayoutModule, HeaderSigninComponent, MatButtonModule, RouterModule],
+ templateUrl: './header-links.component.html',
+ styleUrl: './header-links.component.scss'
})
export class HeaderLinksComponent {
@Input() location: string;
diff --git a/src/app/modules/library/community-library/community-library.component.html b/src/app/modules/library/community-library/community-library.component.html
deleted file mode 100644
index 5ebdf98e82e..00000000000
--- a/src/app/modules/library/community-library/community-library.component.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
-
-
-
-
- No community designed units found.
-
-
-
-
-
-
diff --git a/src/app/modules/library/community-library/community-library.component.spec.ts b/src/app/modules/library/community-library/community-library.component.spec.ts
deleted file mode 100644
index 49df448691c..00000000000
--- a/src/app/modules/library/community-library/community-library.component.spec.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
-import { CommunityLibraryComponent } from './community-library.component';
-import { fakeAsyncResponse } from '../../../student/student-run-list/student-run-list.component.spec';
-import { LibraryService } from '../../../services/library.service';
-import { NO_ERRORS_SCHEMA } from '@angular/core';
-import { MatDialogModule } from '@angular/material/dialog';
-import { BehaviorSubject, of } from 'rxjs';
-import { OverlayModule } from '@angular/cdk/overlay';
-import { ProjectFilterValues } from '../../../domain/projectFilterValues';
-
-export class MockLibraryService {
- implementationModelOptions = [];
- communityLibraryProjectsSource$ = fakeAsyncResponse([]);
- filterValuesUpdated$ = of();
- numberOfPublicProjectsVisible = new BehaviorSubject(0);
- filterValues = new ProjectFilterValues();
-}
-
-describe('CommunityLibraryComponent', () => {
- let component: CommunityLibraryComponent;
- let fixture: ComponentFixture;
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [OverlayModule, MatDialogModule],
- declarations: [CommunityLibraryComponent],
- providers: [{ provide: LibraryService, useClass: MockLibraryService }],
- schemas: [NO_ERRORS_SCHEMA]
- }).compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(CommunityLibraryComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/modules/library/community-library/community-library.component.ts b/src/app/modules/library/community-library/community-library.component.ts
deleted file mode 100644
index ab2c68e5ba9..00000000000
--- a/src/app/modules/library/community-library/community-library.component.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { BehaviorSubject } from 'rxjs';
-import { Component, Inject } from '@angular/core';
-import { LibraryService } from '../../../services/library.service';
-import { LibraryProject } from '../libraryProject';
-import { LibraryComponent } from '../library/library.component';
-import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dialog';
-
-@Component({
- selector: 'app-community-library',
- templateUrl: './community-library.component.html',
- styleUrls: ['./community-library.component.scss'],
- standalone: false
-})
-export class CommunityLibraryComponent extends LibraryComponent {
- projects: LibraryProject[] = [];
- filteredProjects: LibraryProject[] = [];
-
- constructor(
- protected dialog: MatDialog,
- protected libraryService: LibraryService
- ) {
- super(dialog, libraryService);
- }
-
- ngOnInit() {
- super.ngOnInit();
- this.subscriptions.add(
- this.libraryService.communityLibraryProjectsSource$.subscribe((communityProjects) => {
- this.projects = communityProjects;
- this.filterUpdated();
- })
- );
- }
-
- protected getNumVisiblePersonalOrPublicProjects(): BehaviorSubject {
- return this.libraryService.numberOfPublicProjectsVisible;
- }
-
- protected getDetailsComponent(): any {
- return CommunityLibraryDetailsComponent;
- }
-}
-
-@Component({
- selector: 'community-library-details',
- templateUrl: 'community-library-details.html',
- standalone: false
-})
-export class CommunityLibraryDetailsComponent {
- constructor(
- public dialogRef: MatDialogRef,
- @Inject(MAT_DIALOG_DATA) public data: any
- ) {}
-
- close(): void {
- this.dialogRef.close();
- }
-}
diff --git a/src/app/modules/library/library.module.ts b/src/app/modules/library/library.module.ts
index 3ac53e232fc..a44af3b9964 100644
--- a/src/app/modules/library/library.module.ts
+++ b/src/app/modules/library/library.module.ts
@@ -5,7 +5,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LibraryGroupThumbsComponent } from './library-group-thumbs/library-group-thumbs.component';
import { LibraryProjectComponent } from './library-project/library-project.component';
import { LibraryProjectDetailsComponent } from './library-project-details/library-project-details.component';
-import { LibraryService } from '../../services/library.service';
import { RouterModule } from '@angular/router';
import { SharedModule } from '../shared/shared.module';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
@@ -29,19 +28,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { TimelineModule } from '../timeline/timeline.module';
import { LibraryFiltersComponent } from './library-filters/library-filters.component';
import { HomePageProjectLibraryComponent } from './home-page-project-library/home-page-project-library.component';
-import { TeacherProjectLibraryComponent } from './teacher-project-library/teacher-project-library.component';
-import {
- OfficialLibraryComponent,
- OfficialLibraryDetailsComponent
-} from './official-library/official-library.component';
-import {
- CommunityLibraryComponent,
- CommunityLibraryDetailsComponent
-} from './community-library/community-library.component';
-import {
- PersonalLibraryComponent,
- PersonalLibraryDetailsComponent
-} from './personal-library/personal-library.component';
+import { OfficialLibraryComponent } from './official-library/official-library.component';
+import { PersonalLibraryComponent } from './personal-library/personal-library.component';
import { ShareProjectDialogComponent } from './share-project-dialog/share-project-dialog.component';
import { CopyProjectDialogComponent } from './copy-project-dialog/copy-project-dialog.component';
import { LibraryPaginatorIntl } from './libraryPaginatorIntl';
@@ -107,12 +95,7 @@ const materialModules = [
declarations: [
LibraryGroupThumbsComponent,
HomePageProjectLibraryComponent,
- TeacherProjectLibraryComponent,
OfficialLibraryComponent,
- OfficialLibraryDetailsComponent,
- CommunityLibraryComponent,
- CommunityLibraryDetailsComponent,
- PersonalLibraryDetailsComponent,
ShareProjectDialogComponent,
CopyProjectDialogComponent
],
@@ -121,13 +104,11 @@ const materialModules = [
HomePageProjectLibraryComponent,
PersonalLibraryComponent,
ReactiveFormsModule,
- TeacherProjectLibraryComponent,
UnitTagsComponent,
materialModules
],
providers: [
ColorService,
- LibraryService,
{ provide: MatPaginatorIntl, useClass: LibraryPaginatorIntl },
ProjectTagService
]
diff --git a/src/app/modules/library/library/library.component.ts b/src/app/modules/library/library/library.component.ts
index e1cf265760f..9a33be3f48f 100644
--- a/src/app/modules/library/library/library.component.ts
+++ b/src/app/modules/library/library/library.component.ts
@@ -1,9 +1,8 @@
-import { OnInit, QueryList, ViewChildren, Directive, Input } from '@angular/core';
+import { OnInit, QueryList, ViewChildren, Directive } from '@angular/core';
import { LibraryService } from '../../../services/library.service';
import { LibraryProject } from '../libraryProject';
import { PageEvent, MatPaginator } from '@angular/material/paginator';
import { BehaviorSubject, Subscription } from 'rxjs';
-import { MatDialog } from '@angular/material/dialog';
import { ProjectFilterValues } from '../../../domain/projectFilterValues';
@Directive()
@@ -19,10 +18,7 @@ export abstract class LibraryComponent implements OnInit {
protected showFilters: boolean = false;
protected subscriptions: Subscription = new Subscription();
- constructor(
- protected dialog: MatDialog,
- protected libraryService: LibraryService
- ) {}
+ constructor(protected libraryService: LibraryService) {}
ngOnInit(): void {
this.subscriptions.add(
@@ -87,15 +83,6 @@ export abstract class LibraryComponent implements OnInit {
return projects.filter((project) => project.visible).length;
}
- protected showInfo(event: Event): void {
- event.preventDefault();
- this.dialog.open(this.getDetailsComponent(), {
- panelClass: 'dialog-sm'
- });
- }
-
- protected abstract getDetailsComponent(): any;
-
private getFilterValues(): ProjectFilterValues {
return this.libraryService.filterValues;
}
diff --git a/src/app/modules/library/official-library/official-library.component.html b/src/app/modules/library/official-library/official-library.component.html
index 8c3d98f75fc..c26ca931b36 100644
--- a/src/app/modules/library/official-library/official-library.component.html
+++ b/src/app/modules/library/official-library/official-library.component.html
@@ -1,50 +1,30 @@
-
-
-
- 0"
- [disabled]="countVisibleProjects(group.children) < 1"
- >
-