Skip to content

Commit

Permalink
Merge pull request #170 from e-picsa/feat/zm-updates
Browse files Browse the repository at this point in the history
Feat/zm updates
  • Loading branch information
chrismclarke authored Jul 23, 2023
2 parents d0fae23 + e4a664c commit a6c7094
Show file tree
Hide file tree
Showing 42 changed files with 672 additions and 174 deletions.
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 @@ -6,8 +6,8 @@ android {
applicationId "io.picsa.extension"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 3030000
versionName "3.30.0"
versionCode 3031000
versionName "3.31.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
27 changes: 26 additions & 1 deletion apps/picsa-apps/extension-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
"with": "libs/environments/src/environment.prod.ts"
}
],
"outputHashing": "all"
"outputHashing": "all",
"namedChunks": true,
"statsJson": false
},
"development": {
"buildOptimizer": false,
Expand All @@ -119,6 +121,29 @@
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"stats": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "3mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "libs/environments/src/environment.ts",
"with": "libs/environments/src/environment.prod.ts"
}
],
"outputHashing": "all",
"namedChunks": true,
"statsJson": true
}
},
"defaultConfiguration": "production"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker';
import { IProbabilityToolOptions } from '@picsa/models';

export const PROBABILITY_TOOL_OPTIONS: IProbabilityToolOptions = {
above: {
label: 'Above',
label: translateMarker('Above'),
},
below: {
label: 'Below',
label: translateMarker('Below'),
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule, MatIconRegistry } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatTabsModule } from '@angular/material/tabs';
import { DomSanitizer } from '@angular/platform-browser';

const MODULES = [MatButtonModule, MatInputModule, MatIconModule];
const MODULES = [MatButtonModule, MatInputModule, MatIconModule, MatTabsModule];

