This commit is contained in:
@@ -3,6 +3,7 @@ import { Link } from 'react-router-dom'
|
||||
import { Call, Edit2, Location, Paperclip2, Profile2User, Receipt21, User } from 'iconsax-react'
|
||||
import { clx } from '@/helpers/utils'
|
||||
import { getFileNameAndExtensionFromUrl } from '@/config/func'
|
||||
import { getPresignedUrl } from '@/pages/uploader/service/UploaderService'
|
||||
import { Paths } from '@/config/Paths'
|
||||
import {
|
||||
getAttachmentUrl,
|
||||
@@ -201,19 +202,21 @@ const OrderDetailSidebar: FC<Props> = ({
|
||||
<section className="bg-white rounded-3xl p-5 shadow-sm">
|
||||
<h3 className="text-sm font-medium text-gray-900 mb-4">پیوستها</h3>
|
||||
<div className="flex flex-col gap-2">
|
||||
{attachments.map((url, idx) => {
|
||||
const { fileName } = getFileNameAndExtensionFromUrl(url)
|
||||
{attachments.map((key, idx) => {
|
||||
const { fileName } = getFileNameAndExtensionFromUrl(key)
|
||||
return (
|
||||
<a
|
||||
key={url}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-2 rounded-xl border border-gray-100 bg-gray-50/80 px-3 py-2.5 text-sm text-[#0037FF] hover:bg-blue-50 transition-colors"
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
onClick={async () => {
|
||||
const resolvedUrl = await getPresignedUrl(key)
|
||||
window.open(resolvedUrl, '_blank', 'noopener,noreferrer')
|
||||
}}
|
||||
className="flex items-center gap-2 rounded-xl border border-gray-100 bg-gray-50/80 px-3 py-2.5 text-sm text-[#0037FF] hover:bg-blue-50 transition-colors text-right w-full"
|
||||
>
|
||||
<Paperclip2 size={18} className="shrink-0" />
|
||||
<span className="truncate">{fileName || `پیوست ${idx + 1}`}</span>
|
||||
</a>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user