fix: format date in PhotoCarousel
fix: photo card chip gap and cursor fix: sort photos in overview by date
This commit is contained in:
parent
a7ee694169
commit
e1d700cb39
6 changed files with 32 additions and 13 deletions
|
|
@ -13,7 +13,7 @@ import PhotosCarousel from './components/PhotosCarousel'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
const CustomerPhotos = ({ photosData }) => {
|
const CustomerPhotos = ({ photosData, timezone }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const [photosDialog, setPhotosDialog] = useState(false)
|
const [photosDialog, setPhotosDialog] = useState(false)
|
||||||
|
|
@ -41,7 +41,9 @@ const CustomerPhotos = ({ photosData }) => {
|
||||||
<InformativeDialog
|
<InformativeDialog
|
||||||
open={photosDialog}
|
open={photosDialog}
|
||||||
title={`Photo roll`}
|
title={`Photo roll`}
|
||||||
data={<PhotosCarousel photosData={orderedPhotosData} />}
|
data={
|
||||||
|
<PhotosCarousel photosData={orderedPhotosData} timezone={timezone} />
|
||||||
|
}
|
||||||
onDissmised={() => {
|
onDissmised={() => {
|
||||||
setPhotosDialog(false)
|
setPhotosDialog(false)
|
||||||
setPhotoClickIndex(null)
|
setPhotoClickIndex(null)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ const styles = {
|
||||||
photosChipList: {
|
photosChipList: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
flexWrap: 'wrap'
|
flexWrap: 'wrap',
|
||||||
|
gap: 14
|
||||||
},
|
},
|
||||||
image: {
|
image: {
|
||||||
objectFit: 'cover',
|
objectFit: 'cover',
|
||||||
|
|
@ -22,7 +23,7 @@ const styles = {
|
||||||
borderTopRightRadius: 4
|
borderTopRightRadius: 4
|
||||||
},
|
},
|
||||||
photoCardChip: {
|
photoCardChip: {
|
||||||
margin: [[0, 16, 0, 0]]
|
cursor: 'pointer'
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
|
|
||||||
|
|
@ -607,6 +607,7 @@ const CustomerProfile = memo(() => {
|
||||||
photosData={photosData}
|
photosData={photosData}
|
||||||
locale={locale}
|
locale={locale}
|
||||||
setShowCompliance={() => setShowCompliance(!showCompliance)}
|
setShowCompliance={() => setShowCompliance(!showCompliance)}
|
||||||
|
timezone={timezone}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -646,7 +647,7 @@ const CustomerProfile = memo(() => {
|
||||||
)}
|
)}
|
||||||
{isPhotos && (
|
{isPhotos && (
|
||||||
<div>
|
<div>
|
||||||
<CustomerPhotos photosData={photosData} />
|
<CustomerPhotos photosData={photosData} timezone={timezone} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import PhotosCard from './PhotosCard'
|
||||||
|
|
||||||
const useStyles = makeStyles(mainStyles)
|
const useStyles = makeStyles(mainStyles)
|
||||||
|
|
||||||
const CustomerDetails = memo(({ customer, photosData, locale }) => {
|
const CustomerDetails = memo(({ customer, photosData, locale, timezone }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const idNumber = R.path(['idCardData', 'documentNumber'])(customer)
|
const idNumber = R.path(['idCardData', 'documentNumber'])(customer)
|
||||||
|
|
@ -44,7 +44,7 @@ const CustomerDetails = memo(({ customer, photosData, locale }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box display="flex">
|
<Box display="flex">
|
||||||
<PhotosCard photosData={photosData} />
|
<PhotosCard photosData={photosData} timezone={timezone} />
|
||||||
<Box display="flex" flexDirection="column">
|
<Box display="flex" flexDirection="column">
|
||||||
<div className={classes.name}>
|
<div className={classes.name}>
|
||||||
<IdIcon className={classes.idIcon} />
|
<IdIcon className={classes.idIcon} />
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,17 @@ import PhotosCarousel from './PhotosCarousel'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
const PhotosCard = memo(({ photosData }) => {
|
const PhotosCard = memo(({ photosData, timezone }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|
||||||
const [photosDialog, setPhotosDialog] = useState(false)
|
const [photosDialog, setPhotosDialog] = useState(false)
|
||||||
|
|
||||||
const singlePhoto = R.head(photosData)
|
const sortedPhotosData = R.sortWith(
|
||||||
|
[(a, b) => R.has('id', a) - R.has('id', b), R.descend(R.prop('date'))],
|
||||||
|
photosData
|
||||||
|
)
|
||||||
|
|
||||||
|
const singlePhoto = R.head(sortedPhotosData)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -39,7 +44,7 @@ const PhotosCard = memo(({ photosData }) => {
|
||||||
/>
|
/>
|
||||||
<circle className={classes.circle}>
|
<circle className={classes.circle}>
|
||||||
<div>
|
<div>
|
||||||
<Info2>{photosData.length}</Info2>
|
<Info2>{sortedPhotosData.length}</Info2>
|
||||||
</div>
|
</div>
|
||||||
</circle>
|
</circle>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -51,7 +56,9 @@ const PhotosCard = memo(({ photosData }) => {
|
||||||
<InformativeDialog
|
<InformativeDialog
|
||||||
open={photosDialog}
|
open={photosDialog}
|
||||||
title={`Photo roll`}
|
title={`Photo roll`}
|
||||||
data={<PhotosCarousel photosData={photosData} />}
|
data={
|
||||||
|
<PhotosCarousel photosData={sortedPhotosData} timezone={timezone} />
|
||||||
|
}
|
||||||
onDissmised={() => {
|
onDissmised={() => {
|
||||||
setPhotosDialog(false)
|
setPhotosDialog(false)
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import React, { memo, useState } from 'react'
|
||||||
|
|
||||||
import { Carousel } from 'src/components/Carousel'
|
import { Carousel } from 'src/components/Carousel'
|
||||||
import { Label1 } from 'src/components/typography'
|
import { Label1 } from 'src/components/typography'
|
||||||
|
import { formatDate } from 'src/utils/timezones'
|
||||||
|
|
||||||
import CopyToClipboard from '../../Transactions/CopyToClipboard'
|
import CopyToClipboard from '../../Transactions/CopyToClipboard'
|
||||||
|
|
||||||
|
|
@ -11,7 +12,7 @@ import styles from './PhotosCarousel.styles'
|
||||||
|
|
||||||
const useStyles = makeStyles(styles)
|
const useStyles = makeStyles(styles)
|
||||||
|
|
||||||
const PhotosCarousel = memo(({ photosData }) => {
|
const PhotosCarousel = memo(({ photosData, timezone }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const [currentIndex, setCurrentIndex] = useState(0)
|
const [currentIndex, setCurrentIndex] = useState(0)
|
||||||
|
|
||||||
|
|
@ -39,7 +40,14 @@ const PhotosCarousel = memo(({ photosData }) => {
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<Label>Date</Label>
|
<Label>Date</Label>
|
||||||
<div>{photosData && photosData[currentIndex]?.date}</div>
|
<div>
|
||||||
|
{photosData &&
|
||||||
|
formatDate(
|
||||||
|
photosData[currentIndex]?.date,
|
||||||
|
timezone,
|
||||||
|
'yyyy-MM-dd HH:mm'
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue