diff --git a/frontend/src/components/Admin/AdminCantFindApt.tsx b/frontend/src/components/Admin/AdminCantFindApt.tsx new file mode 100644 index 00000000..12490b55 --- /dev/null +++ b/frontend/src/components/Admin/AdminCantFindApt.tsx @@ -0,0 +1,69 @@ +import React, { ReactElement } from 'react'; +import { Card, CardContent, Grid, Typography } from '@material-ui/core'; +import { makeStyles } from '@material-ui/styles'; +import { createAuthHeaders, getUser } from '../../utils/firebase'; + +const useStyles = makeStyles(() => ({ + root: { + borderRadius: '10px', + }, + cardContent: { + border: '1px solid #e0e0e0', + borderRadius: '10px', + }, + image: { + maxWidth: '30%', + height: 'auto', + }, +})); + +/** + * Component Props for AdminCantFindApt. + */ +type Props = { + /** The date of the report. */ + readonly date: Date; + + /** The apartment name. */ + readonly apartmentName: string; + + /** The apartment address. */ + readonly apartmentAddress: string; + + /** The apartment photos. */ + readonly photos?: readonly string[]; +}; + +const AdminCantFindApt = ({ + date, + apartmentName, + apartmentAddress, + photos = [], +}: Props): ReactElement => { + const classes = useStyles(); + const formattedDate = new Date(date).toLocaleString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + }); + return ( + + + Apartment Name: {apartmentName} + Address: {apartmentAddress} + Filed Date: {formattedDate} + + {photos.map((photo) => ( + + Apartment + + ))} + + + + ); +}; + +export default AdminCantFindApt; diff --git a/frontend/src/components/Admin/AdminContactQuestion.tsx b/frontend/src/components/Admin/AdminContactQuestion.tsx new file mode 100644 index 00000000..1057d6ca --- /dev/null +++ b/frontend/src/components/Admin/AdminContactQuestion.tsx @@ -0,0 +1,57 @@ +import React, { ReactElement, useEffect, useState } from 'react'; +import { Card, CardContent, Typography } from '@material-ui/core'; +import { makeStyles } from '@material-ui/styles'; +import { createAuthHeaders, getUser } from '../../utils/firebase'; + +const useStyles = makeStyles(() => ({ + root: { + borderRadius: '10px', + }, + cardContent: { + border: '1px solid #e0e0e0', + borderRadius: '10px', + }, + image: { + maxWidth: '30%', + height: 'auto', + }, +})); + +/** + * Component Props for AdminCantFindApt. + */ +type Props = { + /** The date of the question. */ + readonly date: Date; + /** The name of the user. */ + readonly name: string; + + /** The email of the user. */ + readonly email: string; + + /** The message of the user. */ + readonly msg: string; +}; + +const AdminContactQuestion = ({ date, name, email, msg }: Props): ReactElement => { + const classes = useStyles(); + const formattedDate = new Date(date).toLocaleString('en-US', { + year: 'numeric', + month: 'long', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + }); + return ( + + + Date: {formattedDate} + Name: {name} + Email: {email} + Msg: {msg} + + + ); +}; + +export default AdminContactQuestion; diff --git a/frontend/src/pages/AdminPage.tsx b/frontend/src/pages/AdminPage.tsx index 6bda7e9c..8a743394 100644 --- a/frontend/src/pages/AdminPage.tsx +++ b/frontend/src/pages/AdminPage.tsx @@ -24,6 +24,8 @@ import clsx from 'clsx'; import { colors } from '../colors'; import PhotoCarousel from '../components/PhotoCarousel/PhotoCarousel'; import usePhotoCarousel from '../components/PhotoCarousel/usePhotoCarousel'; +import AdminCantFindApt from '../components/Admin/AdminCantFindApt'; +import AdminContactQuestion from '../components/Admin/AdminContactQuestion'; const useStyles = makeStyles((theme) => ({ container: { @@ -294,40 +296,40 @@ const AdminPage = (): ReactElement => { // Contact tab const contact = ( - - - Pending "Can't Find Your Apartment" Data ({pendingApartment.length}) - - {[...pendingApartment] - .sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) - .map((apartment, index) => ( - - - Date: {apartment.date} - Apartment name: {apartment.name} - Apartment Address: {apartment.address} - Photos: {apartment.photos} - - - ))} - + + + + Pending "Can't Find Your Apartment" Data ({pendingApartment.length}) + + {[...pendingApartment] + .sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) + .map((apartment, index) => ( + + + + ))} + - - - + + Contact Questions ({pendingContactQuestions.length}) {[...pendingContactQuestions] .sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()) .map((question, index) => ( - - - Date: {question.date} - User name: {question.name} - Cornell Email: {question.email} - Msg: {question.msg} - - + + + ))}