Skip to content

Commit

Permalink
Merge branch 'develop' into cjfit/dynamicenv-498
Browse files Browse the repository at this point in the history
  • Loading branch information
cjfit authored Aug 6, 2024
2 parents 42d3bb1 + 9f5c697 commit e780ee7
Show file tree
Hide file tree
Showing 21 changed files with 704 additions and 270 deletions.
14 changes: 14 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: phlask-ecosystem
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.acceptSuggestionOnEnter": "on"
"editor.acceptSuggestionOnEnter": "on",
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
}
}
76 changes: 33 additions & 43 deletions cypress/e2e/desktop/filters.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,37 @@

// For each resource type, test each filter permutation and confirm only the expected number of taps appear.
describe("filters", () => {
beforeEach(() => {
cy.visit("/");
// Load the form

// NOTE: This line currently uses components that are due to be updated.
// Close the tutorial modal
cy.get('[aria-label=Close]').click()
// Load the filter menu
cy.get('[data-cy=button-filter-menu]').click()
});

it("should successfully show a result for each water site filter permutation", () => {
// TODO Add an approach to test all possible filter permutations
// Currently limiting this test to a single filtering permutation as a starting point

cy.get('[data-cy="filter-option-Drinking fountain"]').click()
cy.get('[data-cy="filter-option-ADA accessible"]').click()
cy.get('[data-cy="filter-option-Open Access"]').click()

cy.get('[data-cy=filter-apply-button]').click()

// Close the filter menu
cy.get('[data-cy=button-filter-menu]').click()

// Check that a location that matches filter is present
cy.get('[title=data-cy-2]').should('exist');

// Check that a location that does not match filter is not present
// NOTE: This is commented as this test will not current pass as filtering is not working properly.
// cy.get('[title=data-cy-1]').should('not.exist');
});

it("should successfully show a result for each food site filter permutation", () => {
// TODO
});

it("should successfully show a result for each foraging site filter permutation", () => {
// TODO
});

it("should successfully show a result for each bathroom site filter permutation", () => {
// TODO
});
beforeEach(() => {
cy.visit("/");
// Load the form

// NOTE: This line currently uses components that are due to be updated.
// Close the tutorial modal
cy.get('[aria-label=Close]').click()
// Load the filter menu
cy.get('[data-cy=button-filter-menu]').click()
});

it("should successfully show a result for each water site filter permutation", () => {
// TODO Add an approach to test all possible filter permutations
// Currently limiting this test to a single filtering permutation as a starting point

cy.get('[data-cy="filter-option-Drinking fountain"]').click()
cy.get('[data-cy="filter-option-ADA accessible"]').click()
cy.get('[data-cy="filter-option-Open Access"]').click()
// Close the filter menu
cy.get('[data-cy=button-filter-menu]').click()
});

it("should successfully show a result for each food site filter permutation", () => {
// TODO
});

it("should successfully show a result for each foraging site filter permutation", () => {
// TODO
});

it("should successfully show a result for each bathroom site filter permutation", () => {
// TODO
});
});
96 changes: 80 additions & 16 deletions public/testData.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -44,7 +48,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -71,7 +79,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -98,7 +110,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -125,7 +141,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -152,7 +172,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -179,7 +203,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand All @@ -206,7 +234,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"water": {
"dispenser_type": [
Expand Down Expand Up @@ -237,7 +269,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -263,7 +299,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -289,7 +329,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -315,7 +359,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -341,7 +389,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -367,7 +419,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -393,7 +449,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
},
Expand All @@ -419,7 +479,11 @@
},
"state": "PA",
"status": "OPERATIONAL",
"verified": false,
"verification": {
"verified": false,
"last_modified": "2024-03-31T00:37:46.004545+00:00",
"verifier": "phlask"
},
"version": 1,
"zip_code": "19149"
}
Expand Down
27 changes: 18 additions & 9 deletions src/actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ export const setToggleStateFood = (toggle, toggleState) => ({
toggleState
});

export const SET_FILTER_FUNCTION = 'SET_FILTER_FUNCTION';
export const setFilterFunction = () => ({
type: SET_FILTER_FUNCTION
});
export const setFilterFunction = createAction('SET_FILTER_FUNCTION')

export const setEntryFilterFunction = createAction('SET_ENTRY_FILTER_FUNCTION')

export const removeFilterFunction = createAction('REMOVE_FILTER_FUNCTION')

export const removeEntryFilterFunction = createAction('REMOVE_ENTRY_FILTER_FUNCTION')

export const resetFilterFunction = createAction('RESET_FILTER_FUNCTION')

export const RESET_FILTER_FUNCTION = 'RESET_FILTER_FUNCTION';
export const resetFilterFunction = () => ({
type: RESET_FILTER_FUNCTION
});

export const getResources = createAsyncThunk(
'fetch-resources',
Expand All @@ -37,7 +38,12 @@ export const getResources = createAsyncThunk(
if (process.env.REACT_APP_CYPRESS_TEST) return testData;
const snapshot = await get(ref(database, '/'));
const results = snapshot.val();
return Object.values(results) || [];
return Object.entries(results).map(
([id, resource]) => ({
...resource,
id
})
);
}
);

Expand All @@ -48,6 +54,9 @@ export const pushNewResource = newResource => ({
newResource
});

// Handles the case where an existing resource is updated from the submission form
export const updateExistingResource = createAction('UPDATE_EXISTING_RESOURCE');

export const SET_USER_LOCATION = 'SET_USER_LOCATION';
export const setUserLocation = coords => ({
type: SET_USER_LOCATION,
Expand Down
4 changes: 3 additions & 1 deletion src/components/AddResourceModal/AddBathroom/PageOne.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import MyLocationIcon from '@mui/icons-material/MyLocation';
import useIsMobile from 'hooks/useIsMobile';
import noop from 'utils/noop';

import { WEBSITE_REGEX } from '../utils';

const ENTRY_TYPE = [
{ entryType: 'Open access', explanation: 'Public site, open to all' },
{ entryType: 'Restricted', explanation: 'May not be open to all' },
Expand Down Expand Up @@ -195,7 +197,7 @@ const PageOne = ({
<Controller
rules={{
required: false,
pattern: /^[A-Za-z]{1,}[.]{1}[a-z]{2,3}/
pattern: WEBSITE_REGEX
}}
control={control}
name="website"
Expand Down
4 changes: 3 additions & 1 deletion src/components/AddResourceModal/AddFood/PageOne.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import useIsMobile from 'hooks/useIsMobile';
import noop from 'utils/noop';

import { WEBSITE_REGEX } from '../utils';

const PageOne = ({
// state values and handlers for the textfields
onDrop,
Expand Down Expand Up @@ -265,7 +267,7 @@ const PageOne = ({
<Controller
rules={{
required: false,
pattern: /^[A-Za-z]{1,}[.]{1}[a-z]{2,3}/
pattern: WEBSITE_REGEX
}}
control={control}
name="website"
Expand Down
Loading

0 comments on commit e780ee7

Please sign in to comment.