Please press the plus{' '}
- button in the home
- page. This will bring you to the taxa search page. After
- selecting the species, open the record (either by opening it
- directly from the taxa search page using the edit button{' '}
- beside the species name or
- through the home-list page) and fill in the details of the
- sighting, like location, date, number seen etc.
+ {' '}
+ button in the home page. This will bring you to the taxa
+ search page. After selecting the species, open the record
+ (either by opening it directly from the taxa search page using
+ the edit button beside the
+ species name or through the home-list page) and fill in the
+ details of the sighting, like location, date, number seen etc.
Note: you have to be signed in to your iRecord St
Helena App account and have a network connection, for the
@@ -283,7 +286,7 @@ const Help: FC = () => (
button and next to the attribute.
-
+
Note: For a GPS-sourced location, only the location
name can be locked, not the GPS value. As you move about, the
@@ -297,11 +300,11 @@ const Help: FC = () => (
Note: after registering a new account you must verify
your email address by clicking on a verification link sent to
@@ -377,7 +380,7 @@ const Help: FC = () => (
page.
-
+
Note: only the activities that allow this mobile app
records and only the ones that you have joined on the iRecord
@@ -388,10 +391,10 @@ const Help: FC = () => (
-
+
Other
-
-
+
+
@@ -400,7 +403,7 @@ const Help: FC = () => (
location page and from the settings{' '}
page
- .
+ .{' '}
Swipe a location left and click edit{' '}
or delete
@@ -426,7 +429,7 @@ const Help: FC = () => (
+
+ This will wipe all the locally stored app data!
+
+
>
),
buttons: [
@@ -67,7 +57,7 @@ function useUserDeleteDialog(deleteUser: any) {
Are you sure you want to delete your account?}
className="destructive-warning"
>
This will remove your account on the iRecord St Helena App website.
@@ -94,17 +84,20 @@ function useUserDeleteDialog(deleteUser: any) {
}
function useDeleteAllSamplesDialog(deleteAllSamples: any) {
- const { t } = useTranslation();
const alert = useAlert();
const showDeleteAllSamplesDialog = () =>
alert({
header: 'Remove All',
- message: `${t(
- 'Are you sure you want to remove all successfully synchronised local records?'
- )}
${t('Note')}: ${t(
- 'records on the server will not be touched.'
- )}
`,
+ message: (
+
+ Are you sure you want to remove all successfully synchronised local
+ records?
+
+ Note: records on the server will not be touched.
+
Manage Saved
- }
label="Geolocate Survey Entries"
- value={geolocateSurveyEntries}
+ defaultSelected={geolocateSurveyEntries}
onChange={onGeolocateSurveyEntriesToggle}
/>
+
+ We will use GPS to obtain precise locations for species during
+ Species List surveys.
+
-
+
Application
-
-
-
+
+ }
label="Suggest species"
- value={useSpeciesImageClassifier}
+ defaultSelected={useSpeciesImageClassifier}
onChange={onUseImageClassifier}
/>
-
+
Use image recognition to identify species from your photos.
{/*
@@ -206,47 +201,47 @@ const MenuMain: FC = ({
{t(countries[country])} */}
- }
label="Training Mode"
- value={useTraining}
+ defaultSelected={useTraining}
onChange={onTrainingModeToggle}
/>
-
+
Mark any new records as 'training' and exclude from all reports.
-
-
+
Some features are in a trial state and are subject to change in
future releases.
-
+ */}
- }
onChange={onSendAnalyticsToggle}
+ defaultSelected={sendAnalytics}
/>
-
+
Share app crash data so we can make the app more reliable.
-
+
Remove Uploaded Surveys
-
+
You can remove uploaded surveys from this device.
@@ -256,7 +251,7 @@ const MenuMain: FC = ({
Reset app
-
+
You can reset the app data to its default settings.
@@ -268,7 +263,7 @@ const MenuMain: FC = ({
Delete account
-
+
You can delete your user account from the system.
>
@@ -276,7 +271,7 @@ const MenuMain: FC = ({
-
{`v${config.version} (${config.build})`}
+
{`v${config.version} (${config.build})`}
);
};
diff --git a/src/Settings/Menu/Main/styles.scss b/src/Settings/Menu/Main/styles.scss
index 915be7d5..412fbf7b 100644
--- a/src/Settings/Menu/Main/styles.scss
+++ b/src/Settings/Menu/Main/styles.scss
@@ -1,23 +1,5 @@
#settings {
ion-content {
- --padding-top: 10px;
-
- .menu-attr-toggle {
- ion-icon {
- font-size: 18px;
- }
- }
-
- ion-item ion-toggle {
- padding-right: 0;
- }
-
- .rounded {
- .menu-attr-toggle:first-of-type {
- --border-radius: 15px 15px 0 0;
- }
- }
-
.destructive-item {
ion-item ion-icon,
ion-item:not(.info-message) ion-label {
@@ -25,12 +7,6 @@
}
}
}
-
- .app-version {
- margin: 0 10px 10px;
- opacity: 0.7;
- float: right;
- }
}
ion-alert .info-message.destructive-warning {
diff --git a/src/Settings/Menu/index.tsx b/src/Settings/Menu/index.tsx
index 20d5606c..9e924bcd 100644
--- a/src/Settings/Menu/index.tsx
+++ b/src/Settings/Menu/index.tsx
@@ -1,10 +1,11 @@
import { useContext } from 'react';
-import appModel, { Attrs as AppModelAttrs } from 'models/app';
-import userModel from 'models/user';
import { observer } from 'mobx-react';
-import { NavContext } from '@ionic/react';
-import savedSamples, { removeAllSynced } from 'models/savedSamples';
+import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { Page, Header, useToast, PickByType, useLoader } from '@flumens';
+import { NavContext, isPlatform } from '@ionic/react';
+import appModel, { Attrs as AppModelAttrs } from 'models/app';
+import savedSamples, { removeAllSynced } from 'models/savedSamples';
+import userModel from 'models/user';
import Main from './Main';
async function resetApp(toast: any) {
@@ -82,6 +83,7 @@ function onToggle(
setting: keyof PickByType,
checked: boolean
) {
+ isPlatform('hybrid') && Haptics.impact({ style: ImpactStyle.Light });
appModel.attrs[setting] = checked;
appModel.save();
}
@@ -92,7 +94,6 @@ const Container = () => {
const {
sendAnalytics,
useTraining,
- useExperiments,
geolocateSurveyEntries,
useSpeciesImageClassifier,
} = appModel.attrs;
@@ -107,7 +108,6 @@ const Container = () => {
deleteUser={deleteUser}
sendAnalytics={sendAnalytics}
useTraining={useTraining}
- useExperiments={useExperiments}
geolocateSurveyEntries={geolocateSurveyEntries}
useSpeciesImageClassifier={useSpeciesImageClassifier}
resetApp={() => resetApp(toast)}
diff --git a/src/Settings/Survey/index.tsx b/src/Settings/Survey/index.tsx
index 439fb869..bcdda724 100644
--- a/src/Settings/Survey/index.tsx
+++ b/src/Settings/Survey/index.tsx
@@ -1,12 +1,12 @@
-import { FC, useContext } from 'react';
+import { useContext } from 'react';
import { observer } from 'mobx-react';
-import { NavContext } from '@ionic/react';
-import { Page, Attr, Header, Main, gridrefAccuracy } from '@flumens';
import { useTranslation } from 'react-i18next';
+import { Page, Attr, Header, Main, gridrefAccuracy } from '@flumens';
+import { NavContext } from '@ionic/react';
import appModel from 'models/app';
import './styles.scss';
-const GridType: FC = () => {
+const GridType = () => {
const { goBack } = useContext(NavContext);
const { t } = useTranslation();
diff --git a/src/Settings/router.jsx b/src/Settings/router.jsx
index d9c16a4d..95d9db01 100644
--- a/src/Settings/router.jsx
+++ b/src/Settings/router.jsx
@@ -1,8 +1,8 @@
import { Route } from 'react-router-dom';
import appModel from 'models/app';
import userModel from 'models/user';
-import Menu from './Menu';
import Locations from './Locations';
+import Menu from './Menu';
import Survey from './Survey';
export default [
diff --git a/src/Survey/Default/Home/Main/index.tsx b/src/Survey/Default/Home/Main/index.tsx
index 505fef63..b7ee8392 100644
--- a/src/Survey/Default/Home/Main/index.tsx
+++ b/src/Survey/Default/Home/Main/index.tsx
@@ -1,21 +1,19 @@
-import { FC } from 'react';
import { observer } from 'mobx-react';
-import { IonList, IonIcon, useIonViewDidEnter } from '@ionic/react';
-import appModel from 'models/app';
import { lockClosedOutline } from 'ionicons/icons';
+import { Trans as T } from 'react-i18next';
+import { useRouteMatch } from 'react-router';
import { Main, useAlert } from '@flumens';
+import { IonList, IonIcon, useIonViewDidEnter } from '@ionic/react';
+import appModel from 'models/app';
import Sample from 'models/sample';
-import { useRouteMatch } from 'react-router';
-import { Trans as T } from 'react-i18next';
-import MenuDynamicAttrs from 'Survey/common/Components/MenuDynamicAttrs';
+import DisabledRecordMessage from 'Survey/common/Components/DisabledRecordMessage';
import MenuAttr from 'Survey/common/Components/MenuAttr';
+import MenuDynamicAttrs from 'Survey/common/Components/MenuDynamicAttrs';
import MenuLocation from 'Survey/common/Components/MenuLocation';
-import DisabledRecordMessage from 'Survey/common/Components/DisabledRecordMessage';
import MenuTaxonItem from 'Survey/common/Components/MenuTaxonItem';
import PhotoPicker from 'Survey/common/Components/PhotoPicker';
import VerificationMessage from 'Survey/common/Components/VerificationMessage';
import lockScreenshot from './lock.png';
-
import './styles.scss';
interface Props {
@@ -60,7 +58,7 @@ const useAttributeLockingTip = (sample: Sample) => {
useIonViewDidEnter(showTip);
};
-const EditMain: FC = ({ sample }) => {
+const EditMain = ({ sample }: Props) => {
useAttributeLockingTip(sample);
const { url } = useRouteMatch();
@@ -73,34 +71,35 @@ const EditMain: FC = ({ sample }) => {
return (
-
+
{isDisabled && (
-
+
)}
{isDisabled && (
-
+
)}
{/* Only showing if pre-selected */}
{activity && (
-
+
)}
-
+
-
+
+ = ({ sample }) => {
+const DefaultHome = ({ sample }: Props) => {
const toast = useToast();
const { navigate } = useContext(NavContext);
const checkSampleStatus = useValidateCheck(sample);
@@ -44,11 +44,11 @@ const DefaultHome: FC = ({ sample }) => {
!sample.metadata.saved ? _processDraft() : _processSubmission();
const finishButton = (
-
+
);
const { training } = sample.attrs;
- const subheader = !!training && ;
+ const subheader = !!training && ;
return (
diff --git a/src/Survey/Default/Taxon.tsx b/src/Survey/Default/Taxon.tsx
index 31312b8c..549ef82a 100644
--- a/src/Survey/Default/Taxon.tsx
+++ b/src/Survey/Default/Taxon.tsx
@@ -1,25 +1,25 @@
-import { FC, useContext } from 'react';
+import { useContext } from 'react';
import { observer } from 'mobx-react';
+import { useRouteMatch } from 'react-router';
import { Page, Header, Main } from '@flumens';
-import TaxonSearch, {
- TaxonSearchFilters,
-} from 'Survey/common/Components/TaxonSearch';
-import Sample from 'models/sample';
+import { NavContext } from '@ionic/react';
import appModel from 'models/app';
-import savedSamples from 'models/savedSamples';
import Occurrence from 'models/occurrence';
-import { useRouteMatch } from 'react-router';
+import Sample from 'models/sample';
+import savedSamples from 'models/savedSamples';
import surveyConfig from 'Survey/Default/config';
-import { NavContext } from '@ionic/react';
+import TaxonSearch, {
+ TaxonSearchFilters,
+} from 'Survey/common/Components/TaxonSearch';
const getNewSample = async (taxon: any) => {
- const newSample = await surveyConfig.create(Sample, Occurrence, { taxon });
+ const newSample = await surveyConfig.create({ Sample, Occurrence, taxon });
newSample.save();
savedSamples.push(newSample);
return newSample;
};
-const Taxon: FC = () => {
+const Taxon = () => {
const { navigate } = useContext(NavContext);
const match = useRouteMatch();
diff --git a/src/Survey/Default/config/__tests__/config-test.js b/src/Survey/Default/config/__tests__/config-test.js
index 669bc4db..75452739 100644
--- a/src/Survey/Default/config/__tests__/config-test.js
+++ b/src/Survey/Default/config/__tests__/config-test.js
@@ -1,13 +1,8 @@
-import defaultSurvey, {
- _getFullTaxaGroupSurvey,
- getTaxaGroupSurvey,
-} from '../';
-import birdsSurvey from '../birds';
-import dragonfliesSurvey from '../dragonflies';
-
import i18n from 'i18next';
-
import { initReactI18next } from 'react-i18next';
+import defaultSurvey, { _getFullTaxaGroupSurvey, getTaxaGroupSurvey } from '..';
+import birdsSurvey from '../birds';
+import dragonfliesSurvey from '../dragonflies';
i18n.use(initReactI18next).init({ lng: 'en' });
diff --git a/src/Survey/Default/config/arthropods.ts b/src/Survey/Default/config/arthropods.ts
index a7432f0d..22f7ce36 100644
--- a/src/Survey/Default/config/arthropods.ts
+++ b/src/Survey/Default/config/arthropods.ts
@@ -1,5 +1,5 @@
-import progressIcon from 'common/images/progress-circles.svg';
import { groupsReverse as groups } from 'common/data/informalGroups';
+import progressIcon from 'common/images/progress-circles.svg';
import { Survey } from 'Survey/common/config';
const stage = [
diff --git a/src/Survey/Default/config/bryophytes.ts b/src/Survey/Default/config/bryophytes.ts
index 6b0b375e..fd79db47 100644
--- a/src/Survey/Default/config/bryophytes.ts
+++ b/src/Survey/Default/config/bryophytes.ts
@@ -1,7 +1,7 @@
import { clipboardOutline } from 'ionicons/icons';
-import landIcon from 'common/images/land.svg';
-import genderIcon from 'common/images/gender.svg';
import { groupsReverse as groups } from 'common/data/informalGroups';
+import genderIcon from 'common/images/gender.svg';
+import landIcon from 'common/images/land.svg';
import { Survey } from 'Survey/common/config';
const habitatOptions = [
diff --git a/src/Survey/Default/config/butterflies.ts b/src/Survey/Default/config/butterflies.ts
index d597f6cf..1bda77dc 100644
--- a/src/Survey/Default/config/butterflies.ts
+++ b/src/Survey/Default/config/butterflies.ts
@@ -1,8 +1,8 @@
+import { groupsReverse as groups } from 'common/data/informalGroups';
import genderIcon from 'common/images/gender.svg';
import numberIcon from 'common/images/number.svg';
import progressIcon from 'common/images/progress-circles.svg';
import appModel from 'models/app';
-import { groupsReverse as groups } from 'common/data/informalGroups';
import { Survey } from 'Survey/common/config';
const sex = [
diff --git a/src/Survey/Default/config/dragonflies.ts b/src/Survey/Default/config/dragonflies.ts
index 664d811c..491c0309 100644
--- a/src/Survey/Default/config/dragonflies.ts
+++ b/src/Survey/Default/config/dragonflies.ts
@@ -1,6 +1,6 @@
-import numberIcon from 'common/images/number.svg';
-import landIcon from 'common/images/land.svg';
import { groupsReverse as groups } from 'common/data/informalGroups';
+import landIcon from 'common/images/land.svg';
+import numberIcon from 'common/images/number.svg';
import { Survey } from 'Survey/common/config';
const numRanges = [
diff --git a/src/Survey/Default/config/index.ts b/src/Survey/Default/config/index.ts
index 94cb23e6..a85ab70d 100644
--- a/src/Survey/Default/config/index.ts
+++ b/src/Survey/Default/config/index.ts
@@ -1,11 +1,13 @@
/* eslint-disable no-param-reassign */
-import appModel from 'models/app';
+import mergeWith from 'lodash.mergewith';
+import * as Yup from 'yup';
import genderIcon from 'common/images/gender.svg';
import numberIcon from 'common/images/number.svg';
import progressIcon from 'common/images/progress-circles.svg';
+import userModel from 'common/models/user';
+import appModel from 'models/app';
import AppOccurrence from 'models/occurrence';
import AppSample from 'models/sample';
-import * as Yup from 'yup';
import {
coreAttributes,
dateAttr,
@@ -18,15 +20,15 @@ import {
identifiersAttr,
getSystemAttrs,
makeSubmissionBackwardsCompatible,
+ recorderAttr,
} from 'Survey/common/config';
-import mergeWith from 'lodash.mergewith';
import arthropodSurvey from './arthropods';
-import dragonfliesSurvey from './dragonflies';
+import birdsSurvey from './birds';
import bryophytesSurvey from './bryophytes';
import butterfliesSurvey from './butterflies';
+import dragonfliesSurvey from './dragonflies';
import mothsSurvey from './moths';
import plantFungiSurvey from './plantFungi';
-import birdsSurvey from './birds';
export const taxonGroupSurveys = {
arthropods: arthropodSurvey,
@@ -103,6 +105,10 @@ const survey: Survey = {
date: dateAttr,
+ recorder: recorderAttr,
+ /** @deprecated */
+ recorders: recorderAttr,
+
activity: activityAttr,
},
@@ -224,21 +230,25 @@ const survey: Survey = {
},
},
- async create(Sample, Occurrence, options) {
+ async create({ Sample, Occurrence, image, taxon, skipLocation, skipGPS }) {
const ignoreErrors = () => {};
- const { image, taxon, skipLocation, skipGPS } = options;
-
const occurrence = new Occurrence();
if (image) occurrence.media.push(image);
+ // add currently logged in user as one of the recorders
+ let recorder = '';
+ if (userModel.isLoggedIn()) {
+ recorder = userModel.getPrettyName();
+ }
+
const sample = new Sample({
metadata: {
survey_id: survey.id,
survey: survey.name,
},
- attrs: { location: {} },
+ attrs: { location: {}, recorder },
});
sample.occurrences.push(occurrence);
@@ -277,10 +287,6 @@ const survey: Survey = {
return sample;
},
- async createWithPhoto(Sample, Occurrence, { image }) {
- return survey.create(Sample, Occurrence, { image });
- },
-
modifySubmission(submission) {
Object.assign(submission.values, getSystemAttrs());
@@ -337,7 +343,7 @@ export function _getFullTaxaGroupSurvey(
return undefined;
}
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
const { render, taxaGroups, ...defaultSurveyCopy } = survey;
const mergedDefaultSurvey: Survey = mergeWith(
{},
diff --git a/src/Survey/Default/config/plantFungi.ts b/src/Survey/Default/config/plantFungi.ts
index 4289112d..75083383 100644
--- a/src/Survey/Default/config/plantFungi.ts
+++ b/src/Survey/Default/config/plantFungi.ts
@@ -1,7 +1,7 @@
+import { groupsReverse as groups } from 'common/data/informalGroups';
import numberIcon from 'common/images/number.svg';
-import Sample from 'models/sample';
import appModel from 'models/app';
-import { groupsReverse as groups } from 'common/data/informalGroups';
+import Sample from 'models/sample';
import { Survey } from 'Survey/common/config';
const numberOptions = [
diff --git a/src/Survey/Default/router.jsx b/src/Survey/Default/router.jsx
index 7cdd5af5..0c1f3d61 100644
--- a/src/Survey/Default/router.jsx
+++ b/src/Survey/Default/router.jsx
@@ -1,8 +1,8 @@
import { RouteWithModels, AttrPage } from '@flumens';
import savedSamples from 'models/savedSamples';
+import Activity from 'Survey/common/Components/Activity';
import ModelLocation from 'Survey/common/Components/ModelLocation';
import StartNewSurvey from 'Survey/common/Components/StartNewSurvey';
-import Activity from 'Survey/common/Components/Activity';
import Taxon from 'Survey/common/Components/Taxon';
import DefaultHome from './Home';
import NewSurveyTaxon from './Taxon';
diff --git a/src/Survey/List/Home/Main/index.tsx b/src/Survey/List/Home/Main.tsx
similarity index 61%
rename from src/Survey/List/Home/Main/index.tsx
rename to src/Survey/List/Home/Main.tsx
index 68874678..9530bdb1 100644
--- a/src/Survey/List/Home/Main/index.tsx
+++ b/src/Survey/List/Home/Main.tsx
@@ -1,23 +1,27 @@
-import { FC } from 'react';
+import { useContext } from 'react';
import { observer } from 'mobx-react';
-import { IonButton, IonLabel, IonList } from '@ionic/react';
-import { Main } from '@flumens';
-import MenuDynamicAttrs from 'Survey/common/Components/MenuDynamicAttrs';
-import MenuAttr from 'Survey/common/Components/MenuAttr';
+import { useRouteMatch } from 'react-router';
+import { Button, InfoMessage, Main } from '@flumens';
+import { IonList, NavContext } from '@ionic/react';
+import Sample from 'models/sample';
import DisabledRecordMessage from 'Survey/common/Components/DisabledRecordMessage';
+import MenuAttr from 'Survey/common/Components/MenuAttr';
+import MenuDynamicAttrs from 'Survey/common/Components/MenuDynamicAttrs';
import SpeciesList from 'Survey/common/Components/SpeciesList';
-import Sample from 'models/sample';
-import { useRouteMatch } from 'react-router';
-import { Trans as T } from 'react-i18next';
-import './styles.scss';
type Props = {
sample: Sample;
onDelete: any;
+ showChildSampleDistanceWarning: boolean;
};
-const HomeMain: FC = ({ sample, onDelete }) => {
+const HomeMain = ({
+ sample,
+ onDelete,
+ showChildSampleDistanceWarning,
+}: Props) => {
const { url } = useRouteMatch();
+ const { navigate } = useContext(NavContext);
// calculate unique taxa
const uniqueTaxa: any = {};
@@ -36,36 +40,39 @@ const HomeMain: FC = ({ sample, onDelete }) => {
return (
-
+
{isDisabled && (
-
+
)}
{/* Only showing if pre-selected */}
{activity && (
-
+
)}
-
+
+ {showChildSampleDistanceWarning && (
+
+ Some species are located far from the survey area. Please check
+ that this is correct.
+
+ )}
{!isDisabled && (
- navigate(`${url}/taxon`)}
>
-
- Add Species
-
-
+ Add Species
+
)}
diff --git a/src/Survey/List/Home/Main/styles.scss b/src/Survey/List/Home/Main/styles.scss
deleted file mode 100644
index 70d3881f..00000000
--- a/src/Survey/List/Home/Main/styles.scss
+++ /dev/null
@@ -1,8 +0,0 @@
-#survey-complex-default-edit {
- ion-content {
- #add {
- width: 40%;
- margin: 30px auto 10px;
- }
- }
-}
diff --git a/src/Survey/List/Home/index.tsx b/src/Survey/List/Home/index.tsx
index b85309a8..341ea4f0 100644
--- a/src/Survey/List/Home/index.tsx
+++ b/src/Survey/List/Home/index.tsx
@@ -1,18 +1,20 @@
-import { FC, useContext } from 'react';
+import { useContext } from 'react';
import { observer } from 'mobx-react';
+import { Page, Header, useToast } from '@flumens';
import { NavContext } from '@ionic/react';
+import distance from '@turf/distance';
+import gridAlertService from 'common/helpers/gridAlertService';
import Sample, { useValidateCheck } from 'models/sample';
import { useUserStatusCheck } from 'models/user';
-import { Page, Header, useToast } from '@flumens';
-import AppHeaderBand from 'Survey/common/Components/AppHeaderBand';
-import PrimaryHeaderButton from 'Survey/common/Components/PrimaryHeaderButton';
+import SurveyHeaderButton from 'Survey/common/Components/SurveyHeaderButton';
+import TrainingBand from 'Survey/common/Components/TrainingBand';
import Main from './Main';
type Props = {
sample: Sample;
};
-const ListHome: FC = ({ sample }) => {
+const ListHome = ({ sample }: Props) => {
const toast = useToast();
const { navigate } = useContext(NavContext);
const checkSampleStatus = useValidateCheck(sample);
@@ -33,6 +35,8 @@ const ListHome: FC = ({ sample }) => {
const isValid = checkSampleStatus();
if (!isValid) return;
+ gridAlertService.stop(sample.cid);
+
// eslint-disable-next-line no-param-reassign
sample.metadata.saved = true;
sample.save();
@@ -50,12 +54,26 @@ const ListHome: FC = ({ sample }) => {
!isSaved ? _processDraft() : _processSubmission();
const finishButton = (
-
+
);
const { training } = sample.attrs;
- const subheader = !!training && ;
+ const subheader = !!training && ;
+
+ const { location } = sample.attrs;
+
+ const isLocationFurtherThan5000m = (smp: Sample) =>
+ distance(
+ [location.latitude, location.longitude],
+ [smp.attrs.location.latitude, smp.attrs.location.longitude],
+ {
+ units: 'meters',
+ }
+ ) > 5000;
+ const showChildSampleDistanceWarning = sample.samples.some(
+ isLocationFurtherThan5000m
+ );
return (
@@ -65,7 +83,11 @@ const ListHome: FC = ({ sample }) => {
defaultHref="/home/surveys"
subheader={subheader}
/>
-
+
);
};
diff --git a/src/Survey/List/OccurrenceHome.tsx b/src/Survey/List/OccurrenceHome.tsx
index f1936e23..5ead420b 100644
--- a/src/Survey/List/OccurrenceHome.tsx
+++ b/src/Survey/List/OccurrenceHome.tsx
@@ -1,21 +1,20 @@
-import { FC } from 'react';
-import { IonList } from '@ionic/react';
+import { observer } from 'mobx-react';
+import { useRouteMatch } from 'react-router';
import { Page, Header, Main } from '@flumens';
-import PhotoPicker from 'Survey/common/Components/PhotoPicker';
+import { IonList } from '@ionic/react';
+import Sample from 'models/sample';
+import MenuAttr from 'Survey/common/Components/MenuAttr';
import MenuDynamicAttrs from 'Survey/common/Components/MenuDynamicAttrs';
-import MenuTaxonItem from 'Survey/common/Components/MenuTaxonItem';
import MenuLocation from 'Survey/common/Components/MenuLocation';
-import MenuAttr from 'Survey/common/Components/MenuAttr';
+import MenuTaxonItem from 'Survey/common/Components/MenuTaxonItem';
+import PhotoPicker from 'Survey/common/Components/PhotoPicker';
import VerificationMessage from 'Survey/common/Components/VerificationMessage';
-import Sample from 'models/sample';
-import { observer } from 'mobx-react';
-import { useRouteMatch } from 'react-router';
type Props = {
subSample: Sample;
};
-const ListOccurrenceHome: FC = ({ subSample: sample }) => {
+const ListOccurrenceHome = ({ subSample: sample }: Props) => {
const [occ] = sample.occurrences;
const { url } = useRouteMatch();
@@ -26,17 +25,17 @@ const ListOccurrenceHome: FC = ({ subSample: sample }) => {
-
+
{isDisabled && (
-
) : (
-
- No site name
-
+ No site name
);
const isDisabled = sample.isDisabled();
@@ -59,22 +53,19 @@ const MenuLocation: FC & { WithLock: FC } = ({
-
+ {label}
-
+
+);
+
+export default TrainingBand;
diff --git a/src/Survey/common/Components/VerificationMessage/index.tsx b/src/Survey/common/Components/VerificationMessage/index.tsx
index 6cf29e45..b9748d8d 100644
--- a/src/Survey/common/Components/VerificationMessage/index.tsx
+++ b/src/Survey/common/Components/VerificationMessage/index.tsx
@@ -1,9 +1,9 @@
-import { FC } from 'react';
-import Occurrence from 'models/occurrence';
-import { InfoMessage, InfoButton } from '@flumens';
-import { useTranslation, Trans as T } from 'react-i18next';
import clsx from 'clsx';
import { checkmarkCircle, closeCircle } from 'ionicons/icons';
+import { useTranslation, Trans as T } from 'react-i18next';
+import { InfoMessage, InfoButton } from '@flumens';
+import { IonIcon } from '@ionic/react';
+import Occurrence from 'models/occurrence';
import './styles.scss';
const getVerificationText = (
@@ -39,7 +39,7 @@ const getVerificationText = (
Thanks for sending in your record. From this record details, we
- think it could be the {{ taxonName }} species.
+ think it could be the {{ taxonName } as any} species.
>
@@ -56,9 +56,9 @@ const getVerificationText = (
Thanks for sending in your record. A verifier has marked it as{' '}
- {{ statusMessage: t(statusMessage) }} in this case. Please
- log in to the iRecord St Helena App website to see any additional
- information that the verifier may have provided.
+ {{ statusMessage: t(statusMessage) } as any} in this case.
+ Please log in to the iRecord St Helena App website to see any
+ additional information that the verifier may have provided.