// use custom module to make it easier to control what is available through app
@NgModule({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- List version -->
<button mat-button class="activity-link" color="primary" [routerLink]="['activity']">
<!-- <button mat-button class="activity-link" color="primary" [routerLink]="['activity']">
<mat-icon>grid_on</mat-icon>
</button>
<section class="period-section" *ngFor="let period of listData">
</button> -->
<section class="period-section" *ngFor="let period of stepData">
<h2 class="section-label">{{ period.label | translate }}</h2>
<table class="manual-steps">
<tr class="manual-step" *ngFor="let step of period.steps" (click)="goToStep(step)">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Component, Input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

import { IManualStep, PICSA_MANUAL_LIST_DATA } from '../../data/manual-contents';
import { IManualPeriodEntry, IManualStep } from '../../data';

@Component({
selector: 'picsa-manual-steps-container',
templateUrl: './stepsContainer.component.html',
styleUrls: ['./stepsContainer.component.scss'],
})
export class stepsContainerComponent {
public listData = PICSA_MANUAL_LIST_DATA;
@Input() stepData: IManualPeriodEntry[];

/** Lookup key to correctly map pages within sections (localisation code) */
@Input() pageMapping = 'en';
Expand Down
2 changes: 2 additions & 0 deletions apps/picsa-tools/manual-tool/src/app/data/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './manual-contents';
export * from './manual-resources';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export interface IManualPeriodEntry {
label: string;
steps: IManualStep[];
}
export interface IManualStep {
page: {
[code: string]: number;
};
name: string;
label: string;
type: 'step';
activities: IManualActivity[];
}
export interface IManualActivity {
label: string;
video: string;
icon: string;
id: string;
}
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker';

interface IManualPeriodEntry {
label: string;
steps: IManualStep[];
}
export interface IManualStep {
page: {
[code: string]: number;
};
name: string;
label: string;
type: 'step';
activities: IManualActivity[];
}
export interface IManualActivity {
label: string;
video: string;
icon: string;
id: string;
}
import { IManualActivity, IManualPeriodEntry } from './common';

/** Picsa manual contents organised by section and step */

export const PICSA_MANUAL_LIST_DATA: IManualPeriodEntry[] = [
export const PICSA_MANUAL_CONTENTS_EXTENSION: IManualPeriodEntry[] = [
{
label: translateMarker('PICSA'),
steps: [
Expand Down Expand Up @@ -293,14 +275,14 @@ export const PICSA_MANUAL_LIST_DATA: IManualPeriodEntry[] = [
];

/** Picsa manual contents organised by section only */
const PICSA_MANUAL_GRID_DATA: IManualActivity[] = [];
const PICSA_MANUAL_GRID_DATA_EXTENSION: IManualActivity[] = [];

for (const period of PICSA_MANUAL_LIST_DATA) {
for (const period of PICSA_MANUAL_CONTENTS_EXTENSION) {
for (const step of period.steps) {
for (const item of step.activities) {
PICSA_MANUAL_GRID_DATA.push(item);
PICSA_MANUAL_GRID_DATA_EXTENSION.push(item);
}
}
}

export { PICSA_MANUAL_GRID_DATA };
export { PICSA_MANUAL_GRID_DATA_EXTENSION };
182 changes: 182 additions & 0 deletions apps/picsa-tools/manual-tool/src/app/data/manual-contents/farmer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import { marker as translateMarker } from '@biesbjerg/ngx-translate-extract-marker';

import { IManualActivity, IManualPeriodEntry } from './common';

/** Picsa manual contents organised by section and step */

export const PICSA_MANUAL_CONTENTS_FARMER: IManualPeriodEntry[] = [
{
label: translateMarker('PICSA'),
steps: [
{
page: {
en: 2,
zm_ny: 2,
mw_ny: 2,
},
name: '',
label: translateMarker('Introduction'),
type: 'step',
activities: [],
},

{
page: {
en: 6,
zm_ny: 11,
mw_ny: 11,
},
name: translateMarker('Step A'),
label: translateMarker('What does the farmer currently do?'),
type: 'step',
activities: [
{
label: translateMarker('Resource Allocation Map (RAM)'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_resource_allocation',
id: 'ram-activity',
},
{
label: translateMarker('Seasonal Calendar'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_calender',
id: 'calendar-activity',
},
],
},
{
page: {
en: 10,
zm_ny: 17,
mw_ny: 17,
},
name: translateMarker('Step B'),
label: translateMarker('Is the climate changing?'),
type: 'step',
activities: [
{
label: translateMarker('Historic climate'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_temperature',
id: 'historic-climate-activity',
},
],
},
{
page: {
en: 12,
zm_ny: 20,
mw_ny: 20,
},
name: translateMarker('Step C'),
label: translateMarker('What are the opportunities and risks?'),
type: 'step',
activities: [
{
label: translateMarker('Probability and Risk'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_campus',
id: 'probability-risk-activity',
},
],
},
{
page: {
en: 14,
zm_ny: 23,
mw_ny: 23,
},
name: translateMarker('Step D'),
label: translateMarker('What are the options for the farmer?'),
type: 'step',
activities: [
{
label: translateMarker('Crop Info'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_crop',
id: 'crop-info-activity',
},
{
label: translateMarker('Livestock Info'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_livestock',
id: 'livestock-info-activity',
},
{
label: translateMarker('Livelihood Info'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_place_holder',
id: 'livelihood-info-activity',
},
],
},
{
page: {
en: 16,
zm_ny: 26,
mw_ny: 26,
},
name: translateMarker('Step E'),
label: translateMarker('Options by context'),
type: 'step',
activities: [
{
label: translateMarker('Farmers choose'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_place_holder',
id: 'farmers-choose-activity',
},
],
},
{
page: {
en: 17,
zm_ny: 27,
mw_ny: 27,
},
name: translateMarker('Step F'),
label: translateMarker('Comparing different options and planning using Participatory Budgets'),
type: 'step',
activities: [
{
label: translateMarker('Budget'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_place_holder',
id: 'budget-activity',
},
],
},
{
page: {
en: 19,
zm_ny: 30,
mw_ny: 30,
},
name: translateMarker('Step G'),
label: translateMarker('The farmer decides'),
type: 'step',
activities: [
{
label: translateMarker('Select and amend'),
video: 'assets/videos/countdown.mp4',
icon: 'picsa_manual_place_holder',
id: 'select-amend-activity',
},
],
},
],
},
];

/** Picsa manual contents organised by section only */
const PICSA_MANUAL_GRID_DATA_FARMER: IManualActivity[] = [];

for (const period of PICSA_MANUAL_CONTENTS_FARMER) {
for (const step of period.steps) {
for (const item of step.activities) {
PICSA_MANUAL_GRID_DATA_FARMER.push(item);
}
}
}

export { PICSA_MANUAL_GRID_DATA_FARMER };
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './common';
export * from './extension';
export * from './farmer';
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import { IManualActivity, PICSA_MANUAL_GRID_DATA } from '../../data/manual-contents';
import { IManualActivity, PICSA_MANUAL_GRID_DATA_EXTENSION } from '../../data';

@Component({
selector: 'picsa-manual-activity-details',
templateUrl: './activity-details.component.html',
styleUrls: ['./activity-details.component.scss'],
})

export class ActivityDetailsComponent implements OnInit {
activity?: IManualActivity;

constructor(private route: ActivatedRoute) {}
ngOnInit() {
const activityId = this.route.snapshot.params.id;
if (activityId) {
this.activity = PICSA_MANUAL_GRID_DATA.find((activity) => activity.id === activityId);
this.activity = PICSA_MANUAL_GRID_DATA_EXTENSION.find((activity) => activity.id === activityId);
}
}
}
Loading

0 comments on commit a6c7094

Please sign in to comment.