Skip to content

Commit 9d576d8

Browse files
committed
Merge branch 'dev'
2 parents b2155df + ebaa423 commit 9d576d8

20 files changed

+328
-266
lines changed

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "portfolio",
3-
"version": "1.10",
3+
"version": "1.11",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<button
2+
(click)="ths.toggleLightDark()"
23
*ngIf="ths.activeTheme; else themeNotLoadedYet"
3-
pButton
4-
class="p-button p-button-text p-button-outline"
4+
[attr.aria-label]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'"
55
[icon]="ths.activeTheme.icon"
6-
(click)="ths.toggleLightDark()"
76
[pTooltip]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'"
8-
[attr.aria-label]="ths.darkMode ? 'Switch to light mode' : 'Switch to dark mode'"
7+
class="p-button p-button-text p-button-outline"
8+
pButton
99
></button>
1010
<ng-template #themeNotLoadedYet>
11-
<jm-loading-spinner [showMessage]="false" [useDots]="false"></jm-loading-spinner>
11+
<jm-loading-spinner [showMessage]="false" [useDots]="false"/>
1212
</ng-template>

src/app/modules/shared/components/footer/footer.component.html

+13-15
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,25 @@
99
<div class="dev-disclaimer-nav-content">
1010
<div
1111
*ngIf="dev; else prodWIPDisclaimer"
12-
id="dev-disclaimer"
1312
class="disclaimer-content"
13+
id="dev-disclaimer"
1414
>
1515
<span class="disclaimer-message"
16-
>You are currently viewing the development build, which may be
16+
>You are currently viewing the development build, which may be
1717
unfinished or buggy.</span
1818
>
1919
<a
20-
pButton
21-
class="prod-nav-btn p-button p-button-raised p-button-primary"
22-
[href]="exss.prodSite.address"
2320
(click)="exss.prodSite.open()"
21+
[href]="exss.prodSite.address"
22+
class="prod-nav-btn p-button p-button-raised p-button-primary"
2423
label="Return to production site"
24+
pButton
2525
></a>
2626
</div>
2727
<ng-template #prodWIPDisclaimer>
28-
<div id="prod-disclaimer" class="disclaimer-content">
28+
<div class="disclaimer-content" id="prod-disclaimer">
2929
<span class="disclaimer-message"
30-
>This portfolio is a work in progress. Come back later to see what
30+
>This portfolio is a work in progress. Come back later to see what
3131
changes!</span
3232
>
3333
</div>
@@ -37,21 +37,19 @@
3737

3838
<div class="footer-container">
3939
<div class="footer-left">
40-
<div class="dev-build-disclaimer-container" *ngIf="shouldShowWIPDisclaimer">
40+
<div *ngIf="shouldShowWIPDisclaimer" class="dev-build-disclaimer-container">
4141
<button
42-
pButton
43-
class="disclaimer-icon p-button p-button-text"
44-
icon="pi pi-exclamation-triangle"
4542
(click)="devDisclaimerOpen = true"
4643
[disabled]="devDisclaimerOpen"
44+
class="disclaimer-icon p-button p-button-text"
45+
icon="pi pi-exclamation-triangle"
4746
label="WIP"
47+
pButton
4848
></button>
4949
</div>
50-
<!-- <button pButton class="attribution-button p-button p-button-text" icon="pi pi-info-circle" pTooltip="Attribution"
51-
[disabled]="attributionVisible" (click)="attributionVisible = true"></button> -->
52-
<jm-matomo-opt-out></jm-matomo-opt-out>
50+
<jm-tracking-opt-in/>
5351
</div>
5452
<div class="social-icons-wrapper">
55-
<jm-social-icons></jm-social-icons>
53+
<jm-social-icons/>
5654
</div>
5755
</div>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<p-menubar class="app-header" [model]="items">
1+
<p-menubar [model]="items" class="app-header">
22
<ng-template pTemplate="end">
3-
<jm-color-theme-toggler></jm-color-theme-toggler>
3+
<jm-color-theme-toggler/>
44
</ng-template>
55
</p-menubar>

src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.html

-29
This file was deleted.

src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.spec.ts

-23
This file was deleted.

src/app/modules/shared/components/matomo-opt-out/matomo-opt-out.component.ts

