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

Feat/direct to farmer videos #187

Merged
merged 18 commits into from
Oct 24, 2023
Merged
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
4 changes: 2 additions & 2 deletions apps/picsa-apps/extension-app-native/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "io.picsa.extension"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3036002
versionName "3.36.2"
versionCode 3037000
versionName "3.37.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
5 changes: 5 additions & 0 deletions apps/picsa-apps/extension-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
"input": "apps/picsa-tools/climate-tool/src/assets",
"output": "assets"
},
{
"glob": "**/*",
"input": "apps/picsa-tools/farmer-activity/src/assets",
"output": "assets"
},
{
"glob": "**/*",
"input": "apps/picsa-tools/manual-tool/src/assets",
Expand Down
8 changes: 8 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 @@ -4,6 +4,7 @@ import { RouterModule, Routes } from '@angular/router';
import { BudgetToolModule } from '@picsa/budget/src/app/app.module-embedded';
import { ClimateToolModule } from '@picsa/climate/src/app/app.module-embedded';
import { CropProbabilityToolModule } from '@picsa/crop-probability/src/app/app.module-embedded';
import { FarmerActivityModule } from '@picsa/farmer-activity/src/app/app.module-embedded';
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';
Expand All @@ -26,6 +27,11 @@ const routes: Routes = [
loadChildren: () =>
import('@picsa/crop-probability/src/app/app.module-embedded').then((mod) => mod.CropProbabilityToolModule),
},
{
path: 'farmer-activity',
loadChildren: () =>
import('@picsa/farmer-activity/src/app/app.module-embedded').then((mod) => mod.FarmerActivityModule),
},
{
path: 'monitoring',
loadChildren: () => import('@picsa/monitoring/src/app/app.module-embedded').then((mod) => mod.MonitoringToolModule),
Expand Down Expand Up @@ -73,6 +79,8 @@ const routes: Routes = [
OptionsToolModule.forRoot({ urlPrefix: 'option' }),
ResourcesToolModule.forRoot({ urlPrefix: 'resources' }),
SeasonalCalendarToolModule.forRoot({ urlPrefix: 'seasonal-calendar' }),
// NOTE - the farmer-activity module should be registered last to reuse routes from other tools
FarmerActivityModule.forRoot({ urlPrefix: 'farmer-activity' }),
],
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 @@ -33,6 +33,7 @@ export class ExtensionToolkitMaterialModule {
seasonal_calendar_tool: 'seasonal_calendar_tool',
tutorial: 'tutorial',
whatsapp: 'whatsapp',
farmer_activity: 'farmer_activity',
};
for (const [key, value] of Object.entries(icons)) {
this.matIconRegistry.addSvgIcon(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @nx/enforce-module-boundaries */
import { DomPortal } from '@angular/cdk/portal';
import { AfterViewInit, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker';
import { PicsaCommonComponentsService } from '@picsa/components/src';
import { APP_VERSION, ENVIRONMENT } from '@picsa/environments';
// eslint-disable-next-line @nx/enforce-module-boundaries
import { MonitoringToolService } from '@picsa/monitoring/src/app/services/monitoring-tool.service';
import { TourService } from '@picsa/shared/services/core/tour.service';
import { CommunicationService } from '@picsa/shared/services/promptToHomePageService.service';
Expand All @@ -29,6 +29,12 @@ const PAGE_LINKS: IPageLink[] = [
url: '/manual',
tourId: 'manual',
},
{
name: translateMarker('Farmer Activities'),
icon: 'picsa_farmer_activity',
url: '/farmer-activity',
tourId: 'farmer',
},
{
name: translateMarker('Resources'),
icon: 'picsa_resources_tool',
Expand Down
35 changes: 19 additions & 16 deletions apps/picsa-apps/extension-app/src/assets/svgs/budget_tool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/farmer-activity-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/farmer-activity-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/farmer-activity-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "farmer-activity-e2e",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/picsa-tools/farmer-activity-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/picsa-tools/farmer-activity-e2e/cypress.config.ts",
"devServerTarget": "farmer-activity:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "farmer-activity:serve:production"
},
"ci": {
"devServerTarget": "farmer-activity:serve-static"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/picsa-tools/farmer-activity-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["farmer-activity"]
}
13 changes: 13 additions & 0 deletions apps/picsa-tools/farmer-activity-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('farmer-activity', () => {
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 farmer-activity');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]"
}
1 change: 1 addition & 0 deletions apps/picsa-tools/farmer-activity-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
33 changes: 33 additions & 0 deletions apps/picsa-tools/farmer-activity-e2e/src/support/commands.ts
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/farmer-activity-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/farmer-activity-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/farmer-activity/.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": "farmer-activity",
"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/farmer-activity/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'farmer-activity',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../../coverage/apps/picsa-tools/farmer-activity',
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
Loading