Skip to content

Commit

Permalink
Merge pull request #3349 from mariojsnunes/feat/question-filters
Browse files Browse the repository at this point in the history
feat: update question filters
  • Loading branch information
benfurber authored Mar 25, 2024
2 parents 9472531 + 161bf52 commit d7eaa82
Show file tree
Hide file tree
Showing 24 changed files with 1,042 additions and 139 deletions.
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build
.firebase
storybook-static
dist
dist
firestore.indexes.json
firebase.json
16 changes: 13 additions & 3 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{
"$schema": "./node_modules/firebase-tools/schema/firebase-config.json",
"hosting": {
"public": "build",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/api",
Expand Down Expand Up @@ -86,7 +91,9 @@
]
},
"functions": {
"predeploy": ["yarn workspace functions build"],
"predeploy": [
"yarn workspace functions build"
],
"source": "functions/dist",
"runtime": "nodejs20"
},
Expand Down Expand Up @@ -122,5 +129,8 @@
},
"extensions": {
"firestore-send-email": "firebase/[email protected]"
},
"firestore": {
"indexes": "./firestore.indexes.json"
}
}
}
151 changes: 151 additions & 0 deletions firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"indexes": [
{
"collectionGroup": "research_rev20201020",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "_createdBy",
"order": "ASCENDING"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "research_rev20201020",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "collaborators",
"arrayConfig": "CONTAINS"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "research_rev20201020",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "moderation",
"order": "ASCENDING"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "v3_howtos",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "_createdBy",
"order": "ASCENDING"
},
{
"fieldPath": "moderation",
"order": "ASCENDING"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "v3_howtos",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "_createdBy",
"order": "ASCENDING"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "v3_howtos",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "_deleted",
"order": "ASCENDING"
},
{
"fieldPath": "_modified",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "v3_howtos",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "moderation",
"order": "ASCENDING"
},
{
"fieldPath": "votedUsefulBy",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "questions_rev20230926",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "_created",
"order": "DESCENDING"
},
{
"fieldPath": "_modified",
"order": "DESCENDING"
},
{
"fieldPath": "commentCount",
"order": "ASCENDING"
},
{
"fieldPath": "commentCount",
"order": "DESCENDING"
},
{
"fieldPath": "latestCommentDate",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "questions_rev20230926",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "questionCategory._id",
"order": "ASCENDING"
},
{
"fieldPath": "_created",
"order": "DESCENDING"
},
{
"fieldPath": "__name__",
"order": "DESCENDING"
}
]
}
],
"fieldOverrides": []
}
8 changes: 8 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { JestConfigWithTsJest } from 'ts-jest'

const config: JestConfigWithTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
}

export default config
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
"start-server-and-test": "^1.11.0",
"stream-browserify": "^3.0.0",
"terser": "3.14.1",
"ts-jest": "^29.1.2",
"ts-loader": "^7.0.5",
"typescript": "^5.1.6",
"wait-on": "^5.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/cypress/src/fixtures/searchResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const SingaporeReverseStubResponse = {
osm_id: 733562800,
lat: '1.3572387983345497',
lon: '103.81937941431262',
display_name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
display_name: 'Drongo Trail, Bishan, Central, Singapore , 578774, Singapore',
address: {
road: 'Drongo Trail',
suburb: 'Bishan',
Expand Down
20 changes: 10 additions & 10 deletions packages/cypress/src/integration/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ describe('[Settings]', () => {
},
],
location: {
administrative: 'Central',
administrative: '',
country: 'Singapore',
countryCode: 'sg',
latlng: { lng: '103.8194992', lat: '1.357107' },
name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
name: 'Drongo Trail, Bishan, Central, Singapore, 578774, Singapore',
postcode: '578774',
value: 'Singapore',
},
Expand Down Expand Up @@ -356,11 +356,11 @@ describe('[Settings]', () => {
],
mapPinDescription: 'Fun, vibrant and full of amazing people',
location: {
administrative: 'Central',
administrative: '',
country: 'Singapore',
countryCode: 'sg',
latlng: { lng: '103.8194992', lat: '1.357107' },
name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
name: 'Drongo Trail, Bishan, Central, Singapore, 578774, Singapore',
postcode: '578774',
value: 'Singapore',
},
Expand Down Expand Up @@ -493,11 +493,11 @@ describe('[Settings]', () => {
},
],
location: {
administrative: 'Central',
administrative: '',
country: 'Singapore',
countryCode: 'sg',
latlng: { lng: '103.8194992', lat: '1.357107' },
name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
name: 'Drongo Trail, Bishan, Central, Singapore, 578774, Singapore',
postcode: '578774',
value: 'Singapore',
},
Expand Down Expand Up @@ -592,11 +592,11 @@ describe('[Settings]', () => {
},
],
location: {
administrative: 'Central',
administrative: '',
country: 'Singapore',
countryCode: 'sg',
latlng: { lng: '103.8194992', lat: '1.357107' },
name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
name: 'Drongo Trail, Bishan, Central, Singapore, 578774, Singapore',
postcode: '578774',
value: 'Singapore',
},
Expand Down Expand Up @@ -687,11 +687,11 @@ describe('[Settings]', () => {
},
],
location: {
administrative: 'Central',
administrative: '',
country: 'Singapore',
countryCode: 'sg',
latlng: { lng: '103.8194992', lat: '1.357107' },
name: 'Drongo Trail, Bishan, Singapore, Central, 578774, Singapore',
name: 'Drongo Trail, Bishan, Central, Singapore, 578774, Singapore',
postcode: '578774',
value: 'Singapore',
},
Expand Down
11 changes: 6 additions & 5 deletions src/pages/Howto/Category/CategoriesSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ import { FieldContainer } from '../../../common/Form/FieldContainer'

import type { ICategory } from 'src/models/categories.model'

/**
* @deprecated in favor of CategoriesSelectV2
*/
export const CategoriesSelect = observer(
({ value, onChange, placeholder, isForm, type }) => {
const { categoriesStore, researchCategoriesStore } =
useCommonStores().stores

let categories: ICategory[] = []
if (type === 'howto') {
const { categoriesStore } = useCommonStores().stores
categories = categoriesStore.allCategories
} else if (type === 'research') {
const { researchCategoriesStore } = useCommonStores().stores
categories = researchCategoriesStore.allResearchCategories
} else if (type === 'question') {
const { questionCategoriesStore } = useCommonStores().stores
categories = questionCategoriesStore.allQuestionCategories
}

const selectOptions = categories
Expand Down
Loading

0 comments on commit d7eaa82

Please sign in to comment.