@homefile/components-v2 2.39.11 → 2.39.13

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.
@@ -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.companyInfo)
7
+ if (!(contact === null || contact === void 0 ? void 0 : contact.companyInfo))
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 })] })] })] })] }));
@@ -17,7 +17,7 @@ import { colors } from '../../../theme/colors';
17
17
  export const CompanyRating = (_a) => {
18
18
  var _b;
19
19
  var { contact } = _a, props = __rest(_a, ["contact"]);
20
- if (!((_b = contact.companyInfo) === null || _b === void 0 ? void 0 : _b.rating))
20
+ if (!((_b = contact === null || contact === void 0 ? void 0 : contact.companyInfo) === null || _b === void 0 ? void 0 : _b.rating))
21
21
  return null;
22
22
  const { rating, _id } = contact.companyInfo;
23
23
  return (_jsxs(Stack, Object.assign({ spacing: "0", align: "end" }, props, { children: [_jsx(Text, { textTransform: "uppercase", fontSize: "10px", children: t('contacts.rating') }), _jsx(Flex, { align: "center", gap: "1", children: Array.from({ length: 5 }).map((_, index) => {
@@ -5,5 +5,7 @@ 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
- 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 && (_jsxs(_Fragment, { children: [_jsx(Divider, { borderStyle: "dashed", borderColor: "lightBlue.6" }), _jsx(ContactAddressCard, { contact: contact })] })), !isHomeowner && (_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 })] }))] }) }) })] })] }));
8
+ if (!contact)
9
+ 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 && (contact === null || contact === void 0 ? void 0 : contact.companyInfo) && (_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 })] }))] }) }) })] })] }));
9
11
  };
