Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'WildMeOrg:develop' into 637-installinstructions
Browse files Browse the repository at this point in the history
  • Loading branch information
TanyaStere42 authored Jan 19, 2024
2 parents bb3f3e9 + 5dc1dc1 commit c810189
Show file tree
Hide file tree
Showing 54 changed files with 2,877 additions and 1,195 deletions.
25 changes: 22 additions & 3 deletions locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"SOCIAL_GROUP_SUBHEADER": "Social group created on {dateCreated}",
"ALL_SOCIAL_GROUPS": "All social groups",
"BULK_IMPORT": "Bulk import",
"DATA_PAGE" : "Data page",
"LIME": "Lime",
"LABEL": "Label",
"TYPE": "Type",
Expand Down Expand Up @@ -200,6 +201,7 @@
"SEARCH_ITIS_SPECIES": "Search ITIS species",
"SEARCH_INDIVIDUALS_INSTRUCTION": "Search for an individual by name or guid",
"SEARCH_SIGHTINGS_INSTRUCTION": "Search for a sighting by location, owner or guid",
"SEARCH_ANIMALS_INSTRUCTION": "Search for an animal by location or owner",
"SEARCH_USER_INSTRUCTION": "Search for a user by name or email",
"PRAIRIE": "Prairie",
"EDIT_USER_METADATA": "Edit user metadata",
Expand Down Expand Up @@ -547,6 +549,8 @@
"SPECIAL_INPUTS": "SPECIAL FIELDS",
"SIGHTING_SEARCH_RESULT_PRIMARY_TEXT": "{date} sighting in {region}",
"SIGHTING_SEARCH_RESULT_SECONDARY_TEXT": "Reported by {name} on {date}",
"ANIMAL_SEARCH_RESULT_PRIMARY_TEXT": "{date} sighting in {region}",
"ANIMAL_SEARCH_RESULT_SECONDARY_TEXT": "Reported by {name} on {date}",
"SELECTED_QUERY_ANNOTATION": "Selected query annotation",
"IDENTIFICATION_FINISHED_TIME": "Identification finished on {time}.",
"SELECTED_MATCH_CANDIDATE": "Selected match candidate",
Expand Down Expand Up @@ -637,6 +641,7 @@
"SPECIES:": "Species:",
"EXPLORE_SIGHTINGS_CAPITALIZED": "Explore Sightings",
"EXPLORE_SIGHTINGS": "Explore sightings",
"EXPLORE_ANIMALS": "Explore animals",
"ATTRIBUTES": "Attributes",
"RELATIONSHIPS": "Relationships",
"RELATIONSHIPS_DESCRIPTION": "Known or observed social and familial relationships.",
Expand Down Expand Up @@ -986,6 +991,7 @@
"COMPONENT_COMMIT_HASH": "{component} commit hash: ",
"INDIVIDUAL_SEARCH_NO_RESULTS": "Your search \"{searchTerm}\" did not match any individuals.",
"SIGHTING_SEARCH_NO_RESULTS": "Your search \"{searchTerm}\" did not match any sightings.",
"ENCOUNTER_SEARCH_NO_RESULTS": "Your search \"{searchTerm}\" did not match any sightings.",
"POTENTIAL_COLLABORATOR_SEARCH_NO_RESULTS": "Your search \"{searchTerm}\" did not match any potential collaborators.",
"SEARCH_SERVER_ERROR": "A server error occurred while attempting to search.",
"CONFIGURATION_SITE_NAME_LABEL": "Site name",
Expand Down Expand Up @@ -1139,8 +1145,8 @@
"ROLE_GUID_MISSING": "Role is missing ID",
"UNFINISHED_OPTIONS": "Options must have valid values and labels and unique values",
"PROGRESS_STATISTICS_UNKNOWN_PROGRESS": "unknown progress",
"PROGRESS_STATISTICS_UNKNOWN_ETA_&_UNKNOWN_QUEUE": "Unknown time remaining. Queued behind an unknown number of jobs.",
"PROGRESS_STATISTICS_UNKNOWN_ETA_&_QUEUE": "Unknown time remaining. Queued behind {ahead, number} {ahead, plural, one {job} other {jobs}}.",
"PROGRESS_STATISTICS_UNKNOWN_ETA_&_UNKNOWN_QUEUE": "Estimated time to complete failed to calculate. If processing does not complete within a day, re-run the job. Queued behind an unknown number of jobs.",
"PROGRESS_STATISTICS_UNKNOWN_ETA_&_QUEUE": "Estimated time to complete failed to calculate. If processing does not complete within a day, re-run the job. Queued behind {ahead, number} {ahead, plural, one {job} other {jobs}}.",
"PROGRESS_STATISTICS_WRAPPING_ETA_&_UNKNOWN_QUEUE": "Wrapping up... Queued behind an unknown number of jobs.",
"PROGRESS_STATISTICS_WRAPPING_ETA_&_QUEUE": "Wrapping up... Queued behind {ahead, number} {ahead, plural, one {job} other {jobs}}.",
"PROGRESS_STATISTICS_ETA_&_UNKNOWN_QUEUE": "{timeRemaining} left. Queued behind an unknown number of jobs.",
Expand Down Expand Up @@ -1271,5 +1277,18 @@
"CONFIRM_NO_MATCH" : "Confirm no match",
"NUMBER_OF_INDIVIDUALS" : "Number of individuals",
"NUMBER_OF_ENCOUNTERS" : "Number of animals",
"ASSIGN" : "Assign"
"NUMBER_OF_ANNOTATIONS" : "Number of annotations",
"ASSIGN" : "Assign",
"STATE" : "State",
"ENCOUNTER_TIME" : "Time of encounter",
"LATITUDE" : "Latitude",
"LONGTITUDE" : "Longtitude",
"MY_PENDING_SIGHTINGS" : "My pending sightings",
"MY_SIGHTINGS" : "My sightings",
"MY_UNAPPROVED_SIGHTINGS" : "My unapproved sightings",
"TotalAccount" : "Total Account: {totalAccount}",
"MANAGE_REGIONS" : "Manage Regions",
"EXPORT_RESULT" : "Export result",
"EXPORT_ACCESS_RESTRICTED_WARNING" : "No results meet export criteria. Consider adjusting your search or requesting export collaborations.",
"OK" : "Ok"
}
25 changes: 16 additions & 9 deletions src/AuthenticatedSwitch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import AuthenticatedAppHeader from './components/AuthenticatedAppHeader';
import SaveCustomField from './pages/fieldManagement/settings/saveField/SaveField';
import GeneralSettings from './pages/generalSettings/GeneralSettings';
import SiteStatus from './pages/siteStatus/SiteStatus';
import SplashSettings from './pages/splashSettings/SplashSettings';
import FieldManagement from './pages/fieldManagement/FieldManagement';
import UserManagement from './pages/userManagement/UserManagement';
import AdminActions from './pages/adminActions/AdminActions';
Expand Down Expand Up @@ -36,19 +35,21 @@ import FourOhFour from './pages/fourohfour/FourOhFour';
import useSiteSettings from './models/site/useSiteSettings';
import SearchIndividuals from './pages/individual/SearchIndividuals';
import SearchSightings from './pages/sighting/SearchSightings';
import SearchAnimals from './pages/sighting/encounters/SearchAnimals';
import SiteSetup from './pages/setup/SiteSetup';
import MatchSighting from './pages/match/MatchSighting';
import AuditLog from './pages/devTools/AuditLog';
import Welcome from './pages/auth/Welcome';
import EmailVerified from './pages/auth/EmailVerified';
import Home from './pages/home/Home';
import Preferences from './pages/preferences/Preferences';
import ResendVerificationEmail from './pages/auth/ResendVerificationEmail';
import Footer from './components/Footer';
import { defaultCrossfadeDuration } from './constants/defaults';
import Requests from './pages/setup/Requests';
import SpeciesManagement from './pages/fieldManagement/SpeciesManagement';
import RegionManagement from './pages/fieldManagement/RegionManagement';
import ChangeLog from './pages/changeLog/ChangeLog';
import DataPage from './pages/dataPage/DataPage';

