@homefile/components-v2 2.39.14 → 2.39.16
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.
|
@@ -3,5 +3,5 @@ import { Flex, IconButton } from '@chakra-ui/react';
|
|
|
3
3
|
import { ShareIcon, MoreHorizontal, IconMenu, Edit, DuplicateIcon, } from '../../components';
|
|
4
4
|
export const ContactHeaderMenu = ({ contact, menuItems, onShare, onEdit, onDuplicate, }) => {
|
|
5
5
|
const hasMenuItems = Boolean(menuItems && menuItems.length > 0);
|
|
6
|
-
return (_jsxs(Flex, { align: "center", position: "relative", gap: "base", children: [_jsx(IconButton, { "aria-label": "share", variant: "menuIcon", icon: _jsx(ShareIcon, { size: 18 }), onClick: onShare, w: "fit-content" }), _jsx(IconButton, { "aria-label": "duplicate", variant: "menuIcon", icon: _jsx(DuplicateIcon, { size: 19 }), onClick: onDuplicate, w: "fit-content" }), _jsx(IconButton, { "aria-label": "edit", variant: "menuIcon", icon: _jsx(Edit, { size: 18, strokeWidth: 1.5 }), onClick: onEdit, w: "fit-content" }), hasMenuItems && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: Number(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) < 1 }))] }));
|
|
6
|
+
return (_jsxs(Flex, { align: "center", position: "relative", gap: "base", children: [onShare && (_jsx(IconButton, { "aria-label": "share", variant: "menuIcon", icon: _jsx(ShareIcon, { size: 18 }), onClick: onShare, w: "fit-content" })), onDuplicate && (_jsx(IconButton, { "aria-label": "duplicate", variant: "menuIcon", icon: _jsx(DuplicateIcon, { size: 19 }), onClick: onDuplicate, w: "fit-content" })), onEdit && (_jsx(IconButton, { "aria-label": "edit", variant: "menuIcon", icon: _jsx(Edit, { size: 18, strokeWidth: 1.5 }), onClick: onEdit, w: "fit-content" })), hasMenuItems && (_jsx(IconMenu, { icon: _jsx(MoreHorizontal, { size: 32 }), itemForm: contact, menuItems: menuItems, disabled: Number(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) < 1 }))] }));
|
|
7
7
|
};
|
|
@@ -4,7 +4,7 @@ import { Box, Center, Flex, Stack, Text, Image } from '@chakra-ui/react';
|
|
|
4
4
|
import { CompanyRating } from './CompanyRating';
|
|
5
5
|
import { AddressInfo } from './AddressInfo';
|
|
6
6
|
export const CompanyInfoCard = ({ contact, }) => {
|
|
7
|
-
if (!(contact === null || contact === void 0 ? void 0 : contact.companyInfo))
|
|
7
|
+
if (!(contact === null || contact === void 0 ? void 0 : contact.companyInfo) || Object.keys(contact.companyInfo).length === 0)
|
|
8
8
|
return null;
|
|
9
9
|
const { company, phone, url, address, city, state, zip, logoUrl } = contact.companyInfo;
|
|
10
10
|
return (_jsxs(Box, { position: "relative", children: [_jsx(CompanyRating, { contact: contact, position: "absolute", top: "0", right: "0", zIndex: "1" }), _jsxs(Stack, { spacing: "base", children: [_jsx(Text, { textTransform: "uppercase", fontSize: "xs", children: t('contacts.companyInfo') }), _jsxs(Flex, { gap: "base", minH: "50px", children: [logoUrl && (_jsx(Center, { boxSize: "78px", overflow: "hidden", border: "1px", borderColor: "lightBlue.6", children: _jsx(Image, { src: logoUrl, alt: "company logo", objectFit: "cover", boxSize: "100%" }) })), _jsxs(Stack, { spacing: "6", children: [_jsxs(Box, { children: [_jsx(Text, { fontWeight: "bold", fontSize: "18px", lineHeight: "27px", children: company }), _jsxs(Box, { children: [_jsx(Text, { fontSize: "sm", fontFamily: "secondary", lineHeight: "18px", children: phone }), _jsx(Text, { variant: "email", lineHeight: "18px", fontSize: "sm", children: url })] })] }), _jsx(AddressInfo, { address: address, city: city, state: state, zip: zip })] })] })] })] }));
|
|
@@ -5,7 +5,10 @@ import { Contacts } from '../../../assets/images';
|
|
|
5
5
|
import { CompanyInfoCard, ContactAddressCard, ContactNotes, PanelHeader, RoleTag, PersonalInfoCard, ViewContactHeader, } from '../../../components';
|
|
6
6
|
export const ViewContactPanel = ({ contact, menuItems, handleClose, onShare, onEdit, onDuplicate, roleType, }) => {
|
|
7
7
|
const isHomeowner = roleType === 'homeowner';
|
|
8
|
+
const hasContactInfo = (contact === null || contact === void 0 ? void 0 : contact.companyInfo) &&
|
|
9
|
+
Object.values(contact.companyInfo).some((value) => (typeof value === 'string' && value.trim() !== '') ||
|
|
10
|
+
(typeof value === 'number' && value > 0));
|
|
8
11
|
if (!contact)
|
|
9
12
|
return (_jsx(DrawerContent, { bg: "lightBlue.1", children: _jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Contacts, title: t('contacts.contactView') }) }) }));
|
|
10
|
-
return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Contacts, title: t('contacts.contactView') }) }), _jsxs(DrawerBody, { p: "0", overflowX: "hidden", position: "relative", children: [_jsx(RoleTag, { roleType: roleType }), _jsx(Stack, { px: "base", spacing: "base", children: _jsx(Container, { mt: "36px", p: "base", borderRadius: "lg", children: _jsxs(Stack, { spacing: "4", children: [_jsx(ViewContactHeader, { contact: contact, menuItems: menuItems, onShare: onShare, onEdit: onEdit, onDuplicate: onDuplicate }), _jsx(PersonalInfoCard, Object.assign({}, contact, { index: 0 })), isHomeowner && contact && (_jsxs(_Fragment, { children: [_jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(ContactAddressCard, { contact: contact })] })), !isHomeowner &&
|
|
13
|
+
return (_jsxs(DrawerContent, { bg: "lightBlue.1", children: [_jsx(DrawerHeader, { p: "0", children: _jsx(PanelHeader, { handleCloseButton: handleClose, icon: Contacts, title: t('contacts.contactView') }) }), _jsxs(DrawerBody, { p: "0", overflowX: "hidden", position: "relative", children: [_jsx(RoleTag, { roleType: roleType }), _jsx(Stack, { px: "base", spacing: "base", children: _jsx(Container, { mt: "36px", p: "base", borderRadius: "lg", children: _jsxs(Stack, { spacing: "4", children: [_jsx(ViewContactHeader, { contact: contact, menuItems: menuItems, onShare: onShare, onEdit: onEdit, onDuplicate: onDuplicate }), _jsx(PersonalInfoCard, Object.assign({}, contact, { index: 0 })), isHomeowner && contact && (_jsxs(_Fragment, { children: [_jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(ContactAddressCard, { contact: contact })] })), !isHomeowner && hasContactInfo && (_jsxs(_Fragment, { children: [_jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(CompanyInfoCard, { contact: contact }), _jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(ContactNotes, { notes: contact.notes })] }))] }) }) })] })] }));
|
|
11
14
|
};
|