import {
  MainContainer
} from "./chunk-NKCIBEIN.mjs";
import {
  ProfileItemFragment
} from "./chunk-YTT7MYZX.mjs";

// tmp-babel/messages/web/__shared__/GroupChatMembersList/ProfileCard/index.js
import { AvatarWithPlaceholder } from "@baseapp-frontend/design-system/components/web/avatars";
import { Box, Button, Typography } from "@mui/material";
import { useFragment } from "react-relay";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var ProfileCard = function ProfileCard2(_ref) {
  var profile = _ref.profile, handleAddMember = _ref.handleAddMember, handleRemoveMember = _ref.handleRemoveMember, _ref$isMember = _ref.isMember, isMember = _ref$isMember === void 0 ? false : _ref$isMember;
  var _useFragment = useFragment(ProfileItemFragment, profile), id = _useFragment.id, name = _useFragment.name, image = _useFragment.image, urlPath = _useFragment.urlPath;
  return /* @__PURE__ */ _jsxs(MainContainer, {
    children: [/* @__PURE__ */ _jsx(AvatarWithPlaceholder, {
      width: 48,
      height: 48,
      src: image === null || image === void 0 ? void 0 : image.url,
      sx: {
        alignSelf: "center",
        justifySelf: "center"
      }
    }), /* @__PURE__ */ _jsxs(Box, {
      sx: {
        display: "grid",
        gridTemplateRows: "repeat(2, minmax(0, 1fr))"
      },
      children: [/* @__PURE__ */ _jsx(Typography, {
        variant: "subtitle2",
        children: name
      }), /* @__PURE__ */ _jsx(Typography, {
        variant: "caption",
        color: "text.secondary",
        children: (urlPath === null || urlPath === void 0 ? void 0 : urlPath.path) && "@".concat(urlPath.path)
      })]
    }), /* @__PURE__ */ _jsx(Button, {
      color: "inherit",
      variant: "text",
      size: "small",
      onClick: function onClick() {
        if (isMember) {
          handleRemoveMember(profile);
        } else {
          handleAddMember(profile);
        }
      },
      sx: {
        maxWidth: "fit-content",
        justifySelf: "end"
      },
      children: /* @__PURE__ */ _jsx(Typography, {
        variant: "button",
        color: isMember ? "error.main" : "text.primary",
        children: isMember ? "Remove" : "Add"
      })
    })]
  }, "chat-room-item-".concat(id));
};
var ProfileCard_default = ProfileCard;

export {
  ProfileCard_default
};
//# sourceMappingURL=chunk-YWB26VHQ.mjs.map