export default function AuthenticatedSwitch({
emailNeedsVerification,
Expand Down Expand Up @@ -100,9 +101,6 @@ export default function AuthenticatedSwitch({
<SiteSetup />
) : (
<Switch location={location}>
<Route path="/settings/front-page" exact>
<SplashSettings />
</Route>
<Route path="/settings/front-page/preview">
<Splash />
</Route>
Expand All @@ -118,6 +116,9 @@ export default function AuthenticatedSwitch({
<Route path="/settings/fields/species">
<SpeciesManagement />
</Route>
<Route path="/settings/fields/regions">
<RegionManagement />
</Route>
<Route path="/settings/fields/save-custom-field/:type?/:id?">
<SaveCustomField />
</Route>
Expand All @@ -130,9 +131,6 @@ export default function AuthenticatedSwitch({
<Route path="/settings/social-groups">
<SocialGroups />
</Route>
<Route path="/settings/preferences">
<Preferences />
</Route>
<Route path="/settings/changelog">
<ChangeLog />
</Route>
Expand Down Expand Up @@ -166,6 +164,9 @@ export default function AuthenticatedSwitch({
<Route path="/merge">
<MergeIndividuals />
</Route>
<Route path="/data-page">
<DataPage />
</Route>
<Route path="/bulk-imports/:id">
<AssetGroup />
</Route>
Expand All @@ -184,6 +185,9 @@ export default function AuthenticatedSwitch({
<Route path="/sightings">
<SearchSightings />
</Route>
<Route path="/animals">
<SearchAnimals />
</Route>
<Route path="/match-results/:sightingGuid">
<MatchSighting />
</Route>
Expand Down Expand Up @@ -214,9 +218,12 @@ export default function AuthenticatedSwitch({
<Route path="/welcome">
<Welcome />
</Route>
<Route path="/" exact>
<Route path="/user-profile" exact>
<Home />
</Route>
<Route path="/" exact>
<DataPage />
</Route>
<Route>
<FourOhFour />
</Route>
Expand Down
9 changes: 8 additions & 1 deletion src/components/AuthenticatedAppHeader/ActionsPane.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import Divider from '@material-ui/core/Divider';
import PublicIcon from '@material-ui/icons/SupervisedUserCircle';
import ControlPanelIcon from '@material-ui/icons/PermDataSetting';
import BulkImportIcon from '@material-ui/icons/PostAdd';
import InsertChartOutlinedOutlinedIcon from '@material-ui/icons/InsertChartOutlined';
import LogoutIcon from '@material-ui/icons/ExitToApp';

import Link from '../Link';
import Text from '../Text';
import defaultProfilePhoto from '../../assets/defaultProfile.jpg';

const actions = [
{
id: 'data-page',
href: '/data-page',
messageId: 'DATA_PAGE',
icon: InsertChartOutlinedOutlinedIcon,
},
{
id: 'bulk-import',
href: '/bulk-import',
Expand Down Expand Up @@ -87,7 +94,7 @@ export default function NotificationsPane({
onClose={closePopover}
>
<MenuList style={{ minWidth: 270 }}>
<Link href="/" onClick={closePopover} noUnderline>
<Link href="/user-profile" onClick={closePopover} noUnderline>
<MenuItem style={{ minHeight: 'auto' }}>
<Avatar
style={{ height: 52, width: 52 }}
Expand Down
112 changes: 112 additions & 0 deletions src/components/AuthenticatedAppHeader/AnimalsButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { get } from 'lodash-es';

import List from '@material-ui/core/List';
import Divider from '@material-ui/core/Divider';

import {
formatDate,
formatSpecifiedTime,
} from '../../utils/formatters';
import useEncounterTermQuery from '../../models/encounter/useEncounterTermQuery';
import Text from '../Text';
import SearchButton from './SearchButton';
import SearchResult from './SearchResult';

export default function AnimalsButton() {
const [inputContent, setInputContent] = useState('');
const [searchTerm, setSearchTerm] = useState('');

const {
data: searchResults,
loading,
error,
} = useEncounterTermQuery(searchTerm);

const resultsCurrent = inputContent === searchTerm;
const noResults = searchResults?.length === 0;
const mappableSearchResults = resultsCurrent
? searchResults || []
: [];
const showDivider = resultsCurrent && (error || searchResults);

return (
<SearchButton
loading={loading}
buttonLabelId="ANIMALS"
inputValue={inputContent}
onChangeInputValue={setInputContent}
onSearch={setSearchTerm}
instructionsLabelId="SEARCH_ANIMALS_INSTRUCTION"
linkLabelId="EXPLORE_ANIMALS"
linkHref="/animals"
>
{closePopover => (
<>
{showDivider && <Divider />}
{resultsCurrent && noResults && (
<Text
variant="body2"
style={{ padding: '16px 0 0 48px' }}
id="ENCOUNTER_SEARCH_NO_RESULTS"
values={{ searchTerm }}
/>
)}
{resultsCurrent && error && (
<Text
id="SEARCH_SERVER_ERROR"
variant="body2"
style={{ padding: '16px 0 0 48px' }}
/>
)}
<List dense style={{ maxHeight: 400, overflow: 'auto' }}>
{mappableSearchResults.map(encounter => {
const encounterGuid = encounter?.guid;
const sightingGuid = encounter?.sighting_guid;
const ownerName = get(
encounter,
['owner', 'full_name'],
'Unknown User',
);
const regionLabel = encounter?.locationId_value;
const createdDate = formatDate(
encounter?.created,
true,
);
const encounterDate = formatSpecifiedTime(
encounter?.time,
encounter?.timeSpecificity,
);
const avatarLetter = ownerName[0].toUpperCase();

return (
<SearchResult
key={encounterGuid}
avatarLetter={avatarLetter}
href={`/sightings/${sightingGuid}`}
onClick={closePopover}
primaryText={
<FormattedMessage
values={{
region: regionLabel,
date: encounterDate,
}}
id="ANIMAL_SEARCH_RESULT_PRIMARY_TEXT"
/>
}
secondaryText={
<FormattedMessage
values={{ name: ownerName, date: createdDate }}
id="ANIMAL_SEARCH_RESULT_SECONDARY_TEXT"
/>
}
/>
);
})}
</List>
</>
)}
</SearchButton>
);
}
2 changes: 2 additions & 0 deletions src/components/AuthenticatedAppHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import NotificationsPane from './NotificationsPane';
import ActionsPane from './ActionsPane';
import IndividualsButton from './IndividualsButton';
import SightingsButton from './SightingsButton';
import AnimalsButton from './AnimalsButton';
import queryKeys from '../../constants/queryKeys';

export default function AppHeader() {
Expand Down Expand Up @@ -99,6 +100,7 @@ export default function AppHeader() {
<BannerLogo href="/" onClick={handleClick} />
<IndividualsButton />
<SightingsButton />
<AnimalsButton />
</div>
)}

Expand Down
Loading

0 comments on commit c810189

Please sign in to comment.