Skip to content

Commit

Permalink
Merge pull request #179 from e-picsa/feat/seasonal-calendar-tool
Browse files Browse the repository at this point in the history
feat: seasonal calendar tool scaffolding
  • Loading branch information
chrismclarke authored Sep 24, 2023
2 parents e37e881 + f913fae commit 33fe649
Show file tree
Hide file tree
Showing 48 changed files with 847 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

/dist
/coverage
*.geojson.json
*.geojson.json
.angular
8 changes: 7 additions & 1 deletion apps/picsa-apps/extension-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,20 @@
"input": "apps/picsa-tools/monitoring-tool/src/assets",
"output": "assets"
},

{
"glob": "**/*",
"input": "apps/picsa-tools/option-tool/src/assets",
"output": "assets"
},
{
"glob": "**/*",
"input": "apps/picsa-tools/resources-tool/src/assets",
"output": "assets"
},
{
"glob": "**/*",
"input": "apps/picsa-tools/option-tool/src/assets",
"input": "apps/picsa-tools/seasonal-calendar-tool/src/assets",
"output": "assets"
},
{
Expand Down
7 changes: 7 additions & 0 deletions apps/picsa-apps/extension-app/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ManualToolModule } from '@picsa/manual/src/app/app.module-embedded';
import { MonitoringToolModule } from '@picsa/monitoring/src/app/app.module-embedded';
import { OptionsToolModule } from '@picsa/option/src/app/app.module-embedded';
import { ResourcesToolModule } from '@picsa/resources/src/app/app.module-embedded';
import { SeasonalCalendarToolModule } from '@picsa/seasonal-calendar/src/app/app.module-embedded';

const routes: Routes = [
// support embed of budget tool app
Expand Down Expand Up @@ -41,6 +42,11 @@ const routes: Routes = [
path: 'resources',
loadChildren: () => import('@picsa/resources/src/app/app.module-embedded').then((mod) => mod.ResourcesToolModule),
},
{
path: 'seasonal-calendar',
loadChildren: () =>
import('@picsa/seasonal-calendar/src/app/app.module-embedded').then((mod) => mod.SeasonalCalendarToolModule),
},
{
path: '',
loadChildren: () => import('./pages/home/home.module').then((mod) => mod.HomePageModule),
Expand Down Expand Up @@ -75,6 +81,7 @@ const routes: Routes = [
MonitoringToolModule.forRoot({ urlPrefix: 'monitoring' }),
OptionsToolModule.forRoot({ urlPrefix: 'option' }),
ResourcesToolModule.forRoot({ urlPrefix: 'resources' }),
SeasonalCalendarToolModule.forRoot({ urlPrefix: 'seasonal-calendar' }),
],
exports: [RouterModule],
})
Expand Down
1 change: 1 addition & 0 deletions apps/picsa-apps/extension-app/src/app/material.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ExtensionToolkitMaterialModule {
play_store: 'play_store',
probability_tool: 'probability_tool',
resources_tool: 'resources_tool',
seasonal_calendar_tool: 'seasonal_calendar_tool',
tutorial: 'tutorial',
whatsapp: 'whatsapp',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<div
*ngFor="let link of links"
[attr.data-tour-id]="link.tourId"
[attr.data-dev-only]="link.devOnly"
data-cy="link"
class="grid-tile"
(click)="linkClicked(link)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
font-size: 18px;
padding: 16px 8px 8px 8px;
}
.grid-tile[data-dev-only='true'] {
background: rgba(0, 0, 0, 0.35);
}
.grid-tile:hover {
transform: scale(1.02);
transition: all 0.3s ease-out;
Expand Down
21 changes: 20 additions & 1 deletion apps/picsa-apps/extension-app/src/app/pages/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@ang
import { Router } from '@angular/router';
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker';
import { PicsaCommonComponentsService } from '@picsa/components/src';
import { APP_VERSION } from '@picsa/environments';
import { APP_VERSION, ENVIRONMENT } from '@picsa/environments';
import { TourService } from '@picsa/shared/services/core/tour.service';
import { CommunicationService } from '@picsa/shared/services/promptToHomePageService.service';
import { Subscription } from 'rxjs';
Expand All @@ -16,6 +16,8 @@ interface IPageLink {
url: string;
/** Element ID used in tours */
tourId: string;
/** Specify if only shown in dev mode */
devOnly?: boolean;
}

const PAGE_LINKS: IPageLink[] = [
Expand Down Expand Up @@ -75,12 +77,29 @@ const PAGE_LINKS: IPageLink[] = [
// }
];

/** Additional links only available when running in non-production */
const DEV_PAGE_LINKS: IPageLink[] = [
{
name: translateMarker('Seasonal Calendar'),
icon: 'picsa_seasonal_calendar_tool',
url: '/seasonal-calendar',
tourId: 'seasonal-calendar',
devOnly: true,
},
];
if (!ENVIRONMENT.production) {
for (const link of DEV_PAGE_LINKS) {
PAGE_LINKS.push(link);
}
}

@Component({
selector: 'app-home',
templateUrl: './home.page.html',
styleUrls: ['./home.page.scss'],
})
export class HomePage implements OnDestroy, AfterViewInit {
/** List of home page display links, filtered when running in production */
public links = PAGE_LINKS;
public version = APP_VERSION;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": ["plugin:cypress/recommended", "../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@angular-eslint/component-selector": ["off"],
"@angular-eslint/component-class-suffix": ["off"]
}
}
]
}
6 changes: 6 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: nxE2EPreset(__dirname),
});
33 changes: 33 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "seasonal-calendar-tool-e2e",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/picsa-tools/seasonal-calendar-tool-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/picsa-tools/seasonal-calendar-tool-e2e/cypress.config.ts",
"devServerTarget": "seasonal-calendar-tool:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "seasonal-calendar-tool:serve:production"
},
"ci": {
"devServerTarget": "seasonal-calendar-tool:serve-static"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/picsa-tools/seasonal-calendar-tool-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["seasonal-calendar-tool"]
}
13 changes: 13 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('seasonal-calendar-tool', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome seasonal-calendar-tool');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';
16 changes: 16 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"],
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}
33 changes: 33 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"warn",
{
"type": "attribute",
"prefix": "picsa",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"warn",
{
"type": "element",
"prefix": "seasonal-calendar",
"style": "kebab-case"
}
],
"@angular-eslint/component-class-suffix": ["warn"]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"]
}
]
}
22 changes: 22 additions & 0 deletions apps/picsa-tools/seasonal-calendar-tool/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'seasonal-calendar-tool',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/apps/picsa-tools/seasonal-calendar-tool',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
Loading

0 comments on commit 33fe649

Please sign in to comment.