Skip to content
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

Add PrimeNG #4

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ jobs:
app_location: "dist/component-library-demo/browser"
skip_app_build: true
skip_api_build: true
config_file_location: "/"
###### End of Repository/Build Configurations ######

close_pull_request_job:
Expand Down
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "1mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ module.exports = tseslint.config(
},
},
{
files: ["**/*.html"],
files: ["src/app/**/*.html"],
extends: [
...angular.configs.templateRecommended,
...angular.configs.templateAccessibility,
eslintPluginPrettierRecommended,
],
rules: {},
},
Expand Down
59 changes: 57 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"@angular/platform-browser": "^18.0.0",
"@angular/platform-browser-dynamic": "^18.0.0",
"@angular/router": "^18.0.0",
"chart.js": "^4.4.3",
"chartjs-plugin-datalabels": "^2.2.0",
"lodash": "^4.17.21",
"primeicons": "^7.0.0",
"primeng": "^17.18.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0"
},
Expand All @@ -31,6 +36,7 @@
"@eslint/js": "^9.2.0",
"@types/eslint__js": "^8.42.3",
"@types/jasmine": "~5.1.0",
"@types/lodash": "^4.17.4",
"angular-eslint": "18.0.1",
"autoprefixer": "^10.4.19",
"eslint": "^9.3.0",
Expand Down
11 changes: 8 additions & 3 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<h1 class="text-navy text-3xl font-bold underline">Hello world!</h1>

<router-outlet />
<div class="flex min-h-screen flex-col">
<app-header />
<div class="flex-1">
<router-outlet />
</div>
<app-footer />
</div>
<p-toast [key]="toastKey"></p-toast>
Empty file removed src/app/app.component.scss
Empty file.
2 changes: 1 addition & 1 deletion src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ describe('AppComponent', () => {
it(`should have the right title`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('component-library-demo');
expect(app.title).toEqual('121 Portal | Component Library Demo');
});
});
14 changes: 11 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { HeaderComponent } from './components/header/header.component';
import { FooterComponent } from './components/footer/footer.component';
import { ToastModule } from 'primeng/toast';
import { MessageService } from 'primeng/api';
import { ToastService } from './services/toast.service';

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
imports: [RouterOutlet, HeaderComponent, FooterComponent, ToastModule],
providers: [
MessageService, // Needed by the ToastModule
],
templateUrl: './app.component.html',
styleUrl: './app.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppComponent {
title = 'component-library-demo';
title = '121 Portal | Component Library Demo';
toastKey = ToastService.TOAST_KEY;
}
7 changes: 7 additions & 0 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ import {
provideExperimentalZonelessChangeDetection,
} from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';

import { routes } from './app.routes';
import {
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideExperimentalZonelessChangeDetection(),
provideAnimationsAsync(),
provideHttpClient(withInterceptorsFromDi()),
],
};
13 changes: 11 additions & 2 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import { Routes } from '@angular/router';
import { HomepageComponent } from './pages/homepage/homepage.component';
import { PaymentsComponent } from './pages/payments/payments.component';
import { PaymentDetailsComponent } from './pages/payment-details/payment-details.component';
import { MonitoringComponent } from './pages/monitoring/monitoring.component';
import { ParticipantsComponent } from './pages/participants/participants.component';

export const routes: Routes = [{ path: '', component: HomepageComponent }];
export const routes: Routes = [
{ path: 'payments', component: PaymentsComponent },
{ path: 'payments/:id', component: PaymentDetailsComponent },
{ path: 'participants', component: ParticipantsComponent },
{ path: 'monitoring', component: MonitoringComponent },
{ path: '', redirectTo: '/payments', pathMatch: 'full' },
];
17 changes: 17 additions & 0 deletions src/app/components/activity-log/activity-log.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p-scrollPanel styleClass="h-full w-full">
@for (logItem of activityWithIcons(); track $index) {
<div class="w-full border-b border-b-grey-300 py-4">
<div class="flex w-full gap-2">
<i [class]="'grow-0 text-3xl ' + logItem.icon"></i>
<div class="ltr:mr-auto rtl:ml-auto">
<h3 class="text-xl font-bold">{{ logItem.label }}</h3>
<p>{{ logItem.date }}</p>
</div>
<p-chip [label]="logItem.user" />
</div>
<div class="w-full text-center">
<p-button rounded plain text icon="pi pi-chevron-down" />
</div>
</div>
}
</p-scrollPanel>
45 changes: 45 additions & 0 deletions src/app/components/activity-log/activity-log.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {
ChangeDetectionStrategy,
Component,
computed,
input,
} from '@angular/core';
import { ScrollPanelModule } from 'primeng/scrollpanel';
import { ChipModule } from 'primeng/chip';
import { ButtonModule } from 'primeng/button';

interface Activity {
label: string;
date: string;
type: string;
user: string;
}

@Component({
selector: 'app-activity-log',
standalone: true,
imports: [ScrollPanelModule, ButtonModule, ChipModule],
templateUrl: './activity-log.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ActivityLogComponent {
activity = input.required<Activity[]>();

activityWithIcons = computed(() =>
this.activity().map((activity) => ({
...activity,
icon: this.getIcon(activity.type),
})),
);

getIcon(type: string) {
switch (type) {
case 'approved':
return 'pi pi-thumbs-up';
case 'created':
return 'pi pi-money-bill';
default:
return 'pi pi-question';
}
}
}
59 changes: 59 additions & 0 deletions src/app/components/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<div class="mt-8 bg-navy text-white">
<div class="container flex justify-between py-12 font-extralight">
<div class="w-1/4">
<h3 class="mb-6 text-xl font-bold">About 121 Portal</h3>
<p>
121 (“one to one”) is end-to-end cash delivery platform that helps NGO’s
to implement Digital Cash Aid programs safe fast and....
</p>
<p class="mt-8">&#64; 510 2024</p>
</div>
<div>
<h3 class="mb-6 text-xl font-bold">Find out more</h3>
<ul>
<li class="mb-2 underline">
<a href="https://510.global">121.global</a>
</li>
<li class="mb-2 underline">
<a href="https://510.global">510.global</a>
</li>
<li class="mb-2 underline">
<a href="https://510.global">data.ifrc.org</a>
</li>
</ul>
</div>
<div>
<h3 class="mb-6 text-xl font-bold">Helpful links</h3>
<ul>
<li class="mb-2 underline">
<a href="https://510.global">Open Source Code</a>
</li>
<li class="mb-2 underline">
<a href="https://510.global">API Documentation</a>
</li>
<li class="mb-2 underline">
<a href="https://510.global">Other Resources</a>
</li>
</ul>
</div>
<div>
<h3 class="mb-6 text-xl font-bold">Questions or feedback? Contact us</h3>
<a
href="mailto:[email protected]"
class="p-button p-button-rounded p-button-outlined border-white font-normal text-white"
>support&#64;510.global</a
>
<div class="mt-6 flex gap-3">
<a href="https://facebook.com">
<i class="pi pi-facebook text-2xl text-white"></i>
</a>
<a href="https://facebook.com">
<i class="pi pi-twitter text-2xl text-white"></i>
</a>
<a href="https://facebook.com">
<i class="pi pi-youtube text-2xl text-white"></i>
</a>
</div>
</div>
</div>
</div>
11 changes: 11 additions & 0 deletions src/app/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ButtonModule } from 'primeng/button';

@Component({
selector: 'app-footer',
standalone: true,
imports: [ButtonModule],
templateUrl: './footer.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class FooterComponent {}
Loading
Loading