From f14e50d258c07720838540b3835b94813f2a6419 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Tue, 4 Feb 2025 10:08:15 -0500 Subject: [PATCH] share context --- .../src/app/incidents/incident/incident.component.html | 2 ++ .../src/app/incidents/incident/incident.component.ts | 6 +++++- client/stillbox/src/app/share/share.service.ts | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client/stillbox/src/app/incidents/incident/incident.component.html b/client/stillbox/src/app/incidents/incident/incident.component.html index e3cde1c..0bd0390 100644 --- a/client/stillbox/src/app/incidents/incident/incident.component.html +++ b/client/stillbox/src/app/incidents/incident/incident.component.html @@ -7,6 +7,7 @@ >playlist_play + @if (!inShare) { @@ -18,6 +19,7 @@ Delete + }
Start
diff --git a/client/stillbox/src/app/incidents/incident/incident.component.ts b/client/stillbox/src/app/incidents/incident/incident.component.ts index 465e48a..a92f01c 100644 --- a/client/stillbox/src/app/incidents/incident/incident.component.ts +++ b/client/stillbox/src/app/incidents/incident/incident.component.ts @@ -9,7 +9,7 @@ import { FormControl, FormsModule, } from '@angular/forms'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { MatInputModule } from '@angular/material/input'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatCheckboxModule } from '@angular/material/checkbox'; @@ -40,6 +40,7 @@ import { CallPlayerComponent } from '../../calls/player/call-player/call-player. import { FmtDatePipe } from '../incidents.component'; import { MatMenuModule } from '@angular/material/menu'; import { Share } from '../../shares'; +import { ShareService } from '../../share/share.service'; export interface EditDialogData { incID: string; @@ -152,6 +153,7 @@ export class IncidentEditDialogComponent { styleUrl: './incident.component.scss', }) export class IncidentComponent { + inShare = false; incPrime = new Subject(); inc$!: Observable; @Input() share?: Share; @@ -174,6 +176,7 @@ export class IncidentComponent { constructor( private route: ActivatedRoute, + private shareSvc: ShareService, private incSvc: IncidentsService, private location: Location, ) {} @@ -181,6 +184,7 @@ export class IncidentComponent { saveIncName(ev: Event) {} ngOnInit() { + this.inShare = this.shareSvc.isInShare(); let incOb: Observable; if (this.route.component === this.constructor) { // loaded by route diff --git a/client/stillbox/src/app/share/share.service.ts b/client/stillbox/src/app/share/share.service.ts index d13d118..9a1723d 100644 --- a/client/stillbox/src/app/share/share.service.ts +++ b/client/stillbox/src/app/share/share.service.ts @@ -4,12 +4,17 @@ import { map, Observable, switchMap } from 'rxjs'; import { IncidentRecord } from '../incidents'; import { CallRecord } from '../calls'; import { Share, ShareType } from '../shares'; +import { Router } from '@angular/router'; @Injectable({ providedIn: 'root', }) export class ShareService { - constructor(private http: HttpClient) {} + constructor(private http: HttpClient, private router: Router) {} + + isInShare(): boolean { + return this.router.url.startsWith('/s/'); + } getShare(id: string): Observable { return this.http.get(`/share/${id}`);