@@ -22,7 +22,7 @@ export const GroupCard = (_a) => {
22
22
  var { items, menuItems, onAddItem, onAddImage, onClickDelete, onClickDetails, title, totalAmount, disabled, itemsDisabled } = _a, props = __rest(_a, ["items", "menuItems", "onAddItem", "onAddImage", "onClickDelete", "onClickDetails", "title", "totalAmount", "disabled", "itemsDisabled"]);
23
23
  const { filteredResults, handleAddItem, handleChange, isItemsEmpty, searchValue, totalAmountFormatted, } = useGroupCard({ items, onAddItem, title, totalAmount });
24
24
  const groupTitle = title;
25
- return (_jsx(TileTooltip, { label: title, children: _jsxs(Box, { backgroundColor: "lightBlue.1", boxShadow: "base", w: "100%", children: [_jsx(GroupCardHeader, { menuItems: menuItems, title: title, totalAmount: totalAmountFormatted }), _jsxs(Flex, { justify: items.length >= 10 ? 'space-between' : 'flex-end', pl: "base", my: "base", align: "center", gap: "base", children: [items.length >= 10 && (_jsx(SearchInput, { value: searchValue, onChange: handleChange })), _jsx(LeftButtonAnimated, { onClick: handleAddItem, label: t('addHomeItem.btnLabel'), disabled: disabled, id: "addingItems" })] }), _jsxs(Box, { pb: "10", px: "base", children: [isItemsEmpty && _jsx(AddItemCard, { disabled: itemsDisabled, onClick: handleAddItem }), !isItemsEmpty && (_jsx(Wrap, { spacing: "base", children: filteredResults.map(({ _id, title, report, images, receipt, metadata, type, subType, room, }) => {
25
+ return (_jsx(TileTooltip, { label: title, children: _jsxs(Box, { backgroundColor: "lightBlue.1", boxShadow: "base", w: "100%", children: [_jsx(GroupCardHeader, { menuItems: menuItems, title: title, totalAmount: totalAmountFormatted }), _jsxs(Flex, { justify: items.length >= 10 ? 'space-between' : 'flex-end', pl: "base", my: "base", align: "center", gap: "base", children: [items.length >= 10 && (_jsx(SearchInput, { value: searchValue, onChange: handleChange })), _jsx(LeftButtonAnimated, { onClick: handleAddItem, label: t('addHomeItem.btnLabel'), disabled: disabled, id: "addingItems" })] }), _jsxs(Box, { pb: "10", px: "base", children: [isItemsEmpty && _jsx(AddItemCard, { disabled: itemsDisabled, onClick: handleAddItem }), !isItemsEmpty && (_jsx(Wrap, { spacing: "base", children: filteredResults.map(({ _id, title, report, images, receipt, metadata, type, subType, room, defaultImage }) => {
26
26
  var _a, _b, _c, _d;
27
27
  const reportData = {
28
28
  _id,
@@ -35,8 +35,8 @@ export const GroupCard = (_a) => {
35
35
  const brand = receipt
36
36
  ? ''
37
37
  : ((_a = report === null || report === void 0 ? void 0 : report.find((doc) => { var _a; return (_a = doc === null || doc === void 0 ? void 0 : doc.name) === null || _a === void 0 ? void 0 : _a.includes('Brand'); })) === null || _a === void 0 ? void 0 : _a.value) || '';
38
- const hasImage = images.length > 0;
39
- const imageUrl = `${storageUrl}/${(_b = images[0]) === null || _b === void 0 ? void 0 : _b.bucketName}/${(_c = images[0]) === null || _c === void 0 ? void 0 : _c.fileName}.${(_d = images[0]) === null || _d === void 0 ? void 0 : _d.extension}`;
38
+ const hasImage = images.length > 0 || defaultImage;
39
+ const imageUrl = `${storageUrl}/${(_b = images[0]) === null || _b === void 0 ? void 0 : _b.bucketName}/${(_c = images[0]) === null || _c === void 0 ? void 0 : _c.fileName}.${(_d = images[0]) === null || _d === void 0 ? void 0 : _d.extension}` || defaultImage;
40
40
  const storeImage = (metadata === null || metadata === void 0 ? void 0 : metadata.origin)
41
41
  ? getReceiptOrigin(metadata === null || metadata === void 0 ? void 0 : metadata.origin)
42
42
  : '';
@@ -95,14 +95,15 @@ export const PaintItems = [
95
95
  },
96
96
  needsReview: false,
97
97
  reviewed: false,
98
+ defaultImage: "https://storage.googleapis.com/homefile-images/range.png",
98
99
  images: [
99
- {
100
- bucketName: 'homefile-images',
101
- description: '',
102
- extension: 'jpeg',
103
- fileName: 'test-consult.jpeg-db224d',
104
- _id: '62aa4c6db225dd3957d09b24',
105
- },
100
+ // {
101
+ // bucketName: 'homefile-images',
102
+ // description: '',
103
+ // extension: 'jpeg',
104
+ // fileName: 'test-consult.jpeg-db224d',
105
+ // _id: '62aa4c6db225dd3957d09b24',
106
+ // },
106
107
  ],
107
108
  status: 'completed',
108
109
  deleted: false,
@@ -1,11 +1,11 @@
1
1
  import { RoleType } from '../../helpers';
2
2
  import { InfoContactCardI, MenuItemI } from '../../interfaces';
3
3
  export interface ViewContactPanelI {
4
- contact: InfoContactCardI;
4
+ contact: InfoContactCardI | null;
5
5
  handleClose: () => void;
6
- menuItems: MenuItemI[];
7
- onShare: () => void;
6
+ menuItems?: MenuItemI[];
7
+ onShare?: () => void;
8
8
  onEdit?: () => void;
9
9
  onDuplicate?: () => void;
10
- roleType: RoleType;
10
+ roleType?: RoleType;
11
11
  }
@@ -69,6 +69,7 @@ export interface ReportsI {
69
69
  updatedAt: string;
70
70
  user: string;
71
71
  receipt?: string;
72
+ defaultImage?: string;
72
73
  }
73
74
  export interface MapFileI {
74
75
  files: FolderFileI[] | File[] | FileI[] | ReportsI[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.39.11",
3
+ "version": "2.39.13",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",