diff --git a/src/app/core/components/all-archives/all-archives.component.ts b/src/app/core/components/all-archives/all-archives.component.ts index 45007139d..48445f9b5 100644 --- a/src/app/core/components/all-archives/all-archives.component.ts +++ b/src/app/core/components/all-archives/all-archives.component.ts @@ -1,4 +1,13 @@ -import { Component, OnInit, AfterViewInit, QueryList, ViewChildren, Optional, OnDestroy, ViewChild } from '@angular/core'; +import { + Component, + OnInit, + AfterViewInit, + QueryList, + ViewChildren, + Optional, + OnDestroy, + ViewChild, +} from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Validators } from '@angular/forms'; @@ -6,7 +15,11 @@ import { remove, orderBy, partition } from 'lodash'; import { Deferred } from '@root/vendor/deferred'; import { AccountService } from '@shared/services/account/account.service'; -import { PromptService, PromptButton, PromptField } from '@shared/services/prompt/prompt.service'; +import { + PromptService, + PromptButton, + PromptField, +} from '@shared/services/prompt/prompt.service'; import { MessageService } from '@shared/services/message/message.service'; import { ArchiveVO, FolderVO } from '@root/app/models'; @@ -22,7 +35,7 @@ import { CdkPortal } from '@angular/cdk/portal'; @Component({ selector: 'pr-all-archives', templateUrl: './all-archives.component.html', - styleUrls: ['./all-archives.component.scss'] + styleUrls: ['./all-archives.component.scss'], }) export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { public currentArchive: ArchiveVO; @@ -42,28 +55,36 @@ export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { private router: Router, @Optional() private portalService: SidebarActionPortalService ) { - - this.data.setCurrentFolder(new FolderVO({ - displayName: 'Archives', - pathAsText: ['Archives'], - type: 'page' - })); + this.data.setCurrentFolder( + new FolderVO({ + displayName: 'Archives', + pathAsText: ['Archives'], + type: 'page', + }) + ); this.currentArchive = accountService.getArchive(); const archivesData = this.route.snapshot.data['archives'] || []; - const archives = orderBy(archivesData.map((archiveData) => { - return new ArchiveVO(archiveData); - }), 'fullName'); - const currentArchiveFetched = remove(archives, { archiveId: this.currentArchive.archiveId })[0] as ArchiveVO; + const archives = orderBy( + archivesData.map((archiveData) => { + return new ArchiveVO(archiveData); + }), + 'fullName' + ); + const currentArchiveFetched = remove(archives, { + archiveId: this.currentArchive.archiveId, + })[0] as ArchiveVO; this.currentArchive.update(currentArchiveFetched); this.accountService.setArchive(this.currentArchive); - [ this.pendingArchives, this.archives ] = partition(archives as ArchiveVO[], a => a.isPending()); + [this.pendingArchives, this.archives] = partition( + archives as ArchiveVO[], + (a) => a.isPending() + ); } - ngOnInit() { - } + ngOnInit() {} ngAfterViewInit() { if (this.portalService) { @@ -83,25 +104,33 @@ export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { const buttons: PromptButton[] = [ { buttonName: 'switch', - buttonText: archive.isPending() ? 'Accept and switch archive' : 'Switch archive' + buttonText: archive.isPending() + ? 'Accept and switch archive' + : 'Switch archive', }, { buttonName: 'cancel', buttonText: 'Cancel', - class: 'btn-secondary' - } + class: 'btn-secondary', + }, ]; let message = `Switch to The ${archive.fullName} Archive?`; if (archive.isPending()) { - message = `You have been invited to collaborate on the ${archive.fullName} archive. Accept ${this.prConstants.translate(archive.accessRole)} access and switch?`; + message = `You have been invited to collaborate on the ${ + archive.fullName + } archive. Accept ${this.prConstants.translate( + archive.accessRole + )} access and switch?`; } - this.prompt.promptButtons(buttons, message, deferred.promise) + this.prompt + .promptButtons(buttons, message, deferred.promise) .then((result) => { if (result === 'switch') { - let acceptIfNeeded: Promise = Promise.resolve(); + let acceptIfNeeded: Promise = + Promise.resolve(); if (archive.isPending()) { acceptIfNeeded = this.api.archive.accept(archive); @@ -160,9 +189,7 @@ export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { } } - async onRemoveClick(archive: ArchiveVO) { - - } + async onRemoveClick(archive: ArchiveVO) {} onCreateArchiveClick() { const deferred = new Deferred(); @@ -175,9 +202,9 @@ export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { autocapitalize: 'off', autocorrect: 'off', autocomplete: 'off', - spellcheck: 'off' + spellcheck: 'off', }, - validators: [Validators.required] + validators: [Validators.required], }, { fieldName: 'type', @@ -187,22 +214,27 @@ export class AllArchivesComponent implements OnInit, AfterViewInit, OnDestroy { selectOptions: [ { text: 'Person', - value: 'type.archive.person' + value: 'type.archive.person', + }, + { + text: 'Group', + value: 'type.archive.group', }, { - text: 'Family', - value: 'type.archive.family' + text: 'Group', + value: 'type.archive.family', }, { text: 'Organization', - value: 'type.archive.organization' - } - ] + value: 'type.archive.organization', + }, + ], }, - RELATIONSHIP_FIELD + RELATIONSHIP_FIELD, ]; - this.prompt.prompt(fields, 'Create new archive', deferred.promise, 'Create archive') + this.prompt + .prompt(fields, 'Create new archive', deferred.promise, 'Create archive') .then((value) => { return this.api.archive.create(new ArchiveVO(value)); }) diff --git a/src/app/core/components/archive-switcher/archive-switcher.component.ts b/src/app/core/components/archive-switcher/archive-switcher.component.ts index ac293b01e..c1c3d20ba 100644 --- a/src/app/core/components/archive-switcher/archive-switcher.component.ts +++ b/src/app/core/components/archive-switcher/archive-switcher.component.ts @@ -1,4 +1,10 @@ -import { Component, OnInit, AfterViewInit, QueryList, ViewChildren } from '@angular/core'; +import { + Component, + OnInit, + AfterViewInit, + QueryList, + ViewChildren, +} from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Validators } from '@angular/forms'; @@ -7,7 +13,11 @@ import { Deferred } from '@root/vendor/deferred'; import { gsap } from 'gsap'; import { AccountService } from '@shared/services/account/account.service'; -import { PromptService, PromptButton, PromptField } from '@shared/services/prompt/prompt.service'; +import { + PromptService, + PromptButton, + PromptField, +} from '@shared/services/prompt/prompt.service'; import { MessageService } from '@shared/services/message/message.service'; import { ArchiveVO, FolderVO } from '@root/app/models'; @@ -22,7 +32,7 @@ import { DataService } from '@shared/services/data/data.service'; @Component({ selector: 'pr-archive-switcher', templateUrl: './archive-switcher.component.html', - styleUrls: ['./archive-switcher.component.scss'] + styleUrls: ['./archive-switcher.component.scss'], }) export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { public currentArchive: ArchiveVO; @@ -37,19 +47,25 @@ export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { private message: MessageService, private router: Router ) { - - this.data.setCurrentFolder(new FolderVO({ - displayName: 'Archives', - pathAsText: ['Archives'], - type: 'page' - })); + this.data.setCurrentFolder( + new FolderVO({ + displayName: 'Archives', + pathAsText: ['Archives'], + type: 'page', + }) + ); this.currentArchive = accountService.getArchive(); const archivesData = this.route.snapshot.data['archives'] || []; - const archives = orderBy(archivesData.map((archiveData) => { - return new ArchiveVO(archiveData); - }), 'fullName'); - const currentArchiveFetched = remove(archives, { archiveId: this.currentArchive.archiveId })[0] as ArchiveVO; + const archives = orderBy( + archivesData.map((archiveData) => { + return new ArchiveVO(archiveData); + }), + 'fullName' + ); + const currentArchiveFetched = remove(archives, { + archiveId: this.currentArchive.archiveId, + })[0] as ArchiveVO; this.currentArchive.update(currentArchiveFetched); this.accountService.setArchive(this.currentArchive); @@ -57,22 +73,20 @@ export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { this.archives = archives as ArchiveVO[]; } - ngOnInit() { - } + ngOnInit() {} ngAfterViewInit() { - const targetElems = document.querySelectorAll('.archive-list pr-archive-small'); - gsap.from( - targetElems, - { - duration: 0.75, - opacity: 0, - ease: 'Power4.easeOut', - stagger: { - amount: 0.5 - } - } - ); + const targetElems = document.querySelectorAll( + '.archive-list pr-archive-small' + ); + gsap.from(targetElems, { + duration: 0.75, + opacity: 0, + ease: 'Power4.easeOut', + stagger: { + amount: 0.5, + }, + }); } archiveClick(archive: ArchiveVO) { @@ -81,25 +95,33 @@ export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { const buttons: PromptButton[] = [ { buttonName: 'switch', - buttonText: archive.isPending() ? 'Accept and switch archive' : 'Switch archive' + buttonText: archive.isPending() + ? 'Accept and switch archive' + : 'Switch archive', }, { buttonName: 'cancel', buttonText: 'Cancel', - class: 'btn-secondary' - } + class: 'btn-secondary', + }, ]; let message = `Switch to The ${archive.fullName} Archive?`; if (archive.isPending()) { - message = `You have been invited to collaborate on the ${archive.fullName} archive. Accept ${this.prConstants.translate(archive.accessRole)} access and switch?`; + message = `You have been invited to collaborate on the ${ + archive.fullName + } archive. Accept ${this.prConstants.translate( + archive.accessRole + )} access and switch?`; } - this.prompt.promptButtons(buttons, message, deferred.promise) + this.prompt + .promptButtons(buttons, message, deferred.promise) .then((result) => { if (result === 'switch') { - let acceptIfNeeded: Promise = Promise.resolve(); + let acceptIfNeeded: Promise = + Promise.resolve(); if (archive.isPending()) { acceptIfNeeded = this.api.archive.accept(archive); @@ -134,9 +156,9 @@ export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { autocapitalize: 'off', autocorrect: 'off', autocomplete: 'off', - spellcheck: 'off' + spellcheck: 'off', }, - validators: [Validators.required] + validators: [Validators.required], }, { fieldName: 'type', @@ -146,22 +168,27 @@ export class ArchiveSwitcherComponent implements OnInit, AfterViewInit { selectOptions: [ { text: 'Person', - value: 'type.archive.person' + value: 'type.archive.person', + }, + { + text: 'Group', + value: 'type.archive.group', }, { - text: 'Family', - value: 'type.archive.family' + text: 'Group', + value: 'type.archive.family', }, { text: 'Organization', - value: 'type.archive.organization' - } - ] + value: 'type.archive.organization', + }, + ], }, - RELATIONSHIP_FIELD + RELATIONSHIP_FIELD, ]; - this.prompt.prompt(fields, 'Create new archive', deferred.promise, 'Create archive') + this.prompt + .prompt(fields, 'Create new archive', deferred.promise, 'Create archive') .then((value) => { return this.api.archive.create(new ArchiveVO(value)); }) diff --git a/src/app/core/components/my-archives-dialog/my-archives-dialog.component.ts b/src/app/core/components/my-archives-dialog/my-archives-dialog.component.ts index f9f8782ab..2e7ddddcf 100644 --- a/src/app/core/components/my-archives-dialog/my-archives-dialog.component.ts +++ b/src/app/core/components/my-archives-dialog/my-archives-dialog.component.ts @@ -1,5 +1,17 @@ -import { Component, OnInit, ViewChild, ElementRef, ViewChildren, QueryList, Inject } from '@angular/core'; -import { IsTabbedDialog, DialogRef, DIALOG_DATA } from '@root/app/dialog/dialog.module'; +import { + Component, + OnInit, + ViewChild, + ElementRef, + ViewChildren, + QueryList, + Inject, +} from '@angular/core'; +import { + IsTabbedDialog, + DialogRef, + DIALOG_DATA, +} from '@root/app/dialog/dialog.module'; import { ArchiveVO, AccountVO } from '@models'; import { AccountService } from '@shared/services/account/account.service'; import { Router } from '@angular/router'; @@ -9,8 +21,15 @@ import { ArchiveResponse } from '@shared/services/api/archive.repo'; import { MessageService } from '@shared/services/message/message.service'; import { ArchiveSmallComponent } from '@shared/components/archive-small/archive-small.component'; import { ArchiveType } from '@models/archive-vo'; -import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms'; -import { RELATION_OPTIONS, PromptService } from '@shared/services/prompt/prompt.service'; +import { + UntypedFormGroup, + UntypedFormBuilder, + Validators, +} from '@angular/forms'; +import { + RELATION_OPTIONS, + PromptService, +} from '@shared/services/prompt/prompt.service'; export type MyArchivesTab = 'switch' | 'new' | 'pending'; @@ -20,25 +39,29 @@ interface ArchiveFormData { relationType: string; } -const ARCHIVE_TYPES: { text: string, value: ArchiveType }[] = [ +const ARCHIVE_TYPES: { text: string; value: ArchiveType }[] = [ { text: 'Person', - value: 'type.archive.person' + value: 'type.archive.person', }, { - text: 'Family', - value: 'type.archive.family' + text: 'Group', + value: 'type.archive.group', + }, + { + text: 'Group', + value: 'type.archive.family', }, { text: 'Organization', - value: 'type.archive.organization' + value: 'type.archive.organization', }, ]; @Component({ selector: 'pr-my-archives-dialog', templateUrl: './my-archives-dialog.component.html', - styleUrls: ['./my-archives-dialog.component.scss'] + styleUrls: ['./my-archives-dialog.component.scss'], }) export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { account: AccountVO; @@ -54,7 +77,8 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { activeTab: MyArchivesTab = 'switch'; @ViewChild('panel') panelElem: ElementRef; - @ViewChildren(ArchiveSmallComponent) archiveComponents: QueryList; + @ViewChildren(ArchiveSmallComponent) + archiveComponents: QueryList; constructor( private dialogRef: DialogRef, @@ -63,12 +87,12 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { private api: ApiService, private prompt: PromptService, private message: MessageService, - private fb: UntypedFormBuilder, + private fb: UntypedFormBuilder ) { this.newArchiveForm = this.fb.group({ fullName: ['', [Validators.required]], type: [ARCHIVE_TYPES[0].value, [Validators.required]], - relationType: [null] + relationType: [null], }); if (this.data && this.data.activeTab) { @@ -80,8 +104,10 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { this.account = this.accountService.getAccount(); this.currentArchive = this.accountService.getArchive(); [this.pendingArchives, this.archives] = partition( - orderBy(this.accountService.getArchives(), a => a.fullName.toLowerCase()), - { status: 'status.generic.pending'} + orderBy(this.accountService.getArchives(), (a) => + a.fullName.toLowerCase() + ), + { status: 'status.generic.pending' } ); } @@ -96,9 +122,14 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { scrollToArchive(archive: ArchiveVO) { setTimeout(() => { - const component = find(this.archiveComponents.toArray(), cmp => cmp.archive === archive); + const component = find( + this.archiveComponents.toArray(), + (cmp) => cmp.archive === archive + ); if (component) { - (component.element.nativeElement as HTMLElement).scrollIntoView({behavior: 'smooth'}); + (component.element.nativeElement as HTMLElement).scrollIntoView({ + behavior: 'smooth', + }); } }); } @@ -116,27 +147,41 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { } async onArchiveMakeDefaultClick(archive: ArchiveVO) { - if (archive.isPendingAction || archive.archiveId === this.account.defaultArchiveId) { + if ( + archive.isPendingAction || + archive.archiveId === this.account.defaultArchiveId + ) { return; } try { archive.isPendingAction = true; - const updateAccount = new AccountVO({defaultArchiveId: archive.archiveId}); + const updateAccount = new AccountVO({ + defaultArchiveId: archive.archiveId, + }); await this.accountService.updateAccount(updateAccount); } catch (err) { - this.message.showError('There was a problem changing the default archive.', false); + this.message.showError( + 'There was a problem changing the default archive.', + false + ); } finally { archive.isPendingAction = false; } } async onArchiveDeleteClick(archive: ArchiveVO) { - if (this.currentArchive.archiveId === archive.archiveId || archive.accessRole !== 'access.role.owner') { + if ( + this.currentArchive.archiveId === archive.archiveId || + archive.accessRole !== 'access.role.owner' + ) { return; } - if (archive.isPendingAction || archive.archiveId === this.account.defaultArchiveId) { + if ( + archive.isPendingAction || + archive.archiveId === this.account.defaultArchiveId + ) { return; } @@ -147,7 +192,7 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { 'Are you sure you want to permanently delete this archive?', null, 'btn-danger' - ); + ); } catch (err) { return; } @@ -156,7 +201,10 @@ export class MyArchivesDialogComponent implements OnInit, IsTabbedDialog { await this.api.archive.delete(archive); remove(this.archives, archive); } catch (err) { - this.message.showError('There was a problem deleting this archive.', false); + this.message.showError( + 'There was a problem deleting this archive.', + false + ); archive.isPendingAction = false; } } diff --git a/src/app/core/components/profile-edit/profile-edit.component.html b/src/app/core/components/profile-edit/profile-edit.component.html index 347de1ef1..41e03f01c 100644 --- a/src/app/core/components/profile-edit/profile-edit.component.html +++ b/src/app/core/components/profile-edit/profile-edit.component.html @@ -10,24 +10,32 @@
-
+ [class.active]="scrollNav.activeSectionId === 'about'" + > About This Archive
-
+ [class.active]="scrollNav.activeSectionId === 'info'" + > Person Information
-
+ [class.active]="scrollNav.activeSectionId === 'online'" + > Online Presence
-
+ [class.active]="scrollNav.activeSectionId === 'milestones'" + > Milestones
@@ -37,18 +45,26 @@
Profile Visibility
- + id="profile-public-toggle" + />
- + id="profile-private-toggle" + />
- View On Web - + >View On Web +
- Profile 0 complete + Profile 0 complete
-
+
- The more fields you fill out, the more likely others will be able to find you online. + The more fields you fill out, the more likely others will be able + to find you online.
-
-
+
+
-
- camera_alt Change Banner -
+
camera_alt Change Banner
-
+
-
- camera_alt Change Photo -
+
camera_alt Change Photo
-
- The name of this Archive is… -
+
The name of this Archive is…
The
- + (doneEditing)=" + onSaveProfileItem( + this.profileItems.basic[0], + 'string1', + $event, + true + ) + " + >
Archive
-
- What is this Archive for? -
+
What is this Archive for?
- -
-
- 280 character limit + (doneEditing)=" + onSaveProfileItem( + this.profileItems.blurb[0], + 'string1', + $event + ) + " + >
+
280 character limit
- Tell us about this {{this.archive.type | prConstants | titlecase}} + Tell us about this + {{ this.archive.type | prConstants | titlecase }}
- +
- {{this.archive.type | prConstants | titlecase}} Information + {{ this.archive.type | prConstants | titlecase }} Information
- - - + + + -
- - - + + + -
-
+
-
@@ -184,21 +288,36 @@
-
-
@@ -208,21 +327,38 @@
-
-
@@ -238,58 +374,104 @@
- - +
- - +
-
+
Milestones
- Milestones capture any significant event in the history of this archive, and are ordered from most recent to least recent. + Milestones capture any significant event in the history of this + archive, and are ordered from most recent to least recent.
-
+
-
-
@@ -297,46 +479,64 @@
-
-
- -
- 200 character limit -
+
200 character limit
-
- +
diff --git a/src/app/core/components/public-settings/public-settings.component.ts b/src/app/core/components/public-settings/public-settings.component.ts index ae33803a0..f061682b9 100644 --- a/src/app/core/components/public-settings/public-settings.component.ts +++ b/src/app/core/components/public-settings/public-settings.component.ts @@ -24,7 +24,7 @@ export class PublicSettingsComponent implements OnInit { }); public archiveTypes: { value: string; name: string }[] = [ - { value: 'type.archive.family', name: 'Group' }, + { value: 'type.archive.group', name: 'Group' }, { value: 'type.archive.organization', name: 'Organization', @@ -41,7 +41,10 @@ export class PublicSettingsComponent implements OnInit { ngOnInit(): void { this.allowDownloadsToggle = +this.archive.allowPublicDownload; - this.archiveType = this.archive.type; + this.archiveType = + this.archive.type === 'type.archive.family' + ? 'type.archive.group' + : this.archive.type; } public async onAllowDownloadsChange() { diff --git a/src/app/gallery/components/featured-archive/featured-archive.component.spec.ts b/src/app/gallery/components/featured-archive/featured-archive.component.spec.ts index f98fd3537..75428ffbd 100644 --- a/src/app/gallery/components/featured-archive/featured-archive.component.spec.ts +++ b/src/app/gallery/components/featured-archive/featured-archive.component.spec.ts @@ -58,6 +58,7 @@ describe('FeaturedArchiveComponent', () => { } expectClassnameForArchiveType('type.archive.person', 'personal'); + expectClassnameForArchiveType('type.archive.group', 'group'); expectClassnameForArchiveType('type.archive.family', 'group'); expectClassnameForArchiveType('type.archive.organization', 'organization'); expectClassnameForArchiveType('type.archive.nonprofit', 'organization'); diff --git a/src/app/gallery/components/featured-archive/featured-archive.component.ts b/src/app/gallery/components/featured-archive/featured-archive.component.ts index 7bc36bdb2..1cb0c70bf 100644 --- a/src/app/gallery/components/featured-archive/featured-archive.component.ts +++ b/src/app/gallery/components/featured-archive/featured-archive.component.ts @@ -21,7 +21,10 @@ export class FeaturedArchiveComponent implements OnInit { const classes = ['featured-archive']; if (this.archive.type === 'type.archive.person') { classes.push('personal'); - } else if (this.archive.type === 'type.archive.family') { + } else if ( + this.archive.type === 'type.archive.group' || + this.archive.type === 'type.archive.family' + ) { classes.push('group'); } else { classes.push('organization'); diff --git a/src/app/gallery/pipes/archive-type-name.pipe.spec.ts b/src/app/gallery/pipes/archive-type-name.pipe.spec.ts index f19328dc2..601e0d354 100644 --- a/src/app/gallery/pipes/archive-type-name.pipe.spec.ts +++ b/src/app/gallery/pipes/archive-type-name.pipe.spec.ts @@ -16,6 +16,7 @@ describe('ArchiveTypeNamePipe', () => { } expectNameForType('type.archive.person', 'Personal Archive'); + expectNameForType('type.archive.group', 'Group Archive'); expectNameForType('type.archive.family', 'Group Archive'); expectNameForType('type.archive.organization', 'Organizational Archive'); expectNameForType('type.archive.nonprofit', 'Organizational Archive'); diff --git a/src/app/gallery/pipes/archive-type-name.pipe.ts b/src/app/gallery/pipes/archive-type-name.pipe.ts index 2db176ddc..c6c4ac3aa 100644 --- a/src/app/gallery/pipes/archive-type-name.pipe.ts +++ b/src/app/gallery/pipes/archive-type-name.pipe.ts @@ -14,6 +14,7 @@ export class ArchiveTypeNamePipe implements PipeTransform { switch (type) { case 'type.archive.person': return 'Personal'; + case 'type.archive.group': case 'type.archive.family': return 'Group'; case 'type.archive.organization': diff --git a/src/app/models/archive-vo.ts b/src/app/models/archive-vo.ts index f6878d138..c03a27b4a 100644 --- a/src/app/models/archive-vo.ts +++ b/src/app/models/archive-vo.ts @@ -1,3 +1,4 @@ +/* @format */ import { BaseVO, DynamicListChild } from '@models/base-vo'; import { FolderVO } from '@models/folder-vo'; import { RecordVO } from '@models/record-vo'; @@ -7,6 +8,7 @@ import { ItemVO } from '.'; export type ArchiveType = | 'type.archive.person' + | 'type.archive.group' | 'type.archive.family' | 'type.archive.organization' | 'type.archive.nonprofit'; diff --git a/src/app/onboarding/components/archive-type-select/archive-type-select.component.ts b/src/app/onboarding/components/archive-type-select/archive-type-select.component.ts index c4a629d29..60bc08799 100644 --- a/src/app/onboarding/components/archive-type-select/archive-type-select.component.ts +++ b/src/app/onboarding/components/archive-type-select/archive-type-select.component.ts @@ -24,6 +24,7 @@ export class ArchiveTypeSelectComponent { icons = { 'type.archive.person': 'assets/svg/onboarding/archive-person.svg', + 'type.archive.group': 'assets/svg/onboarding/archive-group.svg', 'type.archive.family': 'assets/svg/onboarding/archive-group.svg', 'type.archive.organization': 'assets/svg/onboarding/archive-organization.svg', @@ -31,7 +32,8 @@ export class ArchiveTypeSelectComponent { altTexts = { 'type.archive.person': 'Person Archive', - 'type.archive.family': 'Family Archive', + 'type.archive.group': 'Group Archive', + 'type.archive.family': 'Group Archive', 'type.archive.organization': 'Organization Archive', }; diff --git a/src/app/onboarding/shared/onboarding-screen.ts b/src/app/onboarding/shared/onboarding-screen.ts index b76ed2a84..0f3d5874f 100644 --- a/src/app/onboarding/shared/onboarding-screen.ts +++ b/src/app/onboarding/shared/onboarding-screen.ts @@ -111,17 +111,17 @@ export const archiveOptions = [ type: OnboardingTypes.individual, }, { - value: 'type.archive.family', + value: 'type.archive.group', text: 'My family in the present', type: OnboardingTypes.family, }, { - value: 'type.archive.family', + value: 'type.archive.group', text: "My family's history", type: OnboardingTypes.famhist, }, { - value: 'type.archive.family', + value: 'type.archive.group', text: "A community I'm part of", type: OnboardingTypes.community, }, diff --git a/src/app/shared/components/new-archive-form/new-archive-form.component.ts b/src/app/shared/components/new-archive-form/new-archive-form.component.ts index 58ae24412..2d11877d1 100644 --- a/src/app/shared/components/new-archive-form/new-archive-form.component.ts +++ b/src/app/shared/components/new-archive-form/new-archive-form.component.ts @@ -1,4 +1,12 @@ -import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'; +import { + Component, + ElementRef, + EventEmitter, + Input, + OnInit, + Output, + ViewChild, +} from '@angular/core'; import { ArchiveVO, ArchiveType } from '@models/archive-vo'; import { ApiService } from '@shared/services/api/api.service'; import { RELATION_OPTIONS } from '@shared/services/prompt/prompt.service'; @@ -9,25 +17,25 @@ export interface ArchiveFormData { relationType?: string; } -const ARCHIVE_TYPES: { text: string, value: ArchiveType }[] = [ +const ARCHIVE_TYPES: { text: string; value: ArchiveType }[] = [ { text: 'Person', - value: 'type.archive.person' + value: 'type.archive.person', }, { text: 'Group', - value: 'type.archive.family' + value: 'type.archive.group', }, { text: 'Organization', - value: 'type.archive.organization' + value: 'type.archive.organization', }, ]; @Component({ selector: 'pr-new-archive-form', templateUrl: './new-archive-form.component.html', - styleUrls: ['./new-archive-form.component.scss'] + styleUrls: ['./new-archive-form.component.scss'], }) export class NewArchiveFormComponent implements OnInit { @Input() showRelations: boolean = false; @@ -39,9 +47,7 @@ export class NewArchiveFormComponent implements OnInit { public waiting: boolean = false; public formData: ArchiveFormData; - constructor( - private api: ApiService, - ) { + constructor(private api: ApiService) { this.formData = { fullName: '', type: null, @@ -49,11 +55,13 @@ export class NewArchiveFormComponent implements OnInit { }; } - ngOnInit(): void { - } + ngOnInit(): void {} public isFormValid() { - return this.fullNameRef?.nativeElement.validity.valid && this.formData.type !== null; + return ( + this.fullNameRef?.nativeElement.validity.valid && + this.formData.type !== null + ); } public async onSubmit() { @@ -62,7 +70,9 @@ export class NewArchiveFormComponent implements OnInit { } try { this.waiting = true; - const response = await this.api.archive.create(new ArchiveVO(this.formData)); + const response = await this.api.archive.create( + new ArchiveVO(this.formData) + ); const newArchive = response.getArchiveVO(); this.success.emit(newArchive); } catch (err) { @@ -71,5 +81,4 @@ export class NewArchiveFormComponent implements OnInit { this.waiting = false; } } - } diff --git a/src/app/shared/services/api/archive.repo.spec.ts b/src/app/shared/services/api/archive.repo.spec.ts index 513ccb0e9..6c1d2da9b 100644 --- a/src/app/shared/services/api/archive.repo.spec.ts +++ b/src/app/shared/services/api/archive.repo.spec.ts @@ -1,11 +1,22 @@ import { TestBed, inject } from '@angular/core/testing'; -import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; +import { + HttpClientTestingModule, + HttpTestingController, +} from '@angular/common/http/testing'; import { environment } from '@root/environments/environment'; import { TEST_DATA, TEST_DATA_2 } from '@core/core.module.spec'; import { HttpService, Observable } from '@shared/services/http/http.service'; -import { ArchiveRepo, ArchiveResponse } from '@shared/services/api/archive.repo'; -import { SimpleVO, AccountPasswordVO, AccountVO, ArchiveVO } from '@root/app/models'; +import { + ArchiveRepo, + ArchiveResponse, +} from '@shared/services/api/archive.repo'; +import { + SimpleVO, + AccountPasswordVO, + AccountVO, + ArchiveVO, +} from '@root/app/models'; describe('ArchiveRepo', () => { let repo: ArchiveRepo; @@ -13,10 +24,8 @@ describe('ArchiveRepo', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - HttpClientTestingModule - ], - providers: [HttpService] + imports: [HttpClientTestingModule], + providers: [HttpService], }); repo = new ArchiveRepo(TestBed.get(HttpService)); @@ -30,10 +39,14 @@ describe('ArchiveRepo', () => { it('should get a single archive', () => { const expected = require('@root/test/responses/archive.get.single.success.json'); - repo.get([TEST_DATA.archive]) - .then((response) => { - expect(response.getArchiveVO().archiveId).toEqual(TEST_DATA.archive.archiveId); - expect(response.getArchiveVO().archiveNbr).toEqual(TEST_DATA.archive.archiveNbr); + repo.get([TEST_DATA.archive]).then((response) => { + expect(response.getArchiveVO().archiveId).toEqual( + TEST_DATA.archive.archiveId + ); + + expect(response.getArchiveVO().archiveNbr).toEqual( + TEST_DATA.archive.archiveNbr + ); }); const req = httpMock.expectOne(`${environment.apiUrl}/archive/get`); @@ -43,8 +56,7 @@ describe('ArchiveRepo', () => { it('should get multiple archives', () => { const expected = require('@root/test/responses/archive.get.multiple.success.json'); - repo.get([TEST_DATA.archive, TEST_DATA_2.archive]) - .then((response) => { + repo.get([TEST_DATA.archive, TEST_DATA_2.archive]).then((response) => { const archives = response.getArchiveVOs(); expect(archives.length).toBe(2); @@ -62,15 +74,31 @@ describe('ArchiveRepo', () => { it('should get all archives for account', () => { const expected = require('@root/test/responses/archive.getAllArchive.success.json'); - repo.getAllArchives(new AccountVO(TEST_DATA.account)) - .then((response: ArchiveResponse) => { - const archives = response.getArchiveVOs(); - const count = expected.Results[0].data.length; + repo + .getAllArchives(new AccountVO(TEST_DATA.account)) + .then((response: ArchiveResponse) => { + const archives = response.getArchiveVOs(); + const count = expected.Results[0].data.length; + + expect(archives.length).toBe(count); + }); + + const req = httpMock.expectOne( + `${environment.apiUrl}/archive/getAllArchives` + ); + req.flush(expected); + }); - expect(archives.length).toBe(count); + it('should accept the archive type group', () => { + const archive = new ArchiveVO({ archiveId: 1, type: 'type.archive.group' }); + + repo.create(archive).then((response: ArchiveResponse) => { + const type = response.getArchiveVO().type; + + expect(type).toEqual('type.archive.group'); }); - const req = httpMock.expectOne(`${environment.apiUrl}/archive/getAllArchives`); - req.flush(expected); + const req = httpMock.expectOne(`${environment.apiUrl}/archive/post`); + req.flush(archive); }); });