-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented Admin Contact Page Frontend
- Implemented Can't Find Apartment card style display - Implemented Contact Questions card style display
- Loading branch information
1 parent
1cd94f8
commit 3735a6d
Showing
3 changed files
with
156 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'; | ||
Check warning on line 4 in frontend/src/components/Admin/AdminCantFindApt.tsx
|
||
|
||
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 ( | ||
<Card className={classes.root}> | ||
<CardContent className={classes.cardContent}> | ||
<Typography variant="h6">Apartment Name: {apartmentName}</Typography> | ||
<Typography variant="body1">Address: {apartmentAddress}</Typography> | ||
<Typography variant="body1">Filed Date: {formattedDate}</Typography> | ||
<Grid container spacing={2}> | ||
{photos.map((photo) => ( | ||
<Grid item xs={6} key={photo}> | ||
<img src={photo} alt="Apartment" className={classes.image} /> | ||
</Grid> | ||
))} | ||
</Grid> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default AdminCantFindApt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React, { ReactElement, useEffect, useState } from 'react'; | ||
Check warning on line 1 in frontend/src/components/Admin/AdminContactQuestion.tsx
|
||
import { Card, CardContent, Typography } from '@material-ui/core'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
import { createAuthHeaders, getUser } from '../../utils/firebase'; | ||
Check warning on line 4 in frontend/src/components/Admin/AdminContactQuestion.tsx
|
||
|
||
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 ( | ||
<Card className={classes.root}> | ||
<CardContent className={classes.cardContent}> | ||
<Typography variant="body1">Date: {formattedDate}</Typography> | ||
<Typography variant="h6">Name: {name}</Typography> | ||
<Typography variant="body1">Email: {email}</Typography> | ||
<Typography variant="body1">Msg: {msg}</Typography> | ||
</CardContent> | ||
</Card> | ||
); | ||
}; | ||
|
||
export default AdminContactQuestion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters