-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contacts page frontend integration with backend (#167)
* Contacts page frontend integration with backend Co-authored-by: Mahid Ahmad <[email protected]> * Refactor contacts API and improve ContactsTable component for better data handling and presentation
- Loading branch information
1 parent
d0fdae3
commit 69cd27b
Showing
3 changed files
with
150 additions
and
74 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
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
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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
import { TableCell, TableRow, Typography } from '@mui/material'; | ||
|
||
import { Contact } from '@/utils/shared/models'; | ||
import { formatDateTime } from '@/utils/shared/utils'; | ||
import { TableCell, TableRow, Typography } from '@mui/material'; | ||
|
||
interface Props { | ||
contact: Contact; | ||
} | ||
|
||
const ContactsTableRow = ({ contact }: Props) => ( | ||
<TableRow> | ||
<TableCell> | ||
{contact.name} | ||
<br /> | ||
<Typography variant='caption'>{contact.email}</Typography> | ||
</TableCell> | ||
<TableCell>{contact.lastViewedLink}</TableCell> | ||
<TableCell>{formatDateTime(contact.lastActivity, { includeTime: true })}</TableCell> | ||
<TableCell>{contact.visits}</TableCell> | ||
</TableRow> | ||
); | ||
|
||
export default ContactsTableRow; | ||
export default function ContactsTableRow({ contact }: Props) { | ||
return ( | ||
<TableRow> | ||
<TableCell> | ||
{contact.name ? contact.name : 'N/A'} | ||
<br /> | ||
<Typography variant='caption'>{contact.email ? contact.email : 'N/A'}</Typography> | ||
</TableCell> | ||
<TableCell>{contact.lastViewedLink}</TableCell> | ||
<TableCell>{formatDateTime(contact.lastActivity, { includeTime: true })}</TableCell> | ||
<TableCell>{contact.totalVisits}</TableCell> | ||
</TableRow> | ||
); | ||
} |