@katechat/ui 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -57947,18 +57947,16 @@ import { notifications as notifications2 } from "@mantine/notifications";
57947
57947
  import React9, { useEffect as useEffect4, useCallback as useCallback4 } from "react";
57948
57948
  import { Image, Text as Text4, Group as Group5, Stack as Stack2, ActionIcon as ActionIcon3, Modal, Tooltip as Tooltip3 } from "@mantine/core";
57949
57949
  import { useDisclosure } from "@mantine/hooks";
57950
- import { useNavigate } from "react-router-dom";
57951
57950
  import { IconExternalLink } from "@tabler/icons-react";
57952
57951
  var ImagePopup = ({
57953
57952
  fileName,
57954
57953
  fileUrl,
57955
57954
  mimeType,
57956
57955
  createdAt,
57957
- sourceUrl,
57956
+ onOpenSource,
57958
57957
  sourceTitle,
57959
57958
  onClose
57960
57959
  }) => {
57961
- const navigate = useNavigate();
57962
57960
  const [opened, { open: open2, close: close2 }] = useDisclosure(false);
57963
57961
  useEffect4(() => {
57964
57962
  if (fileUrl) {
@@ -57969,11 +57967,10 @@ var ImagePopup = ({
57969
57967
  onClose();
57970
57968
  close2();
57971
57969
  }, [onClose, close2]);
57972
- const navigateToChat = useCallback4(() => {
57973
- ok(sourceUrl);
57974
- navigate(sourceUrl);
57970
+ const navigateToSource = useCallback4(() => {
57971
+ onOpenSource?.();
57975
57972
  handleClose();
57976
- }, [navigate, sourceUrl, handleClose]);
57973
+ }, [onOpenSource, handleClose]);
57977
57974
  const formatDate = (dateString) => {
57978
57975
  return new Date(dateString).toLocaleDateString("en-US", {
57979
57976
  year: "numeric",
@@ -57983,7 +57980,7 @@ var ImagePopup = ({
57983
57980
  minute: "2-digit"
57984
57981
  });
57985
57982
  };
57986
- return /* @__PURE__ */ React9.createElement(Modal, { opened, onClose: handleClose, size: "xl", title: "Image Preview", centered: true }, fileUrl && /* @__PURE__ */ React9.createElement(Stack2, { gap: "md" }, /* @__PURE__ */ React9.createElement(Image, { src: fileUrl, alt: fileName, fit: "contain", mah: "70vh" }), /* @__PURE__ */ React9.createElement(Group5, { justify: "space-between" }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(Text4, { size: "sm", fw: 500 }, fileName), /* @__PURE__ */ React9.createElement(Text4, { size: "xs", c: "dimmed" }, createdAt ? formatDate(createdAt) + " \u2022" : "", " ", mimeType)), sourceUrl && /* @__PURE__ */ React9.createElement(Group5, { gap: "xs" }, /* @__PURE__ */ React9.createElement(Tooltip3, { label: "Open source" }, /* @__PURE__ */ React9.createElement(ActionIcon3, { variant: "light", onClick: navigateToChat }, /* @__PURE__ */ React9.createElement(IconExternalLink, { size: 16 }))))), sourceUrl && /* @__PURE__ */ React9.createElement(Text4, { size: "sm", c: "dimmed" }, "From:", " ", /* @__PURE__ */ React9.createElement(Text4, { span: true, c: "blue", style: { cursor: "pointer" }, onClick: navigateToChat }, sourceTitle || sourceUrl))));
57983
+ return /* @__PURE__ */ React9.createElement(Modal, { opened, onClose: handleClose, size: "xl", title: "Image Preview", centered: true }, fileUrl && /* @__PURE__ */ React9.createElement(Stack2, { gap: "md" }, /* @__PURE__ */ React9.createElement(Image, { src: fileUrl, alt: fileName, fit: "contain", mah: "70vh" }), /* @__PURE__ */ React9.createElement(Group5, { justify: "space-between" }, /* @__PURE__ */ React9.createElement("div", null, /* @__PURE__ */ React9.createElement(Text4, { size: "sm", fw: 500 }, fileName), /* @__PURE__ */ React9.createElement(Text4, { size: "xs", c: "dimmed" }, createdAt ? formatDate(createdAt) + " \u2022" : "", " ", mimeType)), onOpenSource && /* @__PURE__ */ React9.createElement(Group5, { gap: "xs" }, /* @__PURE__ */ React9.createElement(Tooltip3, { label: "Open source" }, /* @__PURE__ */ React9.createElement(ActionIcon3, { variant: "light", onClick: navigateToSource }, /* @__PURE__ */ React9.createElement(IconExternalLink, { size: 16 }))))), onOpenSource && /* @__PURE__ */ React9.createElement(Text4, { size: "sm", c: "dimmed" }, "From:", " ", /* @__PURE__ */ React9.createElement(Text4, { span: true, c: "blue", style: { cursor: "pointer" }, onClick: navigateToSource }, sourceTitle || "source"))));
57987
57984
  };
57988
57985
 
57989
57986
  // src/components/chat/ChatMessagesList.tsx