-
Notifications
You must be signed in to change notification settings - Fork 7
Feature metadata dialogue #52
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
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
9027e26
add information page
ethanwu155 9c81dec
updated app-routing with info page route
ethanwu155 f9637cb
updated proofs page
ethanwu155 469321d
added important and type attribute to info interface
ethanwu155 7d7f196
updated
ethanwu155 d10c1b4
updated information page
ethanwu155 097ddfd
updated page routing
ethanwu155 f21b7ff
updated data structure for information page
ethanwu155 33076a1
updated data structure for proof page
ethanwu155 c68018a
fixed file
ethanwu155 81c7f62
capacitor-provider change
ethanwu155 701bbca
Merge branch 'develop' into feature-metadata-dialogue
ethanwu155 b99d4d5
fixed import in information
ethanwu155 c1b037b
Merge branch 'feature-metadata-dialogue' of https://github.com/number…
ethanwu155 fbb387d
Add basic spec for InformationPage.
seanwu1105 a230db1
Format spaces: 2
seanwu1105 12185cd
Merge branch 'develop' into feature-metadata-dialogue
seanwu1105 3f4b84d
edited information.page
ethanwu155 1209a11
edited proof.page
ethanwu155 e39ac6d
edit capacitor-provider
ethanwu155 199f951
added enum importance & informationtype
ethanwu155 d6ce508
edited en-us.json
ethanwu155 a779c23
removed extra comments
ethanwu155 9549aec
change spacing
ethanwu155 58f7fcc
changed important attribute to importance
ethanwu155 cc0a6b8
fixed formatting
ethanwu155 bc4197e
fix Unexpected missing end-of-source newline (no-missing-end-of-sourc…
ethanwu155 565a7a8
fix Unexpected missing end-of-source newline (no-missing-end-of-sourc…
ethanwu155 e1803b6
Merge branch 'develop' into feature-metadata-dialogue
seanwu1105 ffe49c4
Improve readability.
seanwu1105 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { NgModule } from '@angular/core'; | ||
| import { RouterModule, Routes } from '@angular/router'; | ||
| import { InformationPage } from './information.page'; | ||
|
|
||
| const routes: Routes = [{ | ||
| path: '', | ||
| component: InformationPage | ||
| }]; | ||
|
|
||
| @NgModule({ | ||
| imports: [RouterModule.forChild(routes)], | ||
| exports: [RouterModule], | ||
| }) | ||
| export class InformationPageRoutingModule { } |
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 { CommonModule } from '@angular/common'; | ||
| import { NgModule } from '@angular/core'; | ||
| import { FormsModule } from '@angular/forms'; | ||
| import { IonicModule } from '@ionic/angular'; | ||
| import { TranslocoModule } from '@ngneat/transloco'; | ||
| import { InformationPageRoutingModule } from './information-routing.module'; | ||
| import { InformationPage } from './information.page'; | ||
|
|
||
| @NgModule({ | ||
| imports: [ | ||
| CommonModule, | ||
| FormsModule, | ||
| IonicModule, | ||
| InformationPageRoutingModule, | ||
| TranslocoModule | ||
| ], | ||
| declarations: [InformationPage] | ||
| }) | ||
| export class InformationPageModule { } |
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,69 @@ | ||
| <ion-header *transloco="let t"> | ||
| <ion-toolbar> | ||
| <ion-buttons slot="start"> | ||
| <ion-button [routerLink]="['/proof', {hash: (hash$ | async)}]" routerDirection="back"> | ||
| <ion-icon slot="icon-only" name="arrow-back"></ion-icon> | ||
| </ion-button> | ||
| </ion-buttons> | ||
| <ion-title>{{ t('informationDetails') }}</ion-title> | ||
| </ion-toolbar> | ||
| </ion-header> | ||
| <ion-content *transloco="let t"> | ||
| <ion-item> | ||
| <ion-slide> | ||
| <ion-card class="slide-card"> | ||
| <ion-card-header> | ||
| <ion-card-title>{{ t('location') }}</ion-card-title> | ||
| </ion-card-header> | ||
| <ion-card-content> | ||
| <ion-list lines="none" *ngFor="let information of (locationInformation$ | async)"> | ||
| <ion-item> | ||
| <ion-label class="ion-text-wrap"> | ||
| <h3>{{ information.name }}</h3> | ||
| <p>{{ information.value }}</p> | ||
| </ion-label> | ||
| </ion-item> | ||
| </ion-list> | ||
| </ion-card-content> | ||
| </ion-card> | ||
| </ion-slide> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-slide> | ||
| <ion-card class="slide-card"> | ||
| <ion-card-header> | ||
| <ion-card-title>{{ t('other') }}</ion-card-title> | ||
| </ion-card-header> | ||
| <ion-card-content> | ||
| <ion-list lines="none" *ngFor="let information of (otherInformation$ | async)"> | ||
| <ion-item> | ||
| <ion-label class="ion-text-wrap"> | ||
| <h3>{{ information.name }}</h3> | ||
| <p>{{ information.value }}</p> | ||
| </ion-label> | ||
| </ion-item> | ||
| </ion-list> | ||
| </ion-card-content> | ||
| </ion-card> | ||
| </ion-slide> | ||
| </ion-item> | ||
| <ion-item> | ||
| <ion-slide> | ||
| <ion-card class="slide-card"> | ||
| <ion-card-header> | ||
| <ion-card-title>{{ t('device') }}</ion-card-title> | ||
| </ion-card-header> | ||
| <ion-card-content> | ||
| <ion-list lines="none" *ngFor="let information of (deviceInformation$ | async)"> | ||
| <ion-item> | ||
| <ion-label class="ion-text-wrap"> | ||
| <h3>{{ information.name }}</h3> | ||
| <p>{{ information.value }}</p> | ||
| </ion-label> | ||
| </ion-item> | ||
| </ion-list> | ||
| </ion-card-content> | ||
| </ion-card> | ||
| </ion-slide> | ||
| </ion-item> | ||
| </ion-content> | ||
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,7 @@ | ||
| .slide-card { | ||
| width: 100%; | ||
| } | ||
|
|
||
| .multiline { | ||
| white-space: pre-wrap; | ||
| } |
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,25 @@ | ||
| import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
| import { RouterTestingModule } from '@angular/router/testing'; | ||
| import { IonicModule } from '@ionic/angular'; | ||
| import { getTranslocoModule } from 'src/app/transloco/transloco-root.module.spec'; | ||
| import { InformationPage } from './information.page'; | ||
|
|
||
| describe('InformationPage', () => { | ||
| let component: InformationPage; | ||
| let fixture: ComponentFixture<InformationPage>; | ||
|
|
||
| beforeEach(async(() => { | ||
| TestBed.configureTestingModule({ | ||
| declarations: [InformationPage], | ||
| imports: [IonicModule.forRoot(), RouterTestingModule, getTranslocoModule()] | ||
| }).compileComponents(); | ||
|
|
||
| fixture = TestBed.createComponent(InformationPage); | ||
| component = fixture.componentInstance; | ||
| fixture.detectChanges(); | ||
| })); | ||
|
|
||
| it('should create', () => { | ||
| expect(component).toBeTruthy(); | ||
| }); | ||
| }); |
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,54 @@ | ||
| import { Component } from '@angular/core'; | ||
| import { ActivatedRoute } from '@angular/router'; | ||
| import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | ||
| import { map, pluck, switchMap, switchMapTo } from 'rxjs/operators'; | ||
| import { InformationType } from 'src/app/services/data/information/information'; | ||
| import { InformationRepository } from 'src/app/services/data/information/information-repository.service'; | ||
| import { ProofRepository } from 'src/app/services/data/proof/proof-repository.service'; | ||
| import { isNonNullable } from 'src/app/utils/rx-operators'; | ||
|
|
||
| @UntilDestroy({ checkProperties: true }) | ||
| @Component({ | ||
| selector: 'app-information', | ||
| templateUrl: './information.page.html', | ||
| styleUrls: ['./information.page.scss'], | ||
| }) | ||
| export class InformationPage { | ||
|
|
||
| readonly proof$ = this.route.paramMap.pipe( | ||
| map(params => params.get('hash')), | ||
| isNonNullable(), | ||
| switchMap(hash => this.proofRepository.getByHash$(hash)), | ||
| isNonNullable() | ||
| ); | ||
|
|
||
| readonly hash$ = this.proof$.pipe(pluck('hash')); | ||
|
|
||
| readonly locationInformation$ = this.proof$.pipe( | ||
seanwu1105 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| switchMap(proof => this.informationRepository.getByProof$(proof)), | ||
| map(informationList => informationList.filter(information => information.type === InformationType.Location)) | ||
| ); | ||
|
|
||
| readonly otherInformation$ = this.proof$.pipe( | ||
| switchMap(proof => this.informationRepository.getByProof$(proof)), | ||
| map(informationList => informationList.filter(information => information.type === InformationType.Other)) | ||
| ); | ||
|
|
||
| readonly deviceInformation$ = this.proof$.pipe( | ||
| switchMap(proof => this.informationRepository.getByProof$(proof)), | ||
| map(informationList => informationList.filter(information => information.type === InformationType.Device)) | ||
| ); | ||
|
|
||
| constructor( | ||
| private readonly route: ActivatedRoute, | ||
| private readonly proofRepository: ProofRepository, | ||
| private readonly informationRepository: InformationRepository, | ||
| ) { } | ||
|
|
||
| ionViewWillEnter() { | ||
| this.proofRepository.refresh$().pipe( | ||
| switchMapTo(this.informationRepository.refresh$()), | ||
| untilDestroyed(this) | ||
| ).subscribe(); | ||
| } | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.