-
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.
Merge pull request #145 from hotosm/feat/drone-operator-task-page
Feat/drone operator task page - Add feature to upload folder of images
- Loading branch information
Showing
19 changed files
with
569 additions
and
95 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
67 changes: 67 additions & 0 deletions
67
...c/components/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/ImageCard/index.tsx
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,67 @@ | ||
/* eslint-disable jsx-a11y/interactive-supports-focus */ | ||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */ | ||
/* eslint-disable jsx-a11y/click-events-have-key-events */ | ||
import { useState } from 'react'; | ||
|
||
import { | ||
setSelectedImage, | ||
unCheckImages, | ||
} from '@Store/actions/droneOperatorTask'; | ||
import { useTypedDispatch } from '@Store/hooks'; | ||
import Skeleton from '@Components/RadixComponents/Skeleton'; | ||
|
||
interface IImageCardProps { | ||
image: string; | ||
imageName: string; | ||
checked: boolean; | ||
deselectImages?: number; | ||
} | ||
const ImageCard = ({ | ||
image, | ||
imageName, | ||
checked, | ||
deselectImages, | ||
}: IImageCardProps) => { | ||
const dispatch = useTypedDispatch(); | ||
const [loading, setLoading] = useState(true); | ||
|
||
const handleLoad = () => { | ||
setLoading(false); | ||
}; | ||
return ( | ||
<> | ||
{loading && ( | ||
<Skeleton className="naxatw-h-[8.75rem] naxatw-w-[8.75rem]" /> | ||
)} | ||
<div | ||
className={`naxatw-flex naxatw-w-[8.75rem] naxatw-flex-col naxatw-gap-1 ${loading ? 'naxatw-hidden' : 'naxatw-block'}`} | ||
> | ||
<div className="naxatw-w-full naxatw-overflow-hidden naxatw-rounded-[0.25rem]"> | ||
<img | ||
src={image} | ||
onLoad={handleLoad} | ||
alt="" | ||
className="naxatw-h-[8.75rem] naxatw-w-full naxatw-cursor-pointer naxatw-rounded-[0.25rem] naxatw-transition hover:naxatw-scale-150" | ||
onClick={() => dispatch(setSelectedImage(image))} | ||
/> | ||
</div> | ||
<div | ||
role="button" | ||
className="naxatw-flex naxatw-w-full naxatw-cursor-pointer naxatw-items-center naxatw-gap-2 naxatw-overflow-hidden" | ||
onClick={() => dispatch(unCheckImages(deselectImages))} | ||
> | ||
<input | ||
type="checkbox" | ||
checked={checked} | ||
className="naxatw-cursor-pointer" | ||
/> | ||
<p className="naxatw-truncate naxatw-text-nowrap naxatw-text-[0.875rem] naxatw-leading-normal naxatw-text-black"> | ||
{imageName} | ||
</p> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default ImageCard; |
14 changes: 14 additions & 0 deletions
14
...omponents/DroneOperatorTask/DescriptionSection/PopoverBox/ImageBox/PreviewImage/index.tsx
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,14 @@ | ||
import { useTypedSelector } from '@Store/hooks'; | ||
|
||
const PreviewImage = () => { | ||
const { clickedImage } = useTypedSelector(state => state.droneOperatorTask); | ||
return ( | ||
<img | ||
src={clickedImage} | ||
className={`naxatw-aspect-[3/4] naxatw-w-full naxatw-rounded-[0.25rem] naxatw-object-cover ${clickedImage ? 'naxatw-block' : 'naxatw-hidden'}`} | ||
alt="" | ||
/> | ||
); | ||
}; | ||
|
||
export default PreviewImage; |
Oops, something went wrong.