Skip to content

Commit 7e13d22

Browse files
committed
add account container
1 parent 1609da5 commit 7e13d22

File tree

6 files changed

+83
-1
lines changed

6 files changed

+83
-1
lines changed

projects/fusio-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-fusio-sdk",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"description": "SDK to integrate Fusio into an Angular app",
55
"keywords": [
66
"Fusio",

projects/fusio-sdk/src/lib/component/account-container/account-container.component.css

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
<div class="fusio-page">
3+
<nav class="fusio-tabs">
4+
<ul ngbNav [(activeId)]="active" class="nav-tabs">
5+
<li [ngbNavItem]="item.id" *ngFor="let item of items">
6+
<a ngbNavLink [routerLink]="item.link" class="nav-link">{{item.name}}</a>
7+
</li>
8+
</ul>
9+
</nav>
10+
<router-outlet></router-outlet>
11+
</div>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import {Component, Input, OnInit} from '@angular/core';
2+
import {ActivatedRoute, Router} from "@angular/router";
3+
4+
@Component({
5+
selector: 'fusio-account-container',
6+
templateUrl: './account-container.component.html',
7+
styleUrls: ['./account-container.component.css']
8+
})
9+
export class AccountContainerComponent implements OnInit {
10+
11+
@Input()
12+
options: Array<string> = ['account', 'security', 'app', 'event', 'subscription'];
13+
14+
@Input()
15+
active: string = 'account';
16+
17+
items: Array<Item> = this.getItems();
18+
19+
constructor(private router: Router, private route: ActivatedRoute) { }
20+
21+
ngOnInit(): void {
22+
this.route.url.subscribe(() => {
23+
this.items.forEach((item) => {
24+
if (this.router.url.startsWith(item.link)) {
25+
this.active = item.id;
26+
}
27+
});
28+
})
29+
30+
this.items = this.getItems();
31+
}
32+
33+
protected getItems(): Array<Item> {
34+
const items = [{
35+
id: 'account',
36+
link: '/account',
37+
name: 'Account',
38+
}, {
39+
id: 'security',
40+
link: '/account/security',
41+
name: 'Security',
42+
}, {
43+
id: 'app',
44+
link: '/account/app',
45+
name: 'Apps',
46+
}, {
47+
id: 'event',
48+
link: '/account/event',
49+
name: 'Events',
50+
}, {
51+
id: 'subscription',
52+
link: '/account/subscription',
53+
name: 'Subscriptions',
54+
}];
55+
56+
return items.filter((item) => {
57+
return this.options.includes(item.id);
58+
});
59+
}
60+
61+
}
62+
63+
export interface Item {
64+
id: string
65+
link: string
66+
name: string
67+
}

projects/fusio-sdk/src/lib/fusio-sdk.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ import {ModalComponent as AppModal} from './component/app/modal/modal.component'
2929
import {DetailComponent as EventDetail} from './component/event/detail/detail.component';
3030
import {ListComponent as EventList} from './component/event/list/list.component';
3131
import {ModalComponent as EventModal} from './component/event/modal/modal.component';
32+
import {AccountContainerComponent} from "./component/account-container/account-container.component";
3233

3334
@NgModule({
3435
declarations: [
3536
AccountComponent,
37+
AccountContainerComponent,
3638
EmptyComponent,
3739
HelpComponent,
3840
LoginComponent,
@@ -66,6 +68,7 @@ import {ModalComponent as EventModal} from './component/event/modal/modal.compon
6668
],
6769
exports: [
6870
AccountComponent,
71+
AccountContainerComponent,
6972
EmptyComponent,
7073
HelpComponent,
7174
LoginComponent,

projects/fusio-sdk/src/public-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export * from './lib/abstract/list';
77
export * from './lib/abstract/modal';
88

99
export * from './lib/component/account/account.component';
10+
export * from './lib/component/account-container/account-container.component';
1011
export * from './lib/component/empty/empty.component';
1112
export * from './lib/component/help/help.component';
1213
export * from './lib/component/login/login.component';

0 commit comments

Comments
 (0)