diff --git a/apps/picsa-tools/climate-tool/src/app/pages/site-view/site-view.page.html b/apps/picsa-tools/climate-tool/src/app/pages/site-view/site-view.page.html index 3f13507f0..4604d21f5 100644 --- a/apps/picsa-tools/climate-tool/src/app/pages/site-view/site-view.page.html +++ b/apps/picsa-tools/climate-tool/src/app/pages/site-view/site-view.page.html @@ -5,7 +5,7 @@ color="primary" (click)="showShareDialog()" > - share{{ 'Share' | translate }} + share{{ 'Share' | translate }} - - + + close - + share{{ 'Share' | translate }} diff --git a/apps/picsa-tools/climate-tool/src/assets/images/Picture6.jpg b/apps/picsa-tools/climate-tool/src/assets/images/Picture6.jpg deleted file mode 100644 index 8a80694bc..000000000 Binary files a/apps/picsa-tools/climate-tool/src/assets/images/Picture6.jpg and /dev/null differ diff --git a/apps/picsa-tools/climate-tool/src/assets/images/Picture7.jpg b/apps/picsa-tools/climate-tool/src/assets/images/Picture7.jpg deleted file mode 100644 index fa10a24da..000000000 Binary files a/apps/picsa-tools/climate-tool/src/assets/images/Picture7.jpg and /dev/null differ diff --git a/apps/picsa-tools/resources-tool/src/app/stores/resources.store.ts b/apps/picsa-tools/resources-tool/src/app/stores/resources.store.ts index 9d627c618..f2ffaac5b 100644 --- a/apps/picsa-tools/resources-tool/src/app/stores/resources.store.ts +++ b/apps/picsa-tools/resources-tool/src/app/stores/resources.store.ts @@ -84,9 +84,10 @@ export class ResourcesStore { const resourcesById: { [id: string]: IResource } = JSON.parse( JSON.stringify(RESOURCES.byId) ); - // Remove any collections with country filters + // Remove any collections with country filters (include all resources if no countryCode provided) Object.entries(resourcesById).forEach(([key, resource]) => { if ( + countryCode && resource.appCountries && !resource.appCountries.includes(countryCode) ) { diff --git a/libs/components/src/components/configuration-select/configuration-select-dialog.html b/libs/components/src/components/configuration-select/configuration-select-dialog.html index 305f22596..3e8206647 100644 --- a/libs/components/src/components/configuration-select/configuration-select-dialog.html +++ b/libs/components/src/components/configuration-select/configuration-select-dialog.html @@ -1,4 +1,4 @@ -Select Country +{{'Select Country' | translate}} Select Country [class.selected]="option.country.code===selected.country.code ? true : undefined" (click)="setLocalisation(option)" > - + {{ option.country.label }} diff --git a/libs/components/src/components/configuration-select/configuration-select-dialog.scss b/libs/components/src/components/configuration-select/configuration-select-dialog.scss index 7c856a528..40ca454e1 100644 --- a/libs/components/src/components/configuration-select/configuration-select-dialog.scss +++ b/libs/components/src/components/configuration-select/configuration-select-dialog.scss @@ -7,13 +7,16 @@ .language-select-container { display: grid; - grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 5px; width: 220px; + grid-template-rows: auto; } + img.language-select-flag { width: 100%; height: 70px; + object-fit: contain; } .select-option { diff --git a/libs/components/src/components/configuration-select/configuration-select.html b/libs/components/src/components/configuration-select/configuration-select.html index e5a027282..70e94082b 100644 --- a/libs/components/src/components/configuration-select/configuration-select.html +++ b/libs/components/src/components/configuration-select/configuration-select.html @@ -1,4 +1,6 @@ - - {{ label }} + + + {{ label }} + diff --git a/libs/components/src/components/configuration-select/configuration-select.scss b/libs/components/src/components/configuration-select/configuration-select.scss index 4f02c5847..b95b0e5db 100644 --- a/libs/components/src/components/configuration-select/configuration-select.scss +++ b/libs/components/src/components/configuration-select/configuration-select.scss @@ -1,5 +1,6 @@ :host { - height: 36px; + display: flex; + justify-content: center; } img.language-summary-flag { height: 30px; diff --git a/libs/components/src/components/configuration-select/configuration-select.ts b/libs/components/src/components/configuration-select/configuration-select.ts index 32ed6e94a..948d0096c 100644 --- a/libs/components/src/components/configuration-select/configuration-select.ts +++ b/libs/components/src/components/configuration-select/configuration-select.ts @@ -14,7 +14,8 @@ export class ConfigurationSelectComponent { public configurationService: ConfigurationService ) {} get image() { - return this.configurationService.activeConfiguration.meta.image; + return this.configurationService.activeConfiguration.localisation.country + .image; } get label() { const { country, language } = diff --git a/libs/configuration/src/configurations.ts b/libs/configuration/src/configurations.ts index fb21d2056..52227ce8d 100644 --- a/libs/configuration/src/configurations.ts +++ b/libs/configuration/src/configurations.ts @@ -1,6 +1,7 @@ import mw from './configurations/mw'; import tj from './configurations/tj'; import zm from './configurations/zm'; +import global from './configurations/global'; /** Configurations define different environments that can be set at runtime */ -export const CONFIGURATIONS = [mw, zm, tj]; +export const CONFIGURATIONS = [mw, zm, tj, global]; diff --git a/libs/configuration/src/configurations/default.ts b/libs/configuration/src/configurations/default.ts index 6092cdc57..fcb356762 100644 --- a/libs/configuration/src/configurations/default.ts +++ b/libs/configuration/src/configurations/default.ts @@ -2,7 +2,6 @@ import { IConfiguration } from '../types'; const configuration: IConfiguration.Settings = { id: '', - meta: { label: '', image: '' }, android: {}, budgetTool: { currency: '$', @@ -10,7 +9,7 @@ const configuration: IConfiguration.Settings = { }, climateTool: {}, localisation: { - country: { label: '', code: '' }, + country: { label: '', code: '', image: '' }, language: { options: [], selected: undefined, diff --git a/libs/configuration/src/configurations/global.ts b/libs/configuration/src/configurations/global.ts new file mode 100644 index 000000000..919aed709 --- /dev/null +++ b/libs/configuration/src/configurations/global.ts @@ -0,0 +1,32 @@ +import { IConfiguration } from '../types'; + +const configuration: IConfiguration.Settings = { + id: 'demo', + android: {}, + budgetTool: { + currency: '$', + currencyBaseValue: 1, + }, + climateTool: { + // include all stations + stationFilter: () => true, + }, + + localisation: { + country: { + label: 'Global', + code: '', + image: 'assets/images/flags/global.svg', + }, + language: { + options: [ + { id: 'en', label: 'English', code: 'en' }, + { id: 'ny', label: 'Chichewa', code: 'ny' }, + { id: 'tg', label: 'Тоҷикӣ', code: 'tg' }, + ], + selected: undefined, + }, + }, + theme: 'picsa-global', +}; +export default configuration; diff --git a/libs/configuration/src/configurations/mw.ts b/libs/configuration/src/configurations/mw.ts index d589e9db5..cfca40cc0 100644 --- a/libs/configuration/src/configurations/mw.ts +++ b/libs/configuration/src/configurations/mw.ts @@ -2,7 +2,6 @@ import { IConfiguration } from '../types'; const configuration: IConfiguration.Settings = { id: 'mw', - meta: { label: 'Malawi', image: 'assets/images/flags/mw.svg' }, android: {}, budgetTool: { currency: 'MK', @@ -10,7 +9,11 @@ const configuration: IConfiguration.Settings = { }, climateTool: {}, localisation: { - country: { label: 'Malawi', code: 'mw' }, + country: { + label: 'Malawi', + code: 'mw', + image: 'assets/images/flags/mw.svg', + }, language: { options: [ { id: 'en', label: 'English', code: 'en' }, @@ -19,6 +22,6 @@ const configuration: IConfiguration.Settings = { selected: undefined, }, }, - theme: 'picsa-default', + theme: 'picsa-mw', }; export default configuration; diff --git a/libs/configuration/src/configurations/tj.ts b/libs/configuration/src/configurations/tj.ts index 3fd3802ef..9788bfd22 100644 --- a/libs/configuration/src/configurations/tj.ts +++ b/libs/configuration/src/configurations/tj.ts @@ -2,7 +2,6 @@ import { IConfiguration } from '../types'; const configuration: IConfiguration.Settings = { id: 'tj', - meta: { label: 'Tajikistan', image: 'assets/images/flags/tj.svg' }, android: {}, budgetTool: { currency: 'TJS', @@ -10,7 +9,11 @@ const configuration: IConfiguration.Settings = { }, climateTool: {}, localisation: { - country: { label: 'Tajikistan', code: 'tj' }, + country: { + label: 'Tajikistan', + code: 'tj', + image: 'assets/images/flags/tj.svg', + }, language: { options: [ { id: 'en', label: 'English', code: 'en' }, diff --git a/libs/configuration/src/configurations/zm.ts b/libs/configuration/src/configurations/zm.ts index e4967a791..24dc710f1 100644 --- a/libs/configuration/src/configurations/zm.ts +++ b/libs/configuration/src/configurations/zm.ts @@ -2,7 +2,6 @@ import { IConfiguration } from '../types'; const configuration: IConfiguration.Settings = { id: 'zm', - meta: { label: 'Zambia', image: 'assets/images/flags/zm.svg' }, android: {}, budgetTool: { currency: 'ZMK', @@ -10,7 +9,11 @@ const configuration: IConfiguration.Settings = { }, climateTool: {}, localisation: { - country: { label: 'Zambia', code: 'zm' }, + country: { + label: 'Zambia', + code: 'zm', + image: 'assets/images/flags/zm.svg', + }, language: { options: [ { id: 'en', label: 'English', code: 'en' }, diff --git a/libs/configuration/src/types.ts b/libs/configuration/src/types.ts index efd16b7e8..e455e85ca 100644 --- a/libs/configuration/src/types.ts +++ b/libs/configuration/src/types.ts @@ -11,7 +11,7 @@ export namespace IConfiguration { } export interface Localisation { - country: { label: string; code: string }; + country: { label: string; code: string; image: string }; language: { options: IConfiguration.LanguageOption[]; selected?: LanguageOption; @@ -20,12 +20,12 @@ export namespace IConfiguration { export interface Settings { id: string; - meta: { label: string; image: string }; android: any; budgetTool: IBudgetToolSettings; climateTool: { stationFilter?: (station: any) => boolean; }; + resourcesTool?: {}; localisation: IConfiguration.Localisation; theme: any; } diff --git a/libs/shared-assets/images/flags/global.svg b/libs/shared-assets/images/flags/global.svg new file mode 100644 index 000000000..e7ddc08ae --- /dev/null +++ b/libs/shared-assets/images/flags/global.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/libs/theme/src/_index.scss b/libs/theme/src/_index.scss index 80030bafc..cfba52904 100644 --- a/libs/theme/src/_index.scss +++ b/libs/theme/src/_index.scss @@ -10,5 +10,7 @@ @import 'overrides'; @import './themes/picsa-default.scss'; +@import './themes/picsa-global.scss'; +@import './themes/picsa-mw.scss'; @import './themes/picsa-tj.scss'; @import './themes/picsa-zm.scss'; diff --git a/libs/theme/src/themes/picsa-global.scss b/libs/theme/src/themes/picsa-global.scss new file mode 100644 index 000000000..f619b8c3a --- /dev/null +++ b/libs/theme/src/themes/picsa-global.scss @@ -0,0 +1,99 @@ +@use '@angular/material' as mat; + +@include mat.core(); + +// http://mcg.mbitson.com/#!?mcgpalette0=%23ef7d00&themename=mcgtheme +$primary: ( + 50: #f1e5e9, + 100: #dcbec7, + 200: #c593a2, + 300: #ad677c, + 400: #9c4760, + 500: #8a2644, + 600: #82223e, + 700: #771c35, + 800: #6d172d, + 900: #5a0d1f, + A100: #ff90a5, + A200: #ff5d7b, + A400: #ff2a52, + A700: #ff103d, + contrast: ( + 50: #000000, + 100: #000000, + 200: #000000, + 300: #ffffff, + 400: #ffffff, + 500: #ffffff, + 600: #ffffff, + 700: #ffffff, + 800: #ffffff, + 900: #ffffff, + A100: #000000, + A200: #000000, + A400: #ffffff, + A700: #ffffff, + ), +); +$accent: ( + 50: #f4e4e4, + 100: #e3baba, + 200: #d18d8d, + 300: #bf5f5f, + 400: #b13c3c, + 500: #a31a1a, + 600: #9b1717, + 700: #911313, + 800: #880f0f, + 900: #770808, + A100: #ffa7a7, + A200: #ff7474, + A400: #ff4141, + A700: #ff2727, + contrast: ( + 50: #000000, + 100: #000000, + 200: #000000, + 300: #ffffff, + 400: #ffffff, + 500: #ffffff, + 600: #ffffff, + 700: #ffffff, + 800: #ffffff, + 900: #ffffff, + A100: #000000, + A200: #000000, + A400: #ffffff, + A700: #ffffff, + ), +); + +// Define the palettes for your theme using the Material Design palettes available in palette.scss +// (imported above). For each palette, you can optionally specify a default, lighter, and darker +// hue. Available color palettes: https://material.io/design/color/ +$palette-primary: mat.define-palette($primary); +$palette-accent: mat.define-palette($accent, A200, A100, A400); + +// The warn palette is optional (defaults to red). +$palette-warn: mat.define-palette(mat.$red-palette); + +// Create the theme object (a Sass map containing all of the palettes). +$theme-global: mat.define-light-theme( + $palette-primary, + $palette-accent, + $palette-warn +); + +// .theme-global { +// @include mat.all-component-themes($picsa-global); +// } +body[data-theme='picsa-global'] { + @include mat.all-component-themes($theme-global); + + --color-primary: #{map-get($palette-primary, 500)}; + --color-primary-50: #{map-get($palette-primary, 50)}; + --color-secondary: #{map-get($palette-accent, 500)}; + --color-black: #1a2138; + --color-light: #d8d8d8; + --color-white: #ffffff; +} diff --git a/libs/theme/src/themes/picsa-mw.scss b/libs/theme/src/themes/picsa-mw.scss new file mode 100644 index 000000000..029ff067f --- /dev/null +++ b/libs/theme/src/themes/picsa-mw.scss @@ -0,0 +1,99 @@ +@use '@angular/material' as mat; + +@include mat.core(); + +// http://mcg.mbitson.com/#!?mcgpalette0=%23ef7d00&themename=mcgtheme +$primary: ( + 50: #f4e3e4, + 100: #e3b8bd, + 200: #d08991, + 300: #bd5964, + 400: #ae3643, + 500: #a01222, + 600: #98101e, + 700: #8e0d19, + 800: #840a14, + 900: #73050c, + A100: #ffa2a5, + A200: #ff6f74, + A400: #ff3c42, + A700: #ff2329, + contrast: ( + 50: #000000, + 100: #000000, + 200: #000000, + 300: #ffffff, + 400: #ffffff, + 500: #ffffff, + 600: #ffffff, + 700: #ffffff, + 800: #ffffff, + 900: #ffffff, + A100: #000000, + A200: #000000, + A400: #ffffff, + A700: #ffffff, + ), +); +$accent: ( + 50: #f8e8e6, + 100: #edc6c2, + 200: #e1a099, + 300: #d57970, + 400: #cc5d51, + 500: #c34032, + 600: #bd3a2d, + 700: #b53226, + 800: #ae2a1f, + 900: #a11c13, + A100: #ffd5d3, + A200: #ffa5a0, + A400: #ff746d, + A700: #ff5c53, + contrast: ( + 50: #000000, + 100: #000000, + 200: #000000, + 300: #000000, + 400: #ffffff, + 500: #ffffff, + 600: #ffffff, + 700: #ffffff, + 800: #ffffff, + 900: #ffffff, + A100: #000000, + A200: #000000, + A400: #000000, + A700: #000000, + ), +); + +// Define the palettes for your theme using the Material Design palettes available in palette.scss +// (imported above). For each palette, you can optionally specify a default, lighter, and darker +// hue. Available color palettes: https://material.io/design/color/ +$palette-primary: mat.define-palette($primary); +$palette-accent: mat.define-palette($accent, A200, A100, A400); + +// The warn palette is optional (defaults to red). +$palette-warn: mat.define-palette(mat.$red-palette); + +// Create the theme object (a Sass map containing all of the palettes). +$theme-mw: mat.define-light-theme( + $palette-primary, + $palette-accent, + $palette-warn +); + +// .theme-mw { +// @include mat.all-component-themes($picsa-mw); +// } +body[data-theme='picsa-mw'] { + @include mat.all-component-themes($theme-mw); + + --color-primary: #{map-get($palette-primary, 500)}; + --color-primary-50: #{map-get($palette-primary, 50)}; + --color-secondary: #{map-get($palette-accent, 500)}; + --color-black: #1a2138; + --color-light: #d8d8d8; + --color-white: #ffffff; +}