Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/framework_migration_prep' into…
Browse files Browse the repository at this point in the history
… More-Profile-Migrations
  • Loading branch information
Abby Wheelis committed Aug 2, 2023
2 parents fdf8907 + b2d0a21 commit 3907088
Show file tree
Hide file tree
Showing 43 changed files with 534 additions and 2,285 deletions.
13 changes: 8 additions & 5 deletions package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
},
"scripts": {
"build": "npx webpack --config webpack.prod.js && npx cordova build",
"build-dev": "npx webpack --config webpack.dev.js && npx cordova build"
"build-dev": "npx webpack --config webpack.dev.js && npx cordova build",
"build-dev-android": "npx webpack --config webpack.dev.js && npx cordova build android",
"build-dev-ios": "npx webpack --config webpack.dev.js && npx cordova build ios"
},
"devDependencies": {
"@babel/core": "^7.21.3",
Expand All @@ -20,6 +22,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.4",
"@ionic/cli": "6.20.8",
"@types/luxon": "^3.3.0",
"babel-loader": "^9.1.2",
"babel-plugin-angularjs-annotate": "^0.10.0",
"babel-plugin-optional-require": "^0.3.1",
Expand Down Expand Up @@ -120,12 +123,12 @@
"cordova-plugin-customurlscheme": "5.0.2",
"cordova-plugin-device": "2.1.0",
"cordova-plugin-em-datacollection": "git+https://github.com/e-mission/e-mission-data-collection.git#v1.7.8",
"cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.1",
"cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.5",
"cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.3.1",
"cordova-plugin-em-opcodeauth": "git+https://github.com/e-mission/cordova-jwt-auth.git#v1.7.2",
"cordova-plugin-em-server-communication": "git+https://github.com/e-mission/cordova-server-communication.git#v1.2.6",
"cordova-plugin-em-serversync": "git+https://github.com/e-mission/cordova-server-sync.git#v1.3.2",
"cordova-plugin-em-settings": "git+https://github.com/e-mission/cordova-connection-settings.git#v1.2.3",
"cordova-plugin-em-unifiedlogger": "git+https://github.com/e-mission/cordova-unified-logger.git#v1.3.6",
"cordova-plugin-em-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.5",
"cordova-plugin-em-usercache": "git+https://github.com/e-mission/cordova-usercache.git#v1.1.6",
"cordova-plugin-email-composer": "git+https://github.com/katzer/cordova-plugin-email-composer.git#0.10.1",
"cordova-plugin-file": "7.0.0",
"cordova-plugin-inappbrowser": "5.0.0",
Expand Down
1 change: 1 addition & 0 deletions package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.4",
"@ionic/cli": "6.20.8",
"@types/luxon": "^3.3.0",
"babel-loader": "^9.1.2",
"babel-plugin-optional-require": "^0.3.1",
"concurrently": "^8.0.1",
Expand Down
2 changes: 1 addition & 1 deletion survey-resources/data-json/demo-survey-v2.json

Large diffs are not rendered by default.

Binary file modified survey-resources/data-xls/demo-survey-v2.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion survey-resources/data-xml/demo-survey-v2.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ module.exports = merge(common, {
plugins: ["angularjs-annotate"],
},
},
{
test: /\.(js|jsx|ts|tsx)$/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
},
},
],
},
});
35 changes: 0 additions & 35 deletions www/css/main.diary.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,41 +86,6 @@ a.item-content {
padding: 0 !important;
background-color: transparent !important;
}
.leaflet-div-icon {
background-color: white;
width: 6px;
height: 6px;
border-radius: 3px;
margin-left: 3px;
margin-top: 3px;
border-color: white;
}
.leaflet-div-icon-start {
background-color: var(--accent-light);
border: 2px solid var(--accent);
border-radius: 100%;
}
.leaflet-div-icon-stop {
background-color: var(--accent);
border-radius: 100%;
font-size: 15px;
}
.leaflet-div-ionicon {
background: transparent;
color: white;
font-size: 100%;
justify-content: center;
display: flex;
line-height: 14px;
}
.leaflet-div-ionicon-start {
color: white;
}
.leaflet-div-ionicon-stop {
color: white;
margin-top: 1px;
margin-left: 2px;
}
.inner-icon {
background-color: white;
width: 6px;
Expand Down
11 changes: 2 additions & 9 deletions www/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
/* nvd3 styles */
@import 'nvd3/build/nv.d3.css';

/* Annoyingly, React Native Web applies `white-space: nowrap`
on Text elements and doesn't give us a way to change it in the style prop,
effectively preventing multiline text.
This is a workaround to override that style. */
div[class*='css-text'] {
white-space: normal;
}

.fill-container {
display: block;
position: relative;
Expand Down Expand Up @@ -500,8 +492,9 @@ ion-header-bar {
ion-nav-view {
z-index: 10;
}
/* this controls bacground color of dashboard and profile - label screen now styled in react*/
.pane {
background-color: #eee !important;
background-color: #edf1f6 !important;
}
.tabs-custom > .tabs,
.tabs.tabs-custom {
Expand Down
8 changes: 7 additions & 1 deletion www/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
"no-more-travel": "No more travel to show",
"show-more-travel": "Show More Travel",
"show-older-travel": "Show Older Travel",
"no-travel": "No travel to show",
"no-travel-hint": "To see more, change the filters above or go record some travel!",
"no-trips-today": "No trips recorded on this day"
},

Expand Down Expand Up @@ -345,6 +347,8 @@

"intro": {
"appstatus": {
"fix": "Fix",
"refresh":"Refresh",
"overall-description": "This app works in the background to automatically build a travel diary for you. Make sure that all the settings below are green so that the app can work properly!",
"overall-loc-name": "Location",
"overall-loc-description": "We use the background location permission to track your location in the background, even when the app is closed. Reading background locations removes the need to turn tracking on and off, making the app easier to use and preventing battery drain.",
Expand Down Expand Up @@ -420,6 +424,7 @@
"samsung": "Disable 'Medium power saving mode'"
},
"consent":{
"permissions" : "Permissions",
"button-accept": "I accept",
"button-decline": "I refuse"
},
Expand Down Expand Up @@ -476,7 +481,8 @@
"all-green-status": "Make sure that all status checks are green",
"dont-force-kill": "Do not force kill the app",
"background-restrictions": "On Samsung and Huwaei phones, make sure that background restrictions are turned off",
"close": "Close"
"close": "Close",
"tips-title": "Tip(s) for correct operation:"
},
"config": {
"unable-read-saved-config": "Unable to read saved config",
Expand Down
2 changes: 1 addition & 1 deletion www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width, viewport-fit=cover">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com https://api.ionicjs.com https://pro-deploy.ionicjs.com https://nominatim.openstreetmap.org https://raw.githubusercontent.com emission: 'unsafe-eval'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' https://tile.openstreetmap.org 'unsafe-inline'">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com https://api.ionicjs.com https://pro-deploy.ionicjs.com https://nominatim.openstreetmap.org https://raw.githubusercontent.com emission: 'unsafe-eval'; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' https://tile.openstreetmap.org 'unsafe-inline' data: 'unsafe-eval'">
<title></title>

<!-- cordova script (this will be a 404 in the browser) -->
Expand Down
4 changes: 2 additions & 2 deletions www/js/appTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const AppTheme = {
onPrimaryContainer: '#001e30', // lch(10% 50 250)
secondary: '#f2795c', // lch(65% 60 40)
secondaryContainer: '#ffb39e', // lch(80% 45 40)
background: '#f2f2f2', // lch(95% 0 0)
background: '#edf1f6', // lch(95% 3 250) - background of label screen, other screens still have this as CSS .pane
surface: '#fafdff', // lch(99% 30 250)
surfaceVariant: '#e0f0ff', // lch(94% 50 250)
surfaceVariant: '#e0f0ff', // lch(94% 50 250) - background of DataTable
elevation: {
level0: 'transparent',
level1: '#fafdff', // lch(99% 30 250)
Expand Down
38 changes: 33 additions & 5 deletions www/js/components/LeafletView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
import { angularize } from "../angular-react-helper";
import { object, string } from "prop-types";
import { View } from "react-native";
import { useTheme } from "react-native-paper";

const mapSet = new Set();
export function invalidateMaps() {
Expand All @@ -13,6 +14,7 @@ const LeafletView = ({ geojson, opts, ...otherProps }) => {
const mapElRef = useRef(null);
const leafletMapRef = useRef(null);
const geoJsonIdRef = useRef(null);
const { colors } = useTheme();

function initMap(map) {
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
Expand Down Expand Up @@ -40,11 +42,13 @@ const LeafletView = ({ geojson, opts, ...otherProps }) => {
(happens because of FlashList's view recycling on the trip cards:
https://shopify.github.io/flash-list/docs/recycling) */
if (geoJsonIdRef.current && geoJsonIdRef.current !== geojson.data.id) {
console.debug('leafletMapRef changed, invalidating map', geoJsonIdRef.current, geojson.data.id);
leafletMapRef.current.eachLayer(layer => leafletMapRef.current.removeLayer(layer));
initMap(leafletMapRef.current);
}

// non-alphanumeric characters are not safe for element IDs
const mapElId = `map-${geojson.data.id.replace(/[^a-zA-Z0-9]/g, '')}`;

return (
<View {...otherProps}>
<style>{`
Expand All @@ -59,16 +63,40 @@ const LeafletView = ({ geojson, opts, ...otherProps }) => {
white-space: nowrap;
z-index: 9;
}
#${mapElId} .leaflet-div-icon-start, #${mapElId} .leaflet-div-icon-stop {
border: 2px solid ${colors.primary};
border-radius: 100%;
display: flex;
justify-content: center;
align-items: center;
}
#${mapElId} .leaflet-div-icon-start {
color: ${colors.onPrimary};
background-color: ${colors.primary};
}
#${mapElId} .leaflet-div-icon-stop {
color: ${colors.primary};
background-color: ${colors.onPrimary};
}
#${mapElId} .leaflet-div-icon-start::after {
font-family: MaterialCommunityIcons;
content: "󱘈"; ${/* glyph for 'map-marker-star' from https://pictogrammers.com/library/mdi/icon/map-marker-star/*/''}
}
#${mapElId} .leaflet-div-icon-stop::after {
font-family: MaterialCommunityIcons;
content: "󰈻"; ${/* glyph for 'flag' from https://pictogrammers.com/library/mdi/icon/flag/ */''}
}
`}</style>
<div id="map" ref={mapElRef} data-tap-disabled="true"
<div id={mapElId} ref={mapElRef} data-tap-disabled="true"
style={{width: '100%', height: '100%', zIndex: 0}}></div>
</View>
);
};

const startIcon = L.divIcon({className: 'leaflet-div-icon-start', iconSize: [18, 18], html: '<div class="leaflet-div-ionicon leaflet-div-ionicon-start">★</div>'});
const stopIcon = L.divIcon({className: 'leaflet-div-icon-stop', iconSize: [18, 18], html: '<div class="leaflet-div-ionicon leaflet-div-ionicon-stop">⚑</div>'});
const pointToLayer = (feature, latlng) => {
const startIcon = L.divIcon({className: 'leaflet-div-icon-start', iconSize: [18, 18]});
const stopIcon = L.divIcon({className: 'leaflet-div-icon-stop', iconSize: [18, 18]});

const pointToLayer = (feature, latlng) => {
switch(feature.properties.feature_type) {
case "start_place": return L.marker(latlng, {icon: startIcon});
case "end_place": return L.marker(latlng, {icon: stopIcon});
Expand Down
56 changes: 56 additions & 0 deletions www/js/components/NavBarButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from "react";
import { View, StyleSheet } from "react-native";
import color from "color";
import { Button, IconButton, useTheme } from "react-native-paper";

const NavBarButton = ({ children, icon, onPressAction }) => {

const { colors } = useTheme();
const buttonColor = color(colors.onBackground).alpha(.07).rgb().string();
const outlineColor = color(colors.onBackground).alpha(.2).rgb().string();

return (<>
<Button mode="outlined" buttonColor={buttonColor} textColor={colors.onBackground}
contentStyle={{ flexDirection: 'row', height: 36 }}
style={[s.btn, {borderColor: outlineColor}]}
labelStyle={s.label} onPress={() => onPressAction()}>
<View style={s.textWrapper}>
{children}
</View>
{icon &&
<View>
<IconButton icon={icon} color={colors.onBackground} size={20}
style={s.icon} />
</View>
}
</Button>
</>);
};

export const s = StyleSheet.create({
btn: {
borderRadius: 10,
marginLeft: 5,
},
label: {
fontSize: 12.5,
fontWeight: '400',
height: '100%',
marginHorizontal: 'auto',
marginVertical: 'auto',
display: 'flex',
},
icon: {
margin: 'auto',
width: 'auto',
height: 'auto',
},
textWrapper: {
lineHeight: '100%',
marginHorizontal: 5,
justifyContent: 'space-evenly',
alignItems: 'center',
},
});

export default NavBarButton;
Loading

0 comments on commit 3907088

Please sign in to comment.