-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#174 - Download file working (added extension to the downloaded file)…
…. removed duplicate code for media search into service. use middleware specific environment variables for middleware.js.
- Loading branch information
1 parent
d02b62f
commit d1e3c7b
Showing
12 changed files
with
367 additions
and
1,426 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,56 @@ | ||
import{DownloadOutlined} from '@ant-design/icons'; | ||
import {DownloadOutlined} from '@ant-design/icons'; | ||
import {getDownloadFileName} from "@/model/ImageType"; | ||
|
||
interface prop { | ||
name: string, | ||
id: string, | ||
onSelectImage: (value: string, checked: boolean) => void, | ||
checkedImage: string[], | ||
onSelectImageCarousel: (value: string, checked: boolean) => void, | ||
flag: string, | ||
imageDetail: any | ||
image_url: string | ||
name: string, | ||
id: string, | ||
onSelectImage: (value: string, checked: boolean) => void, | ||
checkedImage: string[], | ||
onSelectImageCarousel: (value: string, checked: boolean) => void, | ||
flag: string, | ||
imageDetail: any | ||
image_url: string, | ||
unSignedUrl: string, | ||
imageNameWithoutNewLines: string | ||
} | ||
|
||
export default function CheckButton({ name, id, onSelectImage, checkedImage, onSelectImageCarousel, flag,image_url }: prop) { | ||
const handleChecked = (e: any) => { | ||
const { value, checked } = e.target; | ||
if (flag == 'list') { | ||
onSelectImage(value, checked) | ||
} else { | ||
const { value, checked } = e.target; | ||
onSelectImageCarousel(value, checked) | ||
export default function CheckButton({name, id, onSelectImage, checkedImage, onSelectImageCarousel, flag, image_url, unSignedUrl, imageNameWithoutNewLines}: prop) { | ||
const handleChecked = (e: any) => { | ||
const {value, checked} = e.target; | ||
if (flag == 'list') { | ||
onSelectImage(value, checked) | ||
} else { | ||
const {value, checked} = e.target; | ||
onSelectImageCarousel(value, checked) | ||
} | ||
} | ||
} | ||
|
||
const isChecked = checkedImage.includes(id.toString()); | ||
|
||
return ( | ||
<fieldset className="mt-5"> | ||
<div className="flex justify-between"> | ||
<div className=""> | ||
<input | ||
id={id.toString()} | ||
value={id} | ||
aria-describedby="comments-description" | ||
type="checkbox" | ||
checked={isChecked} | ||
className="focus:ring-teal-500 h-4 w-4 text-teal-600 border-gray-300 rounded" | ||
onChange={(e) => handleChecked(e)} | ||
/> | ||
</div> | ||
<div className="mr-8"> | ||
<a href={image_url} target ="_blank" > | ||
<DownloadOutlined /> | ||
</a> | ||
</div> | ||
</div> | ||
<div className="mt-1 text-sm"> | ||
<label className="font-medium text-gray-700">{name}</label> | ||
</div> | ||
</fieldset> | ||
); | ||
const isChecked = checkedImage.includes(id.toString()); | ||
const downloadUrl = `/web/media/downloadStream?s3Url=${unSignedUrl}&fileName=${getDownloadFileName(name, unSignedUrl)}`; | ||
|
||
return ( | ||
<fieldset className="mt-5"> | ||
<div className="flex justify-between"> | ||
<div className=""> | ||
<input | ||
id={id.toString()} | ||
value={id} | ||
aria-describedby="comments-description" | ||
type="checkbox" | ||
checked={isChecked} | ||
className="focus:ring-teal-500 h-4 w-4 text-teal-600 border-gray-300 rounded" | ||
onChange={(e) => handleChecked(e)} | ||
/> | ||
</div> | ||
<div className="mr-8"> | ||
<a href={downloadUrl} download> | ||
<DownloadOutlined/> | ||
</a> | ||
</div> | ||
</div> | ||
<div className="mt-1 text-sm"> | ||
<label className="font-medium text-gray-700"><a href={image_url} target="_blank">{name}</a></label> | ||
</div> | ||
</fieldset> | ||
); | ||
} |
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
Oops, something went wrong.