forked from doubtfire-lms/doubtfire-web
-
Notifications
You must be signed in to change notification settings - Fork 137
feat(units): improved appearance of unit cards #323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
agamv25
wants to merge
5
commits into
thoth-tech:new/course-flow
Choose a base branch
from
agamv25:new/course-flow
base: new/course-flow
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bd62556
feat(units): improved appearance of unit cards
AgamSingh4756 5e24395
feat(units): added a search feature in Courseflow
AgamSingh4756 350219d
feat(units): added a unit overlay for the units to show more unit inf…
AgamSingh4756 65f8035
feat(units): added a unit overlay for the units to show more unit inf…
AgamSingh4756 7a44f4a
feat(units): added a unit description and requirement elipses
AgamSingh4756 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/app/admin/modals/unit-description-modal/unit-description-modal-content.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <h3 mat-dialog-title>Unit Details</h3> | ||
|
|
||
| <div mat-dialog-content class="pt-4"> | ||
| <p><strong>Unit Code:</strong> {{ unit.code }}</p> | ||
| <p><strong>Name:</strong> {{ unit.name }}</p> | ||
| <p> | ||
| <strong>Description:</strong><br /> {{ unit.description }} | ||
| </p> | ||
|
|
||
| <!-- Requirements Section --> | ||
| <div class="requirements-container mt-3"> | ||
| <h3>Requirements</h3> | ||
|
|
||
| <div *ngIf="isLoading" class="loading-indicator"> | ||
| Loading requirements... | ||
| </div> | ||
|
|
||
| <div *ngIf="errorMessage" class="error-message text-danger"> | ||
| {{ errorMessage }} | ||
| </div> | ||
|
|
||
| <div *ngIf="!isLoading && !errorMessage && requirements.length === 0" class="no-requirements"> | ||
| No requirements found for this unit. | ||
| </div> | ||
|
|
||
| <div *ngIf="requirements.length > 0" class="requirements-list"> | ||
| <div *ngFor="let requirement of requirements" class="requirement-item mb-2"> | ||
| <div><strong>Type:</strong> {{ requirement.type }}</div> | ||
| <div><strong>Category:</strong> {{ requirement.category }}</div> | ||
| <div><strong>Minimum: </strong> {{ requirement.minimum }}</div> | ||
| <div><strong>Maximum: </strong>{{ requirement.maximum }}</div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <mat-dialog-actions align="end"> | ||
| <button mat-button mat-dialog-close>Close</button> | ||
| </mat-dialog-actions> |
43 changes: 43 additions & 0 deletions
43
src/app/admin/modals/unit-description-modal/unit-description-modal-content.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { Component, Inject, OnInit } from '@angular/core'; | ||
| import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog'; | ||
| import { MatButtonModule } from '@angular/material/button'; | ||
| import { CommonModule } from '@angular/common'; | ||
| import { UnitDefinition } from 'src/app/api/models/unit-definition'; | ||
| import { RequirementService } from 'src/app/services/requirement.service'; | ||
| import { Requirement } from 'src/app/api/models/requirement-definition'; | ||
|
|
||
| @Component({ | ||
| selector: 'unit-description-modal-content', | ||
| standalone: true, | ||
| imports: [CommonModule, MatDialogModule, MatButtonModule], | ||
| templateUrl: 'unit-description-modal-content.component.html', | ||
| }) | ||
| export class UnitDescriptionModalContentComponent implements OnInit { | ||
| requirements: Requirement[] = []; | ||
| isLoading = false; | ||
| errorMessage = ''; | ||
|
|
||
| constructor( | ||
| @Inject(MAT_DIALOG_DATA) public unit: UnitDefinition, | ||
| private requirementService: RequirementService | ||
| ) {} | ||
|
|
||
| ngOnInit(): void { | ||
| this.loadRequirements(); | ||
| } | ||
|
|
||
| loadRequirements(): void { | ||
| this.isLoading = true; | ||
| this.requirementService.getByUnitId(this.unit.id).subscribe({ | ||
| next: (requirements) => { | ||
| this.requirements = requirements; | ||
| this.isLoading = false; | ||
| }, | ||
| error: (error) => { | ||
| console.error('Error loading requirements:', error); | ||
| this.errorMessage = 'Failed to load requirements. Please try again later.'; | ||
| this.isLoading = false; | ||
| } | ||
| }); | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
src/app/admin/modals/unit-description-modal/unit-description-modal.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { MatDialog } from '@angular/material/dialog'; | ||
| import { UnitDescriptionModalContentComponent } from './unit-description-modal-content.component'; | ||
| import { UnitDefinition } from 'src/app/api/models/unit-definition'; // Adjust path if needed | ||
|
|
||
| @Component({ | ||
| selector: 'unit-description-modal', | ||
| template: '', | ||
| }) | ||
| export class UnitDescriptionModal { | ||
| constructor(private dialog: MatDialog) {} | ||
|
|
||
| public show(unit: UnitDefinition): void { | ||
| this.dialog.open(UnitDescriptionModalContentComponent, { | ||
| width: '500px', | ||
| data: unit, | ||
| }); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export interface Requirement { | ||
| id: number; | ||
| unitId: number; | ||
| courseId: number; | ||
| type: string; | ||
| category: string; | ||
| description: string; | ||
| minimum: number; | ||
| maximum: number; | ||
| requirementSetGroupId: number; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,6 @@ | ||
| export interface UnitDefinition { | ||
| id?: number; | ||
| id: number; | ||
| name: string; | ||
| description: string; | ||
| code: string; | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import {Observable} from 'rxjs'; | |
| import {HttpClient, HttpParams} from '@angular/common/http'; | ||
|
|
||
| import API_URL from 'src/app/config/constants/apiURL'; | ||
| import { param } from 'jquery'; | ||
|
|
||
| @Injectable({ | ||
| providedIn: 'root' | ||
|
|
@@ -41,12 +42,18 @@ export class UnitDefinitionService { | |
| description: string, | ||
| code: string, | ||
| version: string, | ||
| tasknum: number, | ||
| unitTutorFirstName: string, | ||
| unitTutorLastName: string, | ||
| ): Observable<UnitDefinition> { | ||
| let params = new HttpParams(); | ||
| params.set('name', name); | ||
| params.set('description', description); | ||
| params.set('code', code); | ||
| params.set('version', version); | ||
| params.set('Number of Tasks', tasknum); | ||
| params.set('Unit Tutor first name', unitTutorFirstName); | ||
| params.set('Unit Tutor last name', unitTutorLastName); | ||
| console.log("added unit definition"); | ||
| return this.http.post<UnitDefinition>(this.baseUrl, {params}); | ||
| } | ||
|
|
@@ -56,13 +63,18 @@ export class UnitDefinitionService { | |
| name: string, | ||
| description: string, | ||
| code: string, | ||
| tasknum: number, | ||
| unitTutorFirstName: string, | ||
| unitTutorLastName: string, | ||
| ): Observable<UnitDefinition> { | ||
| const params = new HttpParams(); | ||
| params.set('unitDefinitionId', unitDefinitionId.toString()); | ||
| params.set('name', name); | ||
| params.set('description', description); | ||
| params.set('code', code); | ||
|
|
||
| params.set('Number of Tasks', tasknum); | ||
| params.set('Unit Tutor first name', unitTutorFirstName); | ||
| params.set('Unit Tutor last name', unitTutorLastName); | ||
|
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These shouldn't be in courseflow - there is no need to include this, unless they are used. |
||
| const url = `${this.baseUrl}/:id:`; | ||
| return this.http.put<UnitDefinition>(url, {params}); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a "null" string, but just null.