-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
328 additions
and
266 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,6 +1,6 @@ | ||
{ | ||
"name": "portfolio", | ||
"version": "1.10", | ||
"version": "1.11", | ||
"scripts": { | ||
"ng": "ng", | ||
"start": "ng serve", | ||
|
10 changes: 5 additions & 5 deletions
10
src/app/modules/shared/components/color-theme-toggler/color-theme-toggler.component.html
This file contains 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,12 +1,12 @@ | ||
<button | ||
(click)="ths.toggleLightDark()" | ||
*ngIf="ths.activeTheme; else themeNotLoadedYet" | ||
pButton | ||
class="p-button p-button-text p-button-outline" | ||
[attr.aria-label]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'" | ||
[icon]="ths.activeTheme.icon" | ||
(click)="ths.toggleLightDark()" | ||
[pTooltip]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'" | ||
[attr.aria-label]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'" | ||
class="p-button p-button-text p-button-outline" | ||
pButton | ||
></button> | ||
<ng-template #themeNotLoadedYet> | ||
<jm-loading-spinner [showMessage]="false" [useDots]="false"></jm-loading-spinner> | ||
<jm-loading-spinner [showMessage]="false" [useDots]="false"/> | ||
</ng-template> |
This file contains 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
4 changes: 2 additions & 2 deletions
4
src/app/modules/shared/components/header/header.component.html
This file contains 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,5 +1,5 @@ | ||
<p-menubar class="app-header" [model]="items"> | ||
<p-menubar [model]="items" class="app-header"> | ||
<ng-template pTemplate="end"> | ||
<jm-color-theme-toggler></jm-color-theme-toggler> | ||
<jm-color-theme-toggler/> | ||
</ng-template> | ||
</p-menubar> |
29 changes: 0 additions & 29 deletions
29
src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.html
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.spec.ts
This file was deleted.
Oops, something went wrong.
71 changes: 0 additions & 71 deletions
71
src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.ts
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
src/app/modules/shared/components/tracking-opt-in/tracking-opt-in.component.html
This file contains 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,32 @@ | ||
<p-dialog | ||
[(visible)]="popupOpen" | ||
aria-atomic="false" | ||
aria-live="polite" | ||
aria-relevant="additions" | ||
class="tracking-opt-in-dialogue" | ||
header="Data collection opt-in" | ||
> | ||
<div | ||
*ngIf="!loading; else optStateLoading" | ||
aria-atomic="false" | ||
aria-live="polite" | ||
aria-relevant="additions" | ||
class="opt-in-container" | ||
> | ||
<div class="opt-btn-row"> | ||
<label class="opt-in-label" for="opt-in">Usage metrics:</label> | ||
<p-selectButton (onChange)="handleChange($event.value)" [disabled]="loading" [ngModel]="selected.value" | ||
[options]="stateOptions" | ||
id="opt-in" name="opt-in" optionLabel="label" | ||
optionValue="value"></p-selectButton> | ||
</div> | ||
<span [innerHTML]="selected.message" class="opt-state-message"></span> | ||
</div> | ||
<ng-template #optStateLoading> | ||
<jm-loading-spinner/> | ||
</ng-template> | ||
</p-dialog> | ||
|
||
<button (click)="popupOpen=true" [attr.aria-label]="'Review privacy settings'" [disabled]="popupOpen" | ||
class="p-button p-button-text" icon="pi pi-eye-slash" | ||
pButton pTooltip="Review privacy settings"></button> |
This file contains 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
22 changes: 22 additions & 0 deletions
22
src/app/modules/shared/components/tracking-opt-in/tracking-opt-in.component.spec.ts
This file contains 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,22 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { TrackingOptInComponent } from './tracking-opt-in.component'; | ||
|
||
describe('TrackingOptInComponent', () => { | ||
let component: TrackingOptInComponent; | ||
let fixture: ComponentFixture<TrackingOptInComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [TrackingOptInComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TrackingOptInComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
77 changes: 77 additions & 0 deletions
77
src/app/modules/shared/components/tracking-opt-in/tracking-opt-in.component.ts
This file contains 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,77 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ToastService } from 'src/app/services/toast.service'; | ||
import moment from 'moment'; | ||
import { TrackingService } from '../../../../services/tracking.service'; | ||
|
||
type TOnOff = 'on' | 'off'; | ||
|
||
interface IOptInState { | ||
label: string; | ||
value: TOnOff; | ||
message: string; | ||
} | ||
|
||
@Component({ | ||
selector: 'jm-tracking-opt-in', | ||
templateUrl: './tracking-opt-in.component.html', | ||
styleUrls: ['./tracking-opt-in.component.scss'], | ||
}) | ||
export class TrackingOptInComponent implements OnInit { | ||
popupOpen = false; | ||
|
||
loading = false; | ||
|
||
optedIn = false; | ||
|
||
private _on: IOptInState = { | ||
label: 'Enabled', | ||
value: 'on', | ||
message: | ||
'You are currently sharing usage data with me. I will use this data to make this site more intuitive and featured.<br>You may turn this off at any time in this dialogue menu.', | ||
}; | ||
|
||
private _off: IOptInState = { | ||
label: 'Disabled', | ||
value: 'off', | ||
message: | ||
'You are currently opted out of usage metrics tracking. I will not receive or store any of your usage data.', | ||
}; | ||
|
||
selected: IOptInState = this._off; | ||
|
||
stateOptions: IOptInState[] = [this._on, this._off]; | ||
|
||
constructor( | ||
private _tsts: ToastService, | ||
private _trks: TrackingService, | ||
) {} | ||
|
||
handleChange(state: TOnOff) { | ||
if (state === 'off') { | ||
this._trks.trackerOptInDate = moment(moment.now()); | ||
} else { | ||
this._trks.trackerOptInDate = null; | ||
} | ||
|
||
this._trks.trackerOptInDate = state === 'on' ? moment(moment.now()) : null; | ||
|
||
this.refreshState(); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.refreshState(); | ||
} | ||
|
||
private refreshState() { | ||
try { | ||
this.loading = true; | ||
this.optedIn = this._trks.isUserOptedIntoTracking(); | ||
this.selected = this.optedIn ? this._on : this._off; | ||
} catch (err: any) { | ||
console.error(err); | ||
this._tsts.error({ detail: err.message }); | ||
} finally { | ||
this.loading = false; | ||
} | ||
} | ||
} |
Oops, something went wrong.