-
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
1 parent
eebe388
commit e40ab72
Showing
6 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
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
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,15 @@ | ||
<sky-action-hub | ||
[needsAttention]="(needsAttention | async) ?? []" | ||
[relatedLinks]="relatedLinks" | ||
[title]="title"> | ||
<sky-action-hub-content> | ||
<sky-box> | ||
<sky-box-header> | ||
<h2>Welcome to SKY UX</h2> | ||
</sky-box-header> | ||
<sky-box-content> | ||
<app-welcome-to-skyux /> | ||
</sky-box-content> | ||
</sky-box> | ||
</sky-action-hub-content> | ||
</sky-action-hub> |
Empty file.
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,42 @@ | ||
import { provideLocationMocks } from '@angular/common/testing'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { provideRouter } from '@angular/router'; | ||
import { expectAsync } from '@skyux-sdk/testing'; | ||
|
||
import { HubComponent } from './hub.component'; | ||
import { provideHttpClientTesting } from '@angular/common/http/testing'; | ||
import { provideHttpClient } from '@angular/common/http'; | ||
|
||
describe('HubComponent', () => { | ||
let component: HubComponent; | ||
let fixture: ComponentFixture<HubComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [HubComponent], | ||
providers: [ | ||
provideLocationMocks(), | ||
provideRouter([]), | ||
provideHttpClient(), | ||
provideHttpClientTesting(), | ||
], | ||
}); | ||
fixture = TestBed.createComponent(HubComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('should be accessible', async () => { | ||
fixture = TestBed.createComponent(HubComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
await fixture.whenStable(); | ||
expect(component).toBeTruthy(); | ||
const element = fixture.nativeElement as HTMLElement; | ||
await expectAsync(element).toBeAccessible(); | ||
}); | ||
}); |
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,71 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; | ||
import { SkyBoxModule } from '@skyux/layout'; | ||
import { SkyActionHubModule } from '@skyux/pages'; | ||
import { SETTINGS } from '../settings'; | ||
import { welcomeToSkyuxLinks } from '../welcome-to-skyux/welcome-to-skyux-links'; | ||
import { WelcomeToSkyuxComponent } from '../welcome-to-skyux/welcome-to-skyux.component'; | ||
import { DataService } from '../services/data/data.service'; | ||
import { PersistenceService } from '../services/data/persistence.service'; | ||
import { map, Observable } from 'rxjs'; | ||
|
||
interface NeedsAttentionItem { | ||
title: string; | ||
permalink: { | ||
route?: { | ||
commands: string[]; | ||
}; | ||
url?: string; | ||
}; | ||
} | ||
|
||
@Component({ | ||
selector: 'app-hub', | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
SkyActionHubModule, | ||
WelcomeToSkyuxComponent, | ||
SkyBoxModule, | ||
], | ||
templateUrl: './hub.component.html', | ||
styleUrls: ['./hub.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class HubComponent { | ||
protected readonly loading: Observable<boolean>; | ||
protected needsAttention: Observable<NeedsAttentionItem[]>; | ||
protected readonly relatedLinks = welcomeToSkyuxLinks.map((link) => ({ | ||
label: link.label, | ||
permalink: { | ||
url: link.url, | ||
}, | ||
})); | ||
protected readonly title = SETTINGS.title; | ||
|
||
readonly #dataService = inject(DataService); | ||
readonly #persistenceService = inject(PersistenceService); | ||
|
||
constructor() { | ||
this.loading = this.#persistenceService.loading; | ||
this.needsAttention = this.#dataService.list.pipe( | ||
map((profiles) => { | ||
const needsAttentionCount = profiles.reduce( | ||
(count, profile) => count + (profile.needsAttention ? 1 : 0), | ||
0, | ||
); | ||
const singular = needsAttentionCount === 1; | ||
return [ | ||
{ | ||
title: `${needsAttentionCount} animal${singular ? '' : 's'} need${singular ? 's' : ''} attention`, | ||
permalink: { | ||
route: { | ||
commands: ['animal-profiles'], | ||
}, | ||
}, | ||
}, | ||
]; | ||
}), | ||
); | ||
} | ||
} |
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 @@ | ||
export const welcomeToSkyuxLinks = [ | ||
{ | ||
label: 'SKY UX Documentation', | ||
url: 'https://developer.blackbaud.com/skyux', | ||
}, | ||
{ | ||
label: 'SKY UX GitHub', | ||
url: 'https://github.com/blackbaud/skyux', | ||
}, | ||
{ | ||
label: 'SKY Developer', | ||
url: 'https://developer.blackbaud.com/', | ||
}, | ||
{ | ||
label: 'Learn Angular', | ||
url: 'https://angular.dev/tutorials/learn-angular', | ||
}, | ||
{ | ||
label: 'Get Started with SKY UX', | ||
url: 'https://developer.blackbaud.com/skyux/learn/overview', | ||
}, | ||
]; |