-71
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<p-dialog
2+
[(visible)]="popupOpen"
3+
aria-atomic="false"
4+
aria-live="polite"
5+
aria-relevant="additions"
6+
class="tracking-opt-in-dialogue"
7+
header="Data collection opt-in"
8+
>
9+
<div
10+
*ngIf="!loading; else optStateLoading"
11+
aria-atomic="false"
12+
aria-live="polite"
13+
aria-relevant="additions"
14+
class="opt-in-container"
15+
>
16+
<div class="opt-btn-row">
17+
<label class="opt-in-label" for="opt-in">Usage metrics:</label>
18+
<p-selectButton (onChange)="handleChange($event.value)" [disabled]="loading" [ngModel]="selected.value"
19+
[options]="stateOptions"
20+
id="opt-in" name="opt-in" optionLabel="label"
21+
optionValue="value"></p-selectButton>
22+
</div>
23+
<span [innerHTML]="selected.message" class="opt-state-message"></span>
24+
</div>
25+
<ng-template #optStateLoading>
26+
<jm-loading-spinner/>
27+
</ng-template>
28+
</p-dialog>
29+
30+
<button (click)="popupOpen=true" [attr.aria-label]="'Review privacy settings'" [disabled]="popupOpen"
31+
class="p-button p-button-text" icon="pi pi-eye-slash"
32+
pButton pTooltip="Review privacy settings"></button>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
::ng-deep .opt-out-container {
1+
::ng-deep .opt-in-container {
22
width: 100%;
33

44
display: flex;
55
flex-flow: column nowrap;
66

7-
.opt-state-message {}
8-
9-
@media screen and (min-width:601px) {
7+
@media screen and (min-width: 601px) {
108
.opt-btn-row {
119
flex-flow: row nowrap;
1210
}
1311
}
1412

15-
@media screen and (max-width:600px) {
13+
@media screen and (max-width: 600px) {
1614
.opt-btn-row {
1715
flex-flow: column nowrap;
1816
}
@@ -26,5 +24,4 @@
2624
align-items: center;
2725
width: 100%;
2826
}
29-
3027
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { TrackingOptInComponent } from './tracking-opt-in.component';
4+
5+
describe('TrackingOptInComponent', () => {
6+
let component: TrackingOptInComponent;
7+
let fixture: ComponentFixture<TrackingOptInComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [TrackingOptInComponent],
12+
}).compileComponents();
13+
14+
fixture = TestBed.createComponent(TrackingOptInComponent);
15+
component = fixture.componentInstance;
16+
fixture.detectChanges();
17+
});
18+
19+
it('should create', () => {
20+
expect(component).toBeTruthy();
21+
});
22+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { ToastService } from 'src/app/services/toast.service';
3+
import moment from 'moment';
4+
import { TrackingService } from '../../../../services/tracking.service';
5+
6+
type TOnOff = 'on' | 'off';
7+
8+
interface IOptInState {
9+
label: string;
10+
value: TOnOff;
11+
message: string;
12+
}
13+
14+
@Component({
15+
selector: 'jm-tracking-opt-in',
16+
templateUrl: './tracking-opt-in.component.html',
17+
styleUrls: ['./tracking-opt-in.component.scss'],
18+
})
19+
export class TrackingOptInComponent implements OnInit {
20+
popupOpen = false;
21+
22+
loading = false;
23+
24+
optedIn = false;
25+
26+
private _on: IOptInState = {
27+
label: 'Enabled',
28+
value: 'on',
29+
message:
30+
'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.',
31+
};
32+
33+
private _off: IOptInState = {
34+
label: 'Disabled',
35+
value: 'off',
36+
message:
37+
'You are currently opted out of usage metrics tracking. I will not receive or store any of your usage data.',
38+
};
39+
40+
selected: IOptInState = this._off;
41+
42+
stateOptions: IOptInState[] = [this._on, this._off];
43+
44+
constructor(
45+
private _tsts: ToastService,
46+
private _trks: TrackingService,
47+
) {}
48+
49+
handleChange(state: TOnOff) {
50+
if (state === 'off') {
51+
this._trks.trackerOptInDate = moment(moment.now());
52+
} else {
53+
this._trks.trackerOptInDate = null;
54+
}
55+
56+
this._trks.trackerOptInDate = state === 'on' ? moment(moment.now()) : null;
57+
58+
this.refreshState();
59+
}
60+
61+
ngOnInit(): void {
62+
this.refreshState();
63+
}
64+
65+
private refreshState() {
66+
try {
67+
this.loading = true;
68+
this.optedIn = this._trks.isUserOptedIntoTracking();
69+
this.selected = this.optedIn ? this._on : this._off;
70+
} catch (err: any) {
71+
console.error(err);
72+
this._tsts.error({ detail: err.message });
73+
} finally {
74+
this.loading = false;
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)