Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…pp-builder into style/update-comp-styles
  • Loading branch information
FaithDaka committed Nov 26, 2024
2 parents 9a8c2ca + f6a61cd commit 0c354fb
Show file tree
Hide file tree
Showing 35 changed files with 1,084 additions and 229 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ android/app/src/main/res/values/strings.xml
ios/App/App.xcodeproj/project.pbxproj
ios/App/App/capacitor.config.json
ios/App/App/config.xml


# Deployment-specific files
src/**/*.deployment.ts
113 changes: 23 additions & 90 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"optimization": {
"scripts": false,
"fonts": false,
"styles": false
},
"optimization": { "scripts": false, "fonts": false, "styles": false },
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{ "glob": "**/*", "input": "src/assets", "output": "assets" },
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
Expand All @@ -45,14 +37,8 @@
"styles": [
"./node_modules/intro.js/introjs.css",
"./node_modules/katex/dist/katex.min.css",
{
"input": "src/theme/variables.scss",
"inject": true
},
{
"input": "src/global.scss",
"inject": true
}
{ "input": "src/theme/variables.scss", "inject": true },
{ "input": "src/global.scss", "inject": true }
],
"scripts": ["./node_modules/intro.js/intro.js"],
"allowedCommonJsDependencies": ["*"]
Expand Down Expand Up @@ -82,70 +68,36 @@
"buildOptimizer": true,
"optimization": {
"scripts": true,
"styles": {
"minify": true,
"inlineCritical": false
},
"styles": { "minify": true, "inlineCritical": false },
"fonts": true
},
"budgets": [
{
"type": "initial",
"maximumWarning": "850kb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "3kb",
"maximumError": "200kb"
}
{ "type": "initial", "maximumWarning": "850kb", "maximumError": "5mb" },
{ "type": "anyComponentStyle", "maximumWarning": "3kb", "maximumError": "200kb" }
]
},
"glitchtip": {
"sourceMap": {
"scripts": true,
"styles": false,
"hidden": true,
"vendor": false
}
},
"preview": {
"sourceMap": true
"sourceMap": { "scripts": true, "styles": false, "hidden": true, "vendor": false }
},
"preview": { "sourceMap": true },
"ci": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"budgets": [{ "type": "anyComponentStyle", "maximumWarning": "6kb" }],
"progress": false
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build:development"
},
"options": { "browserTarget": "app:build:development" },
"configurations": {
"production": {
"browserTarget": "app:build:production"
},
"ci": {
"progress": false
},
"external": {
"browserTarget": "app:build:development",
"host": "0.0.0.0"
}
"production": { "browserTarget": "app:build:production" },
"ci": { "progress": false },
"external": { "browserTarget": "app:build:development", "host": "0.0.0.0" }
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
"options": { "browserTarget": "app:build" }
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand All @@ -158,23 +110,15 @@
"styles": [
"./node_modules/intro.js/introjs.css",
"./node_modules/katex/dist/katex.min.css",
{
"input": "src/theme/variables.scss",
"inject": false
},
{
"input": "src/global.scss",
"inject": false
}
{ "input": "src/theme/variables.scss", "inject": false },
{ "input": "src/global.scss", "inject": false }
],
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
"options": { "lintFilePatterns": ["src/**/*.ts", "src/**/*.html"] }
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
Expand All @@ -183,18 +127,11 @@
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"devServerTarget": "app:serve:production"
},
"ci": {
"devServerTarget": "app:serve:ci"
}
"production": { "devServerTarget": "app:serve:production" },
"ci": { "devServerTarget": "app:serve:ci" }
}
},
"deploy": {
"builder": "@angular/fire:deploy",
"options": {}
}
"deploy": { "builder": "@angular/fire:deploy", "options": {} }
}
}
},
Expand All @@ -204,11 +141,7 @@
"schematicCollections": ["@ionic/angular-toolkit"]
},
"schematics": {
"@ionic/angular-toolkit:component": {
"styleext": "scss"
},
"@ionic/angular-toolkit:page": {
"styleext": "scss"
}
"@ionic/angular-toolkit:component": { "styleext": "scss" },
"@ionic/angular-toolkit:page": { "styleext": "scss" }
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start": "yarn prepare && ng serve --open",
"start:local": "yarn prepare && concurrently --kill-others --raw \"ng serve --open\" \"yarn workflow sync_local\"",
"prepare": "node .husky/prepare.js && yarn workflow populate_src_assets",
"build": "yarn prepare && ng build --configuration=production",
"build": "yarn prepare && yarn workflow optimise_build && ng build --configuration=production",
"compodoc:generate": "compodoc --tsconfig tsconfig.docs.json --theme material --assetsFolder 'documentation/docs/assets' --output documentation/docs/generated --disablePrivate --disableLifeCycleHooks",
"compodoc:serve": "yarn compodoc:generate --serve --watch --open",
"scripts": "yarn workspace scripts start",
Expand Down Expand Up @@ -71,6 +71,7 @@
"bootstrap-datepicker": "^1.10.0",
"capacitor-blob-writer": "^1.1.17",
"clone": "^2.1.2",
"components": "workspace:*",
"core-js": "^3.33.3",
"data-models": "workspace:*",
"date-fns": "^2.30.0",
Expand Down
13 changes: 4 additions & 9 deletions packages/components/demo/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { NgModule, Type } from "@angular/core";
import { Type } from "@angular/core";

import { DemoBasicComponent } from "./basic/basic.component";
import type { ITemplateRowProps } from "src/app/shared/components/template/models";
import { CommonModule } from "@angular/common";
import { IonicModule } from "@ionic/angular";

@NgModule({
imports: [CommonModule, IonicModule],
exports: [DemoBasicComponent],
declarations: [DemoBasicComponent],
})
export class DemoComponentsModule {}
export { DemoBasicComponent };

export const DEMO_COMPONENTS = [DemoBasicComponent];

export const DEMO_COMPONENT_MAPPING: Record<string, Type<ITemplateRowProps>> = {
demo_basic: DemoBasicComponent,
Expand Down
4 changes: 4 additions & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "components",
"version": "1.0.0"
}
27 changes: 12 additions & 15 deletions packages/components/plh/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { NgModule, Type } from "@angular/core";

import type { ITemplateRowProps } from "src/app/shared/components/template/models";
import { CommonModule } from "@angular/common";
import { IonicModule } from "@ionic/angular";
import { TemplatePipesModule } from "src/app/shared/components/template/pipes";
import { LottieModule } from "ngx-lottie";
import { PlhParentPointCounterComponent } from "./parent-point-counter/parent-point-counter.component";
import { PlhParentPointBoxComponent } from "./parent-point-box/parent-point-box.component";
import { PlhModuleListItemComponent } from "./plh-kids-kw/components/module-list-item/module-list-item.component";

export { PlhParentPointCounterComponent, PlhParentPointBoxComponent, PlhModuleListItemComponent };

@NgModule({
imports: [CommonModule, IonicModule, TemplatePipesModule, LottieModule],
exports: [PlhParentPointCounterComponent, PlhParentPointBoxComponent],
declarations: [PlhParentPointCounterComponent, PlhParentPointBoxComponent],
providers: [],
})
export class PlhComponentsModule {}
export const PLH_COMPONENTS = [
PlhParentPointCounterComponent,
PlhParentPointBoxComponent,
PlhModuleListItemComponent,
];

export const PLH_COMPONENT_MAPPING: Record<string, Type<ITemplateRowProps>> = {
export const PLH_COMPONENT_MAPPING = {
parent_point_counter: PlhParentPointCounterComponent,
parent_point_box: PlhParentPointBoxComponent,
plh_module_list_item: PlhModuleListItemComponent,
};

export type PLHComponentName = keyof typeof PLH_COMPONENT_MAPPING;
6 changes: 6 additions & 0 deletions packages/components/plh/manifest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { PLHComponentName } from ".";
import { IComponentManifest } from "../types";

export const PLH_COMPONENT_MANIFEST: IComponentManifest<PLHComponentName> = {
parent_point_box: { implicit: ["lottie_animation"] },
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<div class="module-item" [attr.data-lock]="params.isLocked">
@if (!params.isLocked) {
<div
class="container"
[attr.data-language-direction]="templateTranslateService.languageDirection()"
(click)="triggerActions('click')"
>
@if (params.moduleImageAsset) {
<div class="module-image">
<img [src]="params.moduleImageAsset | plhAsset" />
</div>
}
@if (_row.value) {
<div class="module-title">
<p [attr.data-variant]="params.textTransform">{{ _row.value }}</p>
</div>
}
@if (params.navImageAsset !== null) {
<div class="nav-icon">
<img class="icon" [src]="params.navImageAsset | plhAsset" />
</div>
} @else {
<div class="no-nav"></div>
}
</div>
} @else {
<div
class="container"
[attr.data-language-direction]="templateTranslateService.languageDirection()"
>
@if (params.moduleImageAsset) {
<div class="module-image">
<img [src]="params.moduleImageAsset | plhAsset" />
</div>
}
@if (_row.value) {
<div class="module-title">
<p [attr.data-variant]="params.textTransform">{{ _row.value }}</p>
</div>
}
@if (params.lockedImageAsset !== null) {
<div class="locked">
<img class="icon" [src]="params.lockedImageAsset | plhAsset" />
</div>
} @else {
<div class="no-nav"></div>
}
</div>
}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { IonicModule } from "@ionic/angular";

import { PlhModuleListItemComponent } from "./module-list-item.component";

describe("ModuleListItemComponent", () => {
let component: PlhModuleListItemComponent;
let fixture: ComponentFixture<PlhModuleListItemComponent>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PlhModuleListItemComponent],
imports: [IonicModule.forRoot()],
}).compileComponents();

fixture = TestBed.createComponent(PlhModuleListItemComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it("should create", () => {
expect(component).toBeTruthy();
});
});
Loading

0 comments on commit 0c354fb

Please sign in to comment.