From 7714f3179ba594787d5f8b1a637432409e7093df Mon Sep 17 00:00:00 2001 From: Thuy Pham Date: Thu, 13 Apr 2023 22:18:43 -0400 Subject: [PATCH 1/3] remove section --- backend/src/app.ts | 12 ++++++------ frontend/src/components/FAQ/index.tsx | 12 ++++++------ frontend/src/pages/FAQPage.tsx | 10 +++------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index 281c7c94..a7a3613a 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -14,7 +14,7 @@ import { ApartmentWithId, } from '@common/types/db-types'; import { db, FieldValue } from './firebase-config'; -import { Section } from './firebase-config/types'; +import { Faq } from './firebase-config/types'; import authenticate from './auth'; const reviewCollection = db.collection('reviews'); @@ -31,13 +31,13 @@ app.use(morgan('combined')); app.get('/api/faqs', async (_, res) => { const snapshot = await db.collection('faqs').get(); - const faqs: Section[] = snapshot.docs.map((doc) => { + const faqs: Faq[] = snapshot.docs.map((doc) => { const data = doc.data(); - const section: Section = { - headerName: data.headerName, - faqs: data.faqs, + const faq: Faq = { + question: data.question, + answer: data.answer, }; - return section; + return faq; }); res.status(200).send(JSON.stringify(faqs)); diff --git a/frontend/src/components/FAQ/index.tsx b/frontend/src/components/FAQ/index.tsx index d99269b6..a4bc783f 100644 --- a/frontend/src/components/FAQ/index.tsx +++ b/frontend/src/components/FAQ/index.tsx @@ -1,18 +1,18 @@ import React, { ReactElement } from 'react'; -import CollapsibleHeader from './CollapsibleHeader'; -import { FAQData } from '../../pages/FAQPage'; +import { FAQ } from '../../pages/FAQPage'; import { Grid } from '@material-ui/core'; +import CollapsibleQuestion from './CollapsibleQuestion'; type Props = { - readonly data: FAQData[]; + readonly data: FAQ[]; }; export default function FAQs({ data }: Props): ReactElement { return ( - {data.map((info, index) => ( - - ))} + + {data && data.map((faq, index) => )} + ); } diff --git a/frontend/src/pages/FAQPage.tsx b/frontend/src/pages/FAQPage.tsx index 57cb7d06..6868f424 100644 --- a/frontend/src/pages/FAQPage.tsx +++ b/frontend/src/pages/FAQPage.tsx @@ -11,21 +11,17 @@ export type FAQ = { answer: string; }; -export type FAQData = { - headerName: string; - faqs: FAQ[]; -}; - const FAQPage = (): ReactElement => { - const [data, setData] = useState([]); + const [data, setData] = useState([]); useTitle('FAQ'); useEffect(() => { - get(`/api/faqs`, { + get(`/api/faqs`, { callback: setData, }); }, []); + return (
From 05c6fffd0ae66cdb51724ffe92abcc61a51d0a4e Mon Sep 17 00:00:00 2001 From: Thuy Pham <62644357+thuypham03@users.noreply.github.com> Date: Thu, 31 Aug 2023 17:27:33 -0700 Subject: [PATCH 2/3] add landing page (#292) --- .gitignore | 2 ++ frontend/src/App.tsx | 6 ++-- frontend/src/pages/LandingPage.tsx | 44 ++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 frontend/src/pages/LandingPage.tsx diff --git a/.gitignore b/.gitignore index 8b9deffc..dcb5be09 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,8 @@ yarn-error.log* # Misc .DS_Store .env +.env.dev +.env.prod .env.local .env.development.local .env.test.local diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 1f3e802b..76745078 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,6 +21,7 @@ import axios from 'axios'; import { colors } from './colors'; import SearchResultsPage from './pages/SearchResultsPage'; import { isAdmin } from './utils/adminTool'; +import LandingPage from './pages/LandingPage'; const theme = createTheme({ palette: { @@ -101,7 +102,8 @@ const App = (): ReactElement => { return ( - + + {/*
@@ -124,7 +126,7 @@ const App = (): ReactElement => {