This commit is contained in:
@@ -4,11 +4,18 @@ import { clx } from "@/helpers/utils";
|
||||
import { t } from "@/locale";
|
||||
import type { TicketThreadItemType } from "./types/TicketTypes";
|
||||
import { formatDate } from "./detailUtils";
|
||||
import { getPresignedUrl } from "@/pages/uploader/service/UploaderService";
|
||||
|
||||
export type MessageBubbleProps = { item: TicketThreadItemType };
|
||||
|
||||
const MessageBubble: FC<MessageBubbleProps> = ({ item }) => {
|
||||
const isUser = item.isFromUser;
|
||||
|
||||
const handleOpenLink = async (key: string) => {
|
||||
const url = await getPresignedUrl(key);
|
||||
window.open(url, "_blank", "noopener,noreferrer");
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={clx(
|
||||
@@ -30,16 +37,15 @@ const MessageBubble: FC<MessageBubbleProps> = ({ item }) => {
|
||||
{item.attachments && item.attachments.length > 0 && (
|
||||
<div className="flex gap-2 flex-wrap text-sm mt-2">
|
||||
{item.attachments.map((att, index) => (
|
||||
<a
|
||||
<button
|
||||
key={att.id}
|
||||
href={att.attachmentUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
type="button"
|
||||
onClick={() => handleOpenLink(att.attachmentUrl)}
|
||||
className="text-[#0047FF] flex gap-1 items-center"
|
||||
>
|
||||
<Paperclip2 size={20} color="#0047FF" />
|
||||
{t("attach")} {index + 1}
|
||||
</a>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user