@restaround/react 1.0.1 → 1.0.6
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/components/PublicMenu/Header/Header.d.ts +3 -7
- package/dist/components/PublicMenu/Products/Products.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/models/menu.d.ts +7 -0
- package/dist/utils/test.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import * as branchModels from "src/models/branch";
|
|
2
|
-
|
|
2
|
+
import * as menuModels from "src/models/menu";
|
|
3
|
+
interface Props extends Pick<menuModels.PublicMenuData, "coverImage" | "logoImage" | "name" | "instagram" | "facebook" | "whatsapp" | "telegram" | "tiktok"> {
|
|
3
4
|
branch?: branchModels.Branch;
|
|
4
|
-
coverImage?: string;
|
|
5
|
-
logoImage?: string;
|
|
6
|
-
defaultCover?: string;
|
|
7
|
-
defaultLogo?: string;
|
|
8
|
-
name: string;
|
|
9
5
|
}
|
|
10
|
-
declare const Header: ({ branch, coverImage, logoImage, name,
|
|
6
|
+
declare const Header: ({ branch, coverImage, logoImage, name, instagram, facebook, whatsapp, telegram, tiktok, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
7
|
export default Header;
|
|
@@ -10,5 +10,5 @@ interface Props {
|
|
|
10
10
|
language: string;
|
|
11
11
|
onCategoryInView: (categoryId: number) => void;
|
|
12
12
|
}
|
|
13
|
-
declare const Products: ({ products, categories, currency, language, productBlocksRef, onCategoryInView
|
|
13
|
+
declare const Products: import("react").MemoExoticComponent<({ products, categories, currency, language, productBlocksRef, onCategoryInView }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
14
14
|
export default Products;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r,Fragment as a}from"react/jsx-runtime";import{useRef as t,
|
|
1
|
+
import{jsxs as e,jsx as r,Fragment as a}from"react/jsx-runtime";import{useRef as t,memo as n,useCallback as i,useEffect as c,useState as o}from"react";import{Row as l,IconLink as s,SVGIcon as d,Column as m,Carousel as u,CarouselItem as h,Chip as g,UIElementType as _,Container as v,Card as p,Flex as f}from"@sorocraft/ui";import{Phone as I,Whatsapp as N,Instagram as b,Telegram as y,Tiktok as k,Facebook as P,Wifi as L,MarkerPin as w}from"@sorocraft/ui/icons";import{isEmpty as C,priceFormatter as A,groupBy as H}from"@sorocraft/js-utils";var z="PublicMenu-module_container__QLN6U",j="PublicMenu-module_categories__Iy6NC",B="Header-module_container__tenlF",E="Header-module_cover__BAWZK",O="Header-module_content__Gx4Al",x="Header-module_logo__4MTCm",F="Header-module_info__IchYA",M="Header-module_name__30wyw",R="Header-module_address__WOxXc",V="Header-module_social__AoP0z",W="Header-module_links__EeQxg";const D=({branch:a,coverImage:t,logoImage:n,name:i,instagram:c,facebook:o,whatsapp:u,telegram:h,tiktok:g})=>{const{address:_,latitude:v,longitude:p,phone:f}=a||{},A=C(a),H=`https://www.google.com/maps/place/${v},${p}`;return e("div",{className:B,children:[r("img",{src:t,alt:i,className:E}),r("div",{className:O,children:r(A?()=>e(m,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[r("img",{src:n,alt:i,className:x}),r("div",{className:F,children:r("h1",{className:M,children:i})})]}):()=>e(l,{gap:1,children:[r("img",{src:n,alt:i,className:x}),e("div",{className:F,children:[r("h1",{className:M,children:i}),r("a",{className:R,href:H,target:"_blank",rel:"noopener noreferrer",children:e(l,{alignItems:"center",gap:.5,children:[r(d,{icon:w,theme:"dark"}),r("span",{children:_})]})})]})]}),{})}),!A&&r("div",{className:V,children:r("div",{className:W,children:e(l,{gap:2,children:[e(l,{alignItems:"center",justifyContent:"center",gap:.5,children:[f&&r(s,{icon:I,href:`tel:+${f}`,size:"sm",shape:"circle",theme:"light"}),u&&r(s,{icon:N,href:`https://wa.me/${u}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),c&&r(s,{icon:b,href:c,size:"sm",shape:"circle",theme:"light",target:"_blank"}),h&&r(s,{icon:y,href:h,size:"sm",shape:"circle",theme:"light",target:"_blank"}),g&&r(s,{icon:k,href:g,size:"sm",shape:"circle",theme:"light",target:"_blank"}),o&&r(s,{icon:P,href:o,size:"sm",shape:"circle",theme:"light",target:"_blank"})]}),r(l,{children:r(d,{icon:L,size:"sm"})})]})})})]})},T=({categories:e,language:a,selectedCategoryId:n,onSelectCategory:i})=>{const c=t({}),o=e=>{(e=>{var r;const a=null===(r=null==c?void 0:c.current)||void 0===r?void 0:r[e];a&&a.scrollIntoView({behavior:"smooth",inline:"center"})})(e),i(e)};return r("div",{className:j,children:r(u,{gap:1,children:e.map((({id:e,translations:t})=>{const{name:i}=t.find((e=>e.language===a))||{};return r(h,{children:r(g,{onClick:()=>o(e),type:_.BORDERED_PRIMARY,active:e===n,children:r("div",{ref:r=>c.current[e]=r,children:i})})},e)}))})})};var Y={container:"Products-module_container__bF2LF",header:"Products-module_header__0EFvL",products:"Products-module_products__AoDrY",list:"Products-module_list__LH4v5"};var $={container:"ProductsListItem-module_container__i9tFs",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",image:"ProductsListItem-module_image__h6Wbi",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV"};const S=({product:a,currency:t,language:n})=>{const{translations:i,price:c,imageUrl:o}=a||{},{name:s,description:d}=i.find((e=>e.language===n))||{},u=A(c,t||"AZN",n);return r("div",{className:$.container,children:e(l,{justifyContent:"space-between",children:[r("div",{className:$.data,children:e(m,{gap:.5,children:[r("h3",{className:$.name,children:s}),r("div",{className:$.description,children:d}),r("div",{className:$.price,children:u})]})}),o&&r("img",{src:o,alt:s,className:$.image})]})})},Z=n((({products:a,categories:t,currency:n,language:o,productBlocksRef:l,onCategoryInView:s})=>{const d=H(a,"categoryId"),u=i((e=>{let r=null,a=0;e.forEach((e=>{const t=Number(e.target.getAttribute("data-category-id")),n=e.intersectionRatio;n>a&&(a=n,r=t)})),r&&s(r)}),[s]);return c((()=>{const e=new IntersectionObserver(u,{root:null,threshold:[.1,.5,.75]});return Object.values((null==l?void 0:l.current)||{}).forEach((r=>{r&&e.observe(r)})),()=>{e.disconnect()}}),[l,u]),r("div",{className:Y.container,children:r(m,{children:Object.keys(d).map((a=>{const i=t.find((({id:e})=>e===Number(a)))||{},{name:c}=((e,r)=>{var a,t;return(null===(t=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===t?void 0:t.call(a,(e=>e.language===r)))||{}})(i,o);return e("div",{className:Y.products,ref:e=>l.current[i.id]=e,"data-category-id":a,children:[r("h2",{className:Y.category,children:c}),r("div",{className:Y.list,children:r(m,{gap:2,children:d[a].map((e=>r(S,{product:e,currency:n,language:o},e.id)))})})]},a)}))})})}),((e,r)=>e.products===r.products&&e.categories===r.categories&&e.currency===r.currency&&e.language===r.language));var J="Branches-module_branches__sOuoV",K="Branches-module_list__vYoT2",Q="Branches-module_name__K0Z-4";const U=({branches:e=[]})=>r("div",{className:J,children:r(v,{className:K,children:e.map((({id:e,name:a})=>r("a",{href:"/",children:r(p,{noBottomMargin:!0,children:r(f,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:r("h2",{className:Q,children:a})})})},e)))})}),q=({data:n})=>{var i;const{name:c,coverImage:l,logoImage:s,branches:d=[],branchId:m,language:u,categories:h,products:g,currency:_,defaultCover:v="",defaultLogo:p="",instagram:f,facebook:I,whatsapp:N,telegram:b,tiktok:y}=n||{},k=d.length<=1,P=d.find((e=>e.id===Number(m))),L=k||!(null==P?void 0:P.name)?c:(null==P?void 0:P.name)||"",w=l||v,C=s||p,[A,H]=o(null===(i=null==h?void 0:h[0])||void 0===i?void 0:i.id),j=t({});return e("div",{className:z,children:[r(D,{branch:P,name:L,coverImage:w,logoImage:C,instagram:f,facebook:I,whatsapp:N,telegram:b,tiktok:y}),k||m?e(a,{children:[r(T,{categories:h,language:u,selectedCategoryId:A,onSelectCategory:e=>{H(e),(e=>{var r;const a=null===(r=null==j?void 0:j.current)||void 0===r?void 0:r[e];a&&a.scrollIntoView({behavior:"smooth",block:"start"})})(e)}}),r(Z,{categories:h,products:g,currency:_,language:u,productBlocksRef:j,onCategoryInView:e=>{e!==A&&H(e)}})]}):r(U,{branches:d})]})};export{q as PublicMenu};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/PublicMenu/Header/Header.tsx","../src/components/PublicMenu/Categories.tsx","../src/components/PublicMenu/PublicMenu.constants.ts","../src/components/PublicMenu/ProductsListItem/ProductsListItem.tsx","../src/components/PublicMenu/Products/Products.tsx","../src/utils/category.ts","../src/components/PublicMenu/Branches/Branches.tsx","../src/components/PublicMenu/PublicMenu.tsx"],"sourcesContent":["import { Column, IconLink, Row, SVGIcon } from \"@sorocraft/ui\";\nimport {\n\tMarkerPin,\n\tPhone,\n\tWifi,\n\tInstagram,\n\tWhatsapp,\n\tTiktok,\n\tFacebook,\n\tTelegram,\n} from \"@sorocraft/ui/icons\";\nimport { isEmpty } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Header.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranch?: branchModels.Branch;\n\tcoverImage?: string;\n\tlogoImage?: string;\n\tdefaultCover?: string;\n\tdefaultLogo?: string;\n\tname: string;\n}\n\nconst Header = ({\n\tbranch,\n\tcoverImage,\n\tlogoImage,\n\tname,\n\tdefaultCover = \"\",\n\tdefaultLogo = \"\",\n}: Props) => {\n\tconst { address, latitude, longitude } = branch || {};\n\tconst noBranch = isEmpty(branch);\n\n\tconst coverImageSource = coverImage || defaultCover;\n\tconst logoImageSource = logoImage || defaultLogo;\n\n\tconst googleMapLink = `https://www.google.com/maps/place/${latitude},${longitude}`;\n\n\tconst BranchInfo = () => (\n\t\t<Row gap={1}>\n\t\t\t<img src={logoImageSource} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\n\t\t\t\t<a\n\t\t\t\t\tclassName={styles.address}\n\t\t\t\t\thref={googleMapLink}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t<Row alignItems=\"center\" gap={0.5}>\n\t\t\t\t\t\t<SVGIcon icon={MarkerPin} theme=\"dark\" />\n\t\t\t\t\t\t<span>{address}</span>\n\t\t\t\t\t</Row>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Row>\n\t);\n\n\tconst BusinessInfo = () => (\n\t\t<Column fullWidth fullHeight alignItems=\"center\" justifyContent=\"center\">\n\t\t\t<img src={logoImageSource} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\t\t\t</div>\n\t\t</Column>\n\t);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<img src={coverImageSource} alt={name} className={styles.cover} />\n\t\t\t<div className={styles.content}>\n\t\t\t\t{noBranch ? <BusinessInfo /> : <BranchInfo />}\n\t\t\t\t{!noBranch && (\n\t\t\t\t\t<div className={styles.labels}>\n\t\t\t\t\t\t<Column alignItems=\"center\" justifyContent=\"center\" gap={0.75} fullHeight>\n\t\t\t\t\t\t\t<IconLink icon={Wifi} href=\"/\" size=\"sm\" shape=\"circle\" />\n\t\t\t\t\t\t</Column>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{!noBranch && (\n\t\t\t\t<div className={styles.social}>\n\t\t\t\t\t<div className={styles.links}>\n\t\t\t\t\t\t<Row alignItems=\"center\" justifyContent=\"center\" gap={0.5}>\n\t\t\t\t\t\t\t<IconLink icon={Phone} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Whatsapp} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Instagram} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Telegram} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Tiktok} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Facebook} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t</Row>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default Header;\n","import { Carousel, CarouselItem, Chip, DivElementMap, UIElementType } from \"@sorocraft/ui\";\nimport { useRef } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as categoryModels from \"src/models/category\";\n\ninterface Props {\n\tcategories: categoryModels.Category[];\n\tlanguage: string;\n\tselectedCategoryId: number;\n\tonSelectCategory: (id: number) => void;\n}\n\nconst Categories = ({ categories, language, selectedCategoryId, onSelectCategory }: Props) => {\n\tconst categoryBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToCategoryBlock = (categoryId: number) => {\n\t\tconst categoryBlock = categoryBlocksRef?.current?.[categoryId];\n\t\tif (!categoryBlock) return;\n\n\t\tcategoryBlock.scrollIntoView({ behavior: \"smooth\", inline: \"center\" });\n\t};\n\n\tconst handleSelectCategory = (id: number) => {\n\t\tscrollToCategoryBlock(id);\n\t\tonSelectCategory(id);\n\t};\n\n\treturn (\n\t\t<div className={styles.categories}>\n\t\t\t<Carousel gap={1}>\n\t\t\t\t{categories.map(({ id, translations }) => {\n\t\t\t\t\tconst { name } = translations.find((item) => item.language === language) || {};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CarouselItem key={id}>\n\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\tonClick={() => handleSelectCategory(id)}\n\t\t\t\t\t\t\t\ttype={UIElementType.BORDERED_PRIMARY}\n\t\t\t\t\t\t\t\tactive={id === selectedCategoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={(el) => (categoryBlocksRef.current[id] = el)}>{name}</div>\n\t\t\t\t\t\t\t</Chip>\n\t\t\t\t\t\t</CarouselItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Carousel>\n\t\t</div>\n\t);\n};\nexport default Categories;\n","export const DEFAULT_CURRENCY = \"AZN\";\n","import { Column, Row } from \"@sorocraft/ui\";\nimport { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport styles from \"./ProductsListItem.module.scss\";\n\nimport * as productModels from \"src/models/product\";\n\nimport { DEFAULT_CURRENCY } from \"../PublicMenu.constants\";\n\ninterface Props {\n\tproduct: productModels.Product;\n\tcurrency: string;\n\tlanguage: string;\n}\n\nconst ProductsListItem = ({ product, currency, language }: Props) => {\n\tconst { translations, price, imageUrl } = product || {};\n\tconst { name, description } = translations.find((item) => item.language === language) || {};\n\tconst formattedPrice = priceFormatter(price, currency || DEFAULT_CURRENCY, language);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Row justifyContent=\"space-between\">\n\t\t\t\t<div className={styles.data}>\n\t\t\t\t\t<Column gap={0.5}>\n\t\t\t\t\t\t<h3 className={styles.name}>{name}</h3>\n\t\t\t\t\t\t<div className={styles.description}>{description}</div>\n\t\t\t\t\t\t<div className={styles.price}>{formattedPrice}</div>\n\t\t\t\t\t</Column>\n\t\t\t\t</div>\n\t\t\t\t{imageUrl && <img src={imageUrl} alt={name} className={styles.image} />}\n\t\t\t</Row>\n\t\t</div>\n\t);\n};\nexport default ProductsListItem;\n","import { RefObject, useEffect } from \"react\";\nimport { Column, DivElementMap } from \"@sorocraft/ui\";\nimport { groupBy } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Products.module.scss\";\n\nimport * as productModels from \"src/models/product\";\nimport * as categoryModels from \"src/models/category\";\nimport * as categoryUtils from \"src/utils/category\";\n\nimport ProductsListItem from \"../ProductsListItem\";\n\ninterface Props {\n\tproducts: productModels.Product[];\n\tcategories: categoryModels.Category[];\n\tproductBlocksRef: RefObject<DivElementMap>;\n\tcurrency: string;\n\tlanguage: string;\n\tonCategoryInView: (categoryId: number) => void;\n}\n\nconst Products = ({\n\tproducts,\n\tcategories,\n\tcurrency,\n\tlanguage,\n\tproductBlocksRef,\n\tonCategoryInView,\n}: Props) => {\n\t// const [layout, setLayout] = useState<\"list\" | \"grid\">(\"list\");\n\n\tconst groupedProducts = groupBy(products, \"categoryId\");\n\n\tuseEffect(() => {\n\t\tconst observer = new IntersectionObserver(\n\t\t\t(entries) => {\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tconst categoryId = Number(entry.target.getAttribute(\"data-category-id\"));\n\t\t\t\t\t\tonCategoryInView(categoryId); // Notify the parent when a category is in view\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t{\n\t\t\t\troot: null, // Use the viewport as the container\n\t\t\t\tthreshold: 0.5, // Trigger when 50% of the product block is in view\n\t\t\t}\n\t\t);\n\n\t\tObject.values(productBlocksRef?.current || {}).forEach((block) => {\n\t\t\tif (block) {\n\t\t\t\tobserver.observe(block);\n\t\t\t}\n\t\t});\n\n\t\treturn () => {\n\t\t\tobserver.disconnect(); // Clean up the observer on component unmount\n\t\t};\n\t}, [productBlocksRef, onCategoryInView]);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t{/* <div className={styles.header}>\n\t\t\t\t<Row>\n\t\t\t\t\t<IconButton icon={List} onClick={() => setLayout(\"list\")} isActive={layout === \"list\"} />\n\t\t\t\t\t<IconButton icon={Grid} onClick={() => setLayout(\"grid\")} isActive={layout === \"grid\"} />\n\t\t\t\t</Row>\n\t\t\t</div> */}\n\t\t\t<Column>\n\t\t\t\t{Object.keys(groupedProducts).map((categoryId) => {\n\t\t\t\t\tconst category = (categories.find(({ id }) => id === Number(categoryId)) ||\n\t\t\t\t\t\t{}) as categoryModels.Category;\n\t\t\t\t\tconst { name } = categoryUtils.getCategoryTranslation(category, language);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={styles.products}\n\t\t\t\t\t\t\tkey={categoryId}\n\t\t\t\t\t\t\tref={(el) => (productBlocksRef!.current![category.id] = el)}\n\t\t\t\t\t\t\tdata-category-id={categoryId}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<h2 className={styles.category}>{name}</h2>\n\t\t\t\t\t\t\t<div className={styles.list}>\n\t\t\t\t\t\t\t\t<Column gap={2}>\n\t\t\t\t\t\t\t\t\t{groupedProducts[categoryId].map((product) => (\n\t\t\t\t\t\t\t\t\t\t<ProductsListItem\n\t\t\t\t\t\t\t\t\t\t\tproduct={product}\n\t\t\t\t\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\t\t\t\t\t\tkey={product.id}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Column>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Column>\n\t\t</div>\n\t);\n};\nexport default Products;\n","import { Category, CategoryTranslation } from \"src/models/category\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n","import { Card, Container, Flex } from \"@sorocraft/ui\";\n\nimport styles from \"./Branches.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranches: branchModels.Branch[];\n}\n\nconst Branches = ({ branches = [] }: Props) => {\n\treturn (\n\t\t<div className={styles.branches}>\n\t\t\t<Container className={styles.list}>\n\t\t\t\t{branches.map(({ id, name }) => (\n\t\t\t\t\t<a key={id} href=\"/\">\n\t\t\t\t\t\t<Card noBottomMargin>\n\t\t\t\t\t\t\t<Flex justifyContent=\"center\" alignItems=\"center\" fullHeight>\n\t\t\t\t\t\t\t\t<h2 className={styles.name}>{name}</h2>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</a>\n\t\t\t\t))}\n\t\t\t</Container>\n\t\t</div>\n\t);\n};\nexport default Branches;\n","import { DivElementMap } from \"@sorocraft/ui\";\nimport { useRef, useState } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as menuModels from \"src/models/menu\";\n\nimport Header from \"./Header\";\nimport Categories from \"./Categories\";\nimport Products from \"./Products\";\nimport Branches from \"./Branches\";\n\ninterface Props {\n\tdata: menuModels.PublicMenuData;\n}\n\nconst PublicMenu = ({ data }: Props) => {\n\tconst {\n\t\tname,\n\t\tcoverImage,\n\t\tlogoImage,\n\t\tbranches = [],\n\t\tbranchId,\n\t\tlanguage,\n\t\tcategories,\n\t\tproducts,\n\t\tcurrency,\n\t} = data || {};\n\n\tconst hasSingleBranch = branches.length <= 1;\n\tconst selectedBranch = branches.find((item) => item.id === Number(branchId));\n\tconst venueName = hasSingleBranch || !selectedBranch?.name ? name : selectedBranch?.name || \"\";\n\n\tconst [selectedCategoryId, setSelectedCategoryId] = useState<number>(categories?.[0]?.id);\n\tconst productBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToProductBlock = (categoryId: number) => {\n\t\tconst productBlock = productBlocksRef?.current?.[categoryId];\n\t\tif (!productBlock) return;\n\n\t\tproductBlock.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n\t};\n\n\tconst handleSelectCategory = (categoryId: number) => {\n\t\tsetSelectedCategoryId(categoryId);\n\n\t\tscrollToProductBlock(categoryId);\n\t};\n\n\tconst handleCategoryInView = (categoryId: number) => {\n\t\tif (categoryId !== selectedCategoryId) {\n\t\t\tsetSelectedCategoryId(categoryId);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Header\n\t\t\t\tbranch={selectedBranch}\n\t\t\t\tname={venueName}\n\t\t\t\tcoverImage={coverImage}\n\t\t\t\tlogoImage={logoImage}\n\t\t\t/>\n\t\t\t{!hasSingleBranch && !branchId ? (\n\t\t\t\t<Branches branches={branches} />\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Categories\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tselectedCategoryId={selectedCategoryId}\n\t\t\t\t\t\tonSelectCategory={handleSelectCategory}\n\t\t\t\t\t/>\n\t\t\t\t\t<Products\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tproducts={products}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tproductBlocksRef={productBlocksRef}\n\t\t\t\t\t\tonCategoryInView={handleCategoryInView}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default PublicMenu;\n"],"names":["Header","branch","coverImage","logoImage","name","defaultCover","defaultLogo","address","latitude","longitude","noBranch","isEmpty","logoImageSource","googleMapLink","_jsxs","className","styles","children","_jsx","src","alt","Column","fullWidth","fullHeight","alignItems","justifyContent","Row","gap","href","target","rel","SVGIcon","icon","MarkerPin","theme","IconLink","Wifi","size","shape","Phone","Whatsapp","Instagram","Telegram","Tiktok","Facebook","Categories","categories","language","selectedCategoryId","onSelectCategory","categoryBlocksRef","useRef","handleSelectCategory","id","categoryId","categoryBlock","_a","current","scrollIntoView","behavior","inline","scrollToCategoryBlock","Carousel","map","translations","find","item","CarouselItem","Chip","onClick","type","UIElementType","BORDERED_PRIMARY","active","ref","el","ProductsListItem","product","currency","price","imageUrl","description","formattedPrice","priceFormatter","container","data","image","Products","products","productBlocksRef","onCategoryInView","groupedProducts","groupBy","useEffect","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","Number","getAttribute","root","threshold","Object","values","block","observe","disconnect","keys","category","_b","call","categoryUtils.getCategoryTranslation","list","Branches","branches","Container","Card","noBottomMargin","Flex","PublicMenu","branchId","hasSingleBranch","length","selectedBranch","venueName","setSelectedCategoryId","useState","_Fragment","productBlock","scrollToProductBlock"],"mappings":"g5BA0BA,MAAMA,EAAS,EACdC,SACAC,aACAC,YACAC,OACAC,eAAe,GACfC,cAAc,OAEd,MAAMC,QAAEA,EAAOC,SAAEA,EAAQC,UAAEA,GAAcR,GAAU,CAAA,EAC7CS,EAAWC,EAAQV,GAGnBW,EAAkBT,GAAaG,EAE/BO,EAAgB,qCAAqCL,KAAYC,IAgCvE,OACCK,EAAA,MAAA,CAAKC,UAAWC,EAAgBC,SAAA,CAC/BC,EAAK,MAAA,CAAAC,IArCkBjB,GAAcG,EAqCTe,IAAKhB,EAAMW,UAAWC,IAClDF,EAAK,MAAA,CAAAC,UAAWC,YACHE,EAAXR,EAbiB,IACpBI,EAACO,EAAM,CAACC,WAAS,EAACC,YAAU,EAACC,WAAW,SAASC,eAAe,SAC/DR,SAAA,CAAAC,EAAA,MAAA,CAAKC,IAAKP,EAAiBQ,IAAKhB,EAAMW,UAAWC,IACjDE,EAAK,MAAA,CAAAH,UAAWC,WACfE,EAAI,KAAA,CAAAH,UAAWC,EAAcC,SAAAb,SAzBb,IAClBU,EAACY,EAAI,CAAAC,IAAK,EAACV,SAAA,CACVC,SAAKC,IAAKP,EAAiBQ,IAAKhB,EAAMW,UAAWC,IACjDF,SAAKC,UAAWC,YACfE,EAAI,KAAA,CAAAH,UAAWC,EAAcC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,SAAUA,EACVC,mBAAoBA,EACpBC,iBA5ByBK,IAC7ByE,EAAsBzE,GARM,CAACA,UAC7B,MAAM4E,EAA2C,QAA5B1E,EAAAiC,aAAA,EAAAA,EAAkBhC,eAAU,IAAAD,OAAA,EAAAA,EAAAF,GAC5C4E,GAELA,EAAaxE,eAAe,CAAEC,SAAU,SAAU+C,MAAO,SAAU,EAMnEyB,CAAqB7E,EAAW,IA2B7BpC,EAACqE,EACA,CAAAzC,WAAYA,EACZ0C,SAAUA,EACVV,SAAUA,EACV/B,SAAUA,EACV0C,iBAAkBA,EAClBC,iBA9ByBpC,IACzBA,IAAeN,GAClB+E,EAAsBzE,EACtB,OAYCpC,EAACiG,EAAQ,CAACC,SAAUA,MAoBrB"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/PublicMenu/Header/Header.tsx","../src/components/PublicMenu/Categories.tsx","../src/components/PublicMenu/PublicMenu.constants.ts","../src/components/PublicMenu/ProductsListItem/ProductsListItem.tsx","../src/components/PublicMenu/Products/Products.tsx","../src/utils/category.ts","../src/components/PublicMenu/Branches/Branches.tsx","../src/components/PublicMenu/PublicMenu.tsx"],"sourcesContent":["import { Column, IconLink, Row, SVGIcon } from \"@sorocraft/ui\";\nimport {\n\tMarkerPin,\n\tPhone,\n\tWifi,\n\tInstagram,\n\tWhatsapp,\n\tTiktok,\n\tFacebook,\n\tTelegram,\n} from \"@sorocraft/ui/icons\";\nimport { isEmpty } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Header.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\nimport * as menuModels from \"src/models/menu\";\n\ninterface Props\n\textends Pick<\n\t\tmenuModels.PublicMenuData,\n\t\t| \"coverImage\"\n\t\t| \"logoImage\"\n\t\t| \"name\"\n\t\t| \"instagram\"\n\t\t| \"facebook\"\n\t\t| \"whatsapp\"\n\t\t| \"telegram\"\n\t\t| \"tiktok\"\n\t> {\n\tbranch?: branchModels.Branch;\n}\n\nconst Header = ({\n\tbranch,\n\tcoverImage,\n\tlogoImage,\n\tname,\n\tinstagram,\n\tfacebook,\n\twhatsapp,\n\ttelegram,\n\ttiktok,\n}: Props) => {\n\tconst { address, latitude, longitude, phone } = branch || {};\n\tconst noBranch = isEmpty(branch);\n\n\tconst googleMapLink = `https://www.google.com/maps/place/${latitude},${longitude}`;\n\n\t// const languageOptions = useMemo(\n\t// \t() =>\n\t// \t\t[\"az\", \"en\"].map((language) => ({\n\t// \t\t\tvalue: language,\n\t// \t\t\tlabel: language,\n\t// \t\t})),\n\t// \t[]\n\t// );\n\n\tconst BranchInfo = () => (\n\t\t<Row gap={1}>\n\t\t\t<img src={logoImage} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\n\t\t\t\t<a\n\t\t\t\t\tclassName={styles.address}\n\t\t\t\t\thref={googleMapLink}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t<Row alignItems=\"center\" gap={0.5}>\n\t\t\t\t\t\t<SVGIcon icon={MarkerPin} theme=\"dark\" />\n\t\t\t\t\t\t<span>{address}</span>\n\t\t\t\t\t</Row>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Row>\n\t);\n\n\tconst BusinessInfo = () => (\n\t\t<Column fullWidth fullHeight alignItems=\"center\" justifyContent=\"center\">\n\t\t\t<img src={logoImage} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\t\t\t</div>\n\t\t</Column>\n\t);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<img src={coverImage} alt={name} className={styles.cover} />\n\t\t\t<div className={styles.content}>{noBranch ? <BusinessInfo /> : <BranchInfo />}</div>\n\t\t\t{!noBranch && (\n\t\t\t\t<div className={styles.social}>\n\t\t\t\t\t<div className={styles.links}>\n\t\t\t\t\t\t<Row gap={2}>\n\t\t\t\t\t\t\t<Row alignItems=\"center\" justifyContent=\"center\" gap={0.5}>\n\t\t\t\t\t\t\t\t{phone && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Phone}\n\t\t\t\t\t\t\t\t\t\thref={`tel:+${phone}`}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{whatsapp && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Whatsapp}\n\t\t\t\t\t\t\t\t\t\thref={`https://wa.me/${whatsapp}`}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{instagram && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Instagram}\n\t\t\t\t\t\t\t\t\t\thref={instagram}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{telegram && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Telegram}\n\t\t\t\t\t\t\t\t\t\thref={telegram}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{tiktok && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Tiktok}\n\t\t\t\t\t\t\t\t\t\thref={tiktok}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{facebook && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Facebook}\n\t\t\t\t\t\t\t\t\t\thref={facebook}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Row>\n\t\t\t\t\t\t\t<Row>\n\t\t\t\t\t\t\t\t<SVGIcon icon={Wifi} size=\"sm\" />\n\t\t\t\t\t\t\t</Row>\n\t\t\t\t\t\t</Row>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default Header;\n","import { Carousel, CarouselItem, Chip, DivElementMap, UIElementType } from \"@sorocraft/ui\";\nimport { useRef } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as categoryModels from \"src/models/category\";\n\ninterface Props {\n\tcategories: categoryModels.Category[];\n\tlanguage: string;\n\tselectedCategoryId: number;\n\tonSelectCategory: (id: number) => void;\n}\n\nconst Categories = ({ categories, language, selectedCategoryId, onSelectCategory }: Props) => {\n\tconst categoryBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToCategoryBlock = (categoryId: number) => {\n\t\tconst categoryBlock = categoryBlocksRef?.current?.[categoryId];\n\t\tif (!categoryBlock) return;\n\n\t\tcategoryBlock.scrollIntoView({ behavior: \"smooth\", inline: \"center\" });\n\t};\n\n\tconst handleSelectCategory = (id: number) => {\n\t\tscrollToCategoryBlock(id);\n\t\tonSelectCategory(id);\n\t};\n\n\treturn (\n\t\t<div className={styles.categories}>\n\t\t\t<Carousel gap={1}>\n\t\t\t\t{categories.map(({ id, translations }) => {\n\t\t\t\t\tconst { name } = translations.find((item) => item.language === language) || {};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CarouselItem key={id}>\n\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\tonClick={() => handleSelectCategory(id)}\n\t\t\t\t\t\t\t\ttype={UIElementType.BORDERED_PRIMARY}\n\t\t\t\t\t\t\t\tactive={id === selectedCategoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={(el) => (categoryBlocksRef.current[id] = el)}>{name}</div>\n\t\t\t\t\t\t\t</Chip>\n\t\t\t\t\t\t</CarouselItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Carousel>\n\t\t</div>\n\t);\n};\nexport default Categories;\n","export const DEFAULT_CURRENCY = \"AZN\";\n","import { Column, Row } from \"@sorocraft/ui\";\nimport { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport styles from \"./ProductsListItem.module.scss\";\n\nimport * as productModels from \"src/models/product\";\n\nimport { DEFAULT_CURRENCY } from \"../PublicMenu.constants\";\n\ninterface Props {\n\tproduct: productModels.Product;\n\tcurrency: string;\n\tlanguage: string;\n}\n\nconst ProductsListItem = ({ product, currency, language }: Props) => {\n\tconst { translations, price, imageUrl } = product || {};\n\tconst { name, description } = translations.find((item) => item.language === language) || {};\n\tconst formattedPrice = priceFormatter(price, currency || DEFAULT_CURRENCY, language);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Row justifyContent=\"space-between\">\n\t\t\t\t<div className={styles.data}>\n\t\t\t\t\t<Column gap={0.5}>\n\t\t\t\t\t\t<h3 className={styles.name}>{name}</h3>\n\t\t\t\t\t\t<div className={styles.description}>{description}</div>\n\t\t\t\t\t\t<div className={styles.price}>{formattedPrice}</div>\n\t\t\t\t\t</Column>\n\t\t\t\t</div>\n\t\t\t\t{imageUrl && <img src={imageUrl} alt={name} className={styles.image} />}\n\t\t\t</Row>\n\t\t</div>\n\t);\n};\nexport default ProductsListItem;\n","import { RefObject, useEffect, memo, useCallback } from \"react\";\nimport { Column, DivElementMap } from \"@sorocraft/ui\";\nimport { groupBy } from \"@sorocraft/js-utils\";\nimport styles from \"./Products.module.scss\";\nimport * as productModels from \"src/models/product\";\nimport * as categoryModels from \"src/models/category\";\nimport * as categoryUtils from \"src/utils/category\";\nimport ProductsListItem from \"../ProductsListItem\";\n\ninterface Props {\n\tproducts: productModels.Product[];\n\tcategories: categoryModels.Category[];\n\tproductBlocksRef: RefObject<DivElementMap>;\n\tcurrency: string;\n\tlanguage: string;\n\tonCategoryInView: (categoryId: number) => void;\n}\n\nconst Products = memo(\n\t({ products, categories, currency, language, productBlocksRef, onCategoryInView }: Props) => {\n\t\tconst groupedProducts = groupBy(products, \"categoryId\");\n\n\t\tconst handleIntersection = useCallback(\n\t\t\t(entries: IntersectionObserverEntry[]) => {\n\t\t\t\tlet bestMatchCategoryId: number | null = null;\n\t\t\t\tlet maxVisibility = 0;\n\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tconst categoryId = Number(entry.target.getAttribute(\"data-category-id\"));\n\t\t\t\t\tconst visiblePercentage = entry.intersectionRatio;\n\n\t\t\t\t\t// Track the category block that has the highest visible percentage\n\t\t\t\t\tif (visiblePercentage > maxVisibility) {\n\t\t\t\t\t\tmaxVisibility = visiblePercentage;\n\t\t\t\t\t\tbestMatchCategoryId = categoryId;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Only update if the best matching category is different from the currently selected one\n\t\t\t\tif (bestMatchCategoryId) {\n\t\t\t\t\tonCategoryInView(bestMatchCategoryId);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[onCategoryInView]\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst observer = new IntersectionObserver(handleIntersection, {\n\t\t\t\troot: null,\n\t\t\t\tthreshold: [0.1, 0.5, 0.75], // Different levels of visibility\n\t\t\t});\n\n\t\t\tObject.values(productBlocksRef?.current || {}).forEach((block) => {\n\t\t\t\tif (block) {\n\t\t\t\t\tobserver.observe(block);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn () => {\n\t\t\t\tobserver.disconnect();\n\t\t\t};\n\t\t}, [productBlocksRef, handleIntersection]);\n\n\t\treturn (\n\t\t\t<div className={styles.container}>\n\t\t\t\t<Column>\n\t\t\t\t\t{Object.keys(groupedProducts).map((categoryId) => {\n\t\t\t\t\t\tconst category = (categories.find(({ id }) => id === Number(categoryId)) ||\n\t\t\t\t\t\t\t{}) as categoryModels.Category;\n\t\t\t\t\t\tconst { name } = categoryUtils.getCategoryTranslation(category, language);\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={styles.products}\n\t\t\t\t\t\t\t\tkey={categoryId}\n\t\t\t\t\t\t\t\tref={(el) => (productBlocksRef!.current![category.id] = el)}\n\t\t\t\t\t\t\t\tdata-category-id={categoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<h2 className={styles.category}>{name}</h2>\n\t\t\t\t\t\t\t\t<div className={styles.list}>\n\t\t\t\t\t\t\t\t\t<Column gap={2}>\n\t\t\t\t\t\t\t\t\t\t{groupedProducts[categoryId].map((product) => (\n\t\t\t\t\t\t\t\t\t\t\t<ProductsListItem\n\t\t\t\t\t\t\t\t\t\t\t\tproduct={product}\n\t\t\t\t\t\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\t\t\t\t\t\t\tkey={product.id}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</Column>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</Column>\n\t\t\t</div>\n\t\t);\n\t},\n\t(prevProps, nextProps) => {\n\t\treturn (\n\t\t\tprevProps.products === nextProps.products &&\n\t\t\tprevProps.categories === nextProps.categories &&\n\t\t\tprevProps.currency === nextProps.currency &&\n\t\t\tprevProps.language === nextProps.language\n\t\t);\n\t}\n);\n\nexport default Products;\n","import { Category, CategoryTranslation } from \"src/models/category\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n","import { Card, Container, Flex } from \"@sorocraft/ui\";\n\nimport styles from \"./Branches.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranches: branchModels.Branch[];\n}\n\nconst Branches = ({ branches = [] }: Props) => {\n\treturn (\n\t\t<div className={styles.branches}>\n\t\t\t<Container className={styles.list}>\n\t\t\t\t{branches.map(({ id, name }) => (\n\t\t\t\t\t<a key={id} href=\"/\">\n\t\t\t\t\t\t<Card noBottomMargin>\n\t\t\t\t\t\t\t<Flex justifyContent=\"center\" alignItems=\"center\" fullHeight>\n\t\t\t\t\t\t\t\t<h2 className={styles.name}>{name}</h2>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</a>\n\t\t\t\t))}\n\t\t\t</Container>\n\t\t</div>\n\t);\n};\nexport default Branches;\n","import { DivElementMap } from \"@sorocraft/ui\";\nimport { useRef, useState } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as menuModels from \"src/models/menu\";\n\nimport Header from \"./Header\";\nimport Categories from \"./Categories\";\nimport Products from \"./Products\";\nimport Branches from \"./Branches\";\n\ninterface Props {\n\tdata: menuModels.PublicMenuData;\n}\n\nconst PublicMenu = ({ data }: Props) => {\n\tconst {\n\t\tname,\n\t\tcoverImage,\n\t\tlogoImage,\n\t\tbranches = [],\n\t\tbranchId,\n\t\tlanguage,\n\t\tcategories,\n\t\tproducts,\n\t\tcurrency,\n\t\tdefaultCover = \"\",\n\t\tdefaultLogo = \"\",\n\t\tinstagram,\n\t\tfacebook,\n\t\twhatsapp,\n\t\ttelegram,\n\t\ttiktok,\n\t} = data || {};\n\n\tconst hasSingleBranch = branches.length <= 1;\n\tconst selectedBranch = branches.find((item) => item.id === Number(branchId));\n\tconst venueName = hasSingleBranch || !selectedBranch?.name ? name : selectedBranch?.name || \"\";\n\n\tconst coverImageSource = coverImage || defaultCover;\n\tconst logoImageSource = logoImage || defaultLogo;\n\n\tconst [selectedCategoryId, setSelectedCategoryId] = useState<number>(categories?.[0]?.id);\n\tconst productBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToProductBlock = (categoryId: number) => {\n\t\tconst productBlock = productBlocksRef?.current?.[categoryId];\n\t\tif (!productBlock) return;\n\n\t\tproductBlock.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n\t};\n\n\tconst handleSelectCategory = (categoryId: number) => {\n\t\tsetSelectedCategoryId(categoryId);\n\n\t\tscrollToProductBlock(categoryId);\n\t};\n\n\tconst handleCategoryInView = (categoryId: number) => {\n\t\tif (categoryId !== selectedCategoryId) {\n\t\t\tsetSelectedCategoryId(categoryId);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Header\n\t\t\t\tbranch={selectedBranch}\n\t\t\t\tname={venueName}\n\t\t\t\tcoverImage={coverImageSource}\n\t\t\t\tlogoImage={logoImageSource}\n\t\t\t\tinstagram={instagram}\n\t\t\t\tfacebook={facebook}\n\t\t\t\twhatsapp={whatsapp}\n\t\t\t\ttelegram={telegram}\n\t\t\t\ttiktok={tiktok}\n\t\t\t/>\n\t\t\t{!hasSingleBranch && !branchId ? (\n\t\t\t\t<Branches branches={branches} />\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Categories\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tselectedCategoryId={selectedCategoryId}\n\t\t\t\t\t\tonSelectCategory={handleSelectCategory}\n\t\t\t\t\t/>\n\t\t\t\t\t<Products\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tproducts={products}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tproductBlocksRef={productBlocksRef}\n\t\t\t\t\t\tonCategoryInView={handleCategoryInView}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default PublicMenu;\n"],"names":["Header","branch","coverImage","logoImage","name","instagram","facebook","whatsapp","telegram","tiktok","address","latitude","longitude","phone","noBranch","isEmpty","googleMapLink","_jsxs","className","styles","children","_jsx","src","alt","Column","fullWidth","fullHeight","alignItems","justifyContent","Row","gap","href","target","rel","SVGIcon","icon","MarkerPin","theme","IconLink","Phone","size","shape","Whatsapp","Instagram","Telegram","Tiktok","Facebook","Wifi","Categories","categories","language","selectedCategoryId","onSelectCategory","categoryBlocksRef","useRef","handleSelectCategory","id","categoryId","categoryBlock","_a","current","scrollIntoView","behavior","inline","scrollToCategoryBlock","Carousel","map","translations","find","item","CarouselItem","Chip","onClick","type","UIElementType","BORDERED_PRIMARY","active","ref","el","ProductsListItem","product","currency","price","imageUrl","description","formattedPrice","priceFormatter","container","data","image","Products","memo","products","productBlocksRef","onCategoryInView","groupedProducts","groupBy","handleIntersection","useCallback","entries","bestMatchCategoryId","maxVisibility","forEach","entry","Number","getAttribute","visiblePercentage","intersectionRatio","useEffect","observer","IntersectionObserver","root","threshold","Object","values","block","observe","disconnect","keys","category","_b","call","categoryUtils.getCategoryTranslation","list","prevProps","nextProps","Branches","branches","Container","Card","noBottomMargin","Flex","PublicMenu","branchId","defaultCover","defaultLogo","hasSingleBranch","length","selectedBranch","venueName","coverImageSource","logoImageSource","setSelectedCategoryId","useState","_Fragment","productBlock","scrollToProductBlock"],"mappings":"24BAiCA,MAAMA,EAAS,EACdC,SACAC,aACAC,YACAC,OACAC,YACAC,WACAC,WACAC,WACAC,aAEA,MAAMC,QAAEA,EAAOC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,GAAUZ,GAAU,GACpDa,EAAWC,EAAQd,GAEnBe,EAAgB,qCAAqCL,KAAYC,IAyCvE,OACCK,EAAA,MAAA,CAAKC,UAAWC,EACfC,SAAA,CAAAC,EAAA,MAAA,CAAKC,IAAKpB,EAAYqB,IAAKnB,EAAMc,UAAWC,IAC5CE,EAAK,MAAA,CAAAH,UAAWC,EAAcC,SAAcC,EAAXP,EAZd,IACpBG,EAACO,EAAM,CAACC,WAAS,EAACC,YAAU,EAACC,WAAW,SAASC,eAAe,SAC/DR,SAAA,CAAAC,EAAA,MAAA,CAAKC,IAAKnB,EAAWoB,IAAKnB,EAAMc,UAAWC,IAC3CE,EAAK,MAAA,CAAAH,UAAWC,WACfE,EAAI,KAAA,CAAAH,UAAWC,EAAcC,SAAAhB,SAzBb,IAClBa,EAACY,EAAI,CAAAC,IAAK,EAACV,SAAA,CACVC,SAAKC,IAAKnB,EAAWoB,IAAKnB,EAAMc,UAAWC,IAC3CF,SAAKC,UAAWC,YACfE,EAAI,KAAA,CAAAH,UAAWC,EAAcC,SAAAhB,IAE7BiB,EACC,IAAA,CAAAH,UAAWC,EACXY,KAAMf,EACNgB,OAAO,SACPC,IAAI,sBAEJb,SAAAH,EAACY,EAAI,CAAAF,WAAW,SAASG,IAAK,GAAGV,SAAA,CAChCC,EAACa,EAAO,CAACC,KAAMC,E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jBpF,EAAAV,aAAU,EAAVA,EAAa,UAAI,IAAAU,OAAA,EAAAA,EAAAH,IAChFqC,EAAmBvC,EAAsB,CAAA,GAqB/C,OACCrC,EAAK,MAAA,CAAAC,UAAWC,EACfC,SAAA,CAAAC,EAACrB,EAAM,CACNC,OAAQyI,EACRtI,KAAMuI,EACNzI,WAAY0I,EACZzI,UAAW0I,EACXxI,UAAWA,EACXC,SAAUA,EACVC,SAAUA,EACVC,SAAUA,EACVC,OAAQA,IAEP+H,GAAoBH,EAGrBpH,EACC+H,EAAA,CAAA5H,SAAA,CAAAC,EAAC2B,EAAU,CACVC,WAAYA,EACZC,SAAUA,EACVC,mBAAoBA,EACpBC,iBAjCyBK,IAC7BqF,EAAsBrF,GARM,CAACA,UAC7B,MAAMwF,EAA2C,QAA5BtF,EAAAkC,aAAA,EAAAA,EAAkBjC,eAAU,IAAAD,OAAA,EAAAA,EAAAF,GAC5CwF,GAELA,EAAapF,eAAe,CAAEC,SAAU,SAAUqD,MAAO,SAAU,EAMnE+B,CAAqBzF,EAAW,IAgC7BpC,EAACqE,EAAQ,CACRzC,WAAYA,EACZ2C,SAAUA,EACVX,SAAUA,EACV/B,SAAUA,EACV2C,iBAAkBA,EAClBC,iBAnCyBrC,IACzBA,IAAeN,GAClB2F,EAAsBrF,EACtB,OAiBCpC,EAACyG,EAAQ,CAACC,SAAUA,MAoBrB"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),s=require("react"),a=require("@sorocraft/ui"),r=require("@sorocraft/ui/icons"),t=require("@sorocraft/js-utils"),n="PublicMenu-module_container__QLN6U",i="PublicMenu-module_categories__Iy6NC",c="Header-module_container__tenlF",o="Header-module_cover__BAWZK",l="Header-module_content__Gx4Al",d="Header-module_logo__4MTCm",m="Header-module_info__IchYA",u="Header-module_name__30wyw",h="Header-module_address__WOxXc",g="Header-module_social__AoP0z",_="Header-module_links__EeQxg";const j=({branch:s,coverImage:n,logoImage:i,name:j,instagram:x,facebook:p,whatsapp:v,telegram:f,tiktok:I})=>{const{address:b,latitude:k,longitude:N,phone:y}=s||{},C=t.isEmpty(s),L=`https://www.google.com/maps/place/${k},${N}`;return e.jsxs("div",{className:c,children:[e.jsx("img",{src:n,alt:j,className:o}),e.jsx("div",{className:l,children:C?e.jsx((()=>e.jsxs(a.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx("img",{src:i,alt:j,className:d}),e.jsx("div",{className:m,children:e.jsx("h1",{className:u,children:j})})]})),{}):e.jsx((()=>e.jsxs(a.Row,{gap:1,children:[e.jsx("img",{src:i,alt:j,className:d}),e.jsxs("div",{className:m,children:[e.jsx("h1",{className:u,children:j}),e.jsx("a",{className:h,href:L,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(a.Row,{alignItems:"center",gap:.5,children:[e.jsx(a.SVGIcon,{icon:r.MarkerPin,theme:"dark"}),e.jsx("span",{children:b})]})})]})]})),{})}),!C&&e.jsx("div",{className:g,children:e.jsx("div",{className:_,children:e.jsxs(a.Row,{gap:2,children:[e.jsxs(a.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[y&&e.jsx(a.IconLink,{icon:r.Phone,href:`tel:+${y}`,size:"sm",shape:"circle",theme:"light"}),v&&e.jsx(a.IconLink,{icon:r.Whatsapp,href:`https://wa.me/${v}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),x&&e.jsx(a.IconLink,{icon:r.Instagram,href:x,size:"sm",shape:"circle",theme:"light",target:"_blank"}),f&&e.jsx(a.IconLink,{icon:r.Telegram,href:f,size:"sm",shape:"circle",theme:"light",target:"_blank"}),I&&e.jsx(a.IconLink,{icon:r.Tiktok,href:I,size:"sm",shape:"circle",theme:"light",target:"_blank"}),p&&e.jsx(a.IconLink,{icon:r.Facebook,href:p,size:"sm",shape:"circle",theme:"light",target:"_blank"})]}),e.jsx(a.Row,{children:e.jsx(a.SVGIcon,{icon:r.Wifi,size:"sm"})})]})})})]})},x=({categories:r,language:t,selectedCategoryId:n,onSelectCategory:c})=>{const o=s.useRef({}),l=e=>{(e=>{var s;const a=null===(s=null==o?void 0:o.current)||void 0===s?void 0:s[e];a&&a.scrollIntoView({behavior:"smooth",inline:"center"})})(e),c(e)};return e.jsx("div",{className:i,children:e.jsx(a.Carousel,{gap:1,children:r.map((({id:s,translations:r})=>{const{name:i}=r.find((e=>e.language===t))||{};return e.jsx(a.CarouselItem,{children:e.jsx(a.Chip,{onClick:()=>l(s),type:a.UIElementType.BORDERED_PRIMARY,active:s===n,children:e.jsx("div",{ref:e=>o.current[s]=e,children:i})})},s)}))})})};var p={container:"Products-module_container__bF2LF",header:"Products-module_header__0EFvL",products:"Products-module_products__AoDrY",list:"Products-module_list__LH4v5"};var v={container:"ProductsListItem-module_container__i9tFs",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",image:"ProductsListItem-module_image__h6Wbi",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV"};const f=({product:s,currency:r,language:n})=>{const{translations:i,price:c,imageUrl:o}=s||{},{name:l,description:d}=i.find((e=>e.language===n))||{},m=t.priceFormatter(c,r||"AZN",n);return e.jsx("div",{className:v.container,children:e.jsxs(a.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:v.data,children:e.jsxs(a.Column,{gap:.5,children:[e.jsx("h3",{className:v.name,children:l}),e.jsx("div",{className:v.description,children:d}),e.jsx("div",{className:v.price,children:m})]})}),o&&e.jsx("img",{src:o,alt:l,className:v.image})]})})},I=s.memo((({products:r,categories:n,currency:i,language:c,productBlocksRef:o,onCategoryInView:l})=>{const d=t.groupBy(r,"categoryId"),m=s.useCallback((e=>{let s=null,a=0;e.forEach((e=>{const r=Number(e.target.getAttribute("data-category-id")),t=e.intersectionRatio;t>a&&(a=t,s=r)})),s&&l(s)}),[l]);return s.useEffect((()=>{const e=new IntersectionObserver(m,{root:null,threshold:[.1,.5,.75]});return Object.values((null==o?void 0:o.current)||{}).forEach((s=>{s&&e.observe(s)})),()=>{e.disconnect()}}),[o,m]),e.jsx("div",{className:p.container,children:e.jsx(a.Column,{children:Object.keys(d).map((s=>{const r=n.find((({id:e})=>e===Number(s)))||{},{name:t}=((e,s)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===s)))||{}})(r,c);return e.jsxs("div",{className:p.products,ref:e=>o.current[r.id]=e,"data-category-id":s,children:[e.jsx("h2",{className:p.category,children:t}),e.jsx("div",{className:p.list,children:e.jsx(a.Column,{gap:2,children:d[s].map((s=>e.jsx(f,{product:s,currency:i,language:c},s.id)))})})]},s)}))})})}),((e,s)=>e.products===s.products&&e.categories===s.categories&&e.currency===s.currency&&e.language===s.language));var b="Branches-module_branches__sOuoV",k="Branches-module_list__vYoT2",N="Branches-module_name__K0Z-4";const y=({branches:s=[]})=>e.jsx("div",{className:b,children:e.jsx(a.Container,{className:k,children:s.map((({id:s,name:r})=>e.jsx("a",{href:"/",children:e.jsx(a.Card,{noBottomMargin:!0,children:e.jsx(a.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:N,children:r})})})},s)))})});exports.PublicMenu=({data:a})=>{var r;const{name:t,coverImage:i,logoImage:c,branches:o=[],branchId:l,language:d,categories:m,products:u,currency:h,defaultCover:g="",defaultLogo:_="",instagram:p,facebook:v,whatsapp:f,telegram:b,tiktok:k}=a||{},N=o.length<=1,C=o.find((e=>e.id===Number(l))),L=N||!(null==C?void 0:C.name)?t:(null==C?void 0:C.name)||"",P=i||g,w=c||_,[R,A]=s.useState(null===(r=null==m?void 0:m[0])||void 0===r?void 0:r.id),H=s.useRef({});return e.jsxs("div",{className:n,children:[e.jsx(j,{branch:C,name:L,coverImage:P,logoImage:w,instagram:p,facebook:v,whatsapp:f,telegram:b,tiktok:k}),N||l?e.jsxs(e.Fragment,{children:[e.jsx(x,{categories:m,language:d,selectedCategoryId:R,onSelectCategory:e=>{A(e),(e=>{var s;const a=null===(s=null==H?void 0:H.current)||void 0===s?void 0:s[e];a&&a.scrollIntoView({behavior:"smooth",block:"start"})})(e)}}),e.jsx(I,{categories:m,products:u,currency:h,language:d,productBlocksRef:H,onCategoryInView:e=>{e!==R&&A(e)}})]}):e.jsx(y,{branches:o})]})};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/PublicMenu/Header/Header.tsx","../src/components/PublicMenu/Categories.tsx","../src/components/PublicMenu/PublicMenu.constants.ts","../src/components/PublicMenu/ProductsListItem/ProductsListItem.tsx","../src/components/PublicMenu/Products/Products.tsx","../src/utils/category.ts","../src/components/PublicMenu/Branches/Branches.tsx","../src/components/PublicMenu/PublicMenu.tsx"],"sourcesContent":["import { Column, IconLink, Row, SVGIcon } from \"@sorocraft/ui\";\nimport {\n\tMarkerPin,\n\tPhone,\n\tWifi,\n\tInstagram,\n\tWhatsapp,\n\tTiktok,\n\tFacebook,\n\tTelegram,\n} from \"@sorocraft/ui/icons\";\nimport { isEmpty } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Header.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranch?: branchModels.Branch;\n\tcoverImage?: string;\n\tlogoImage?: string;\n\tdefaultCover?: string;\n\tdefaultLogo?: string;\n\tname: string;\n}\n\nconst Header = ({\n\tbranch,\n\tcoverImage,\n\tlogoImage,\n\tname,\n\tdefaultCover = \"\",\n\tdefaultLogo = \"\",\n}: Props) => {\n\tconst { address, latitude, longitude } = branch || {};\n\tconst noBranch = isEmpty(branch);\n\n\tconst coverImageSource = coverImage || defaultCover;\n\tconst logoImageSource = logoImage || defaultLogo;\n\n\tconst googleMapLink = `https://www.google.com/maps/place/${latitude},${longitude}`;\n\n\tconst BranchInfo = () => (\n\t\t<Row gap={1}>\n\t\t\t<img src={logoImageSource} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\n\t\t\t\t<a\n\t\t\t\t\tclassName={styles.address}\n\t\t\t\t\thref={googleMapLink}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t<Row alignItems=\"center\" gap={0.5}>\n\t\t\t\t\t\t<SVGIcon icon={MarkerPin} theme=\"dark\" />\n\t\t\t\t\t\t<span>{address}</span>\n\t\t\t\t\t</Row>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Row>\n\t);\n\n\tconst BusinessInfo = () => (\n\t\t<Column fullWidth fullHeight alignItems=\"center\" justifyContent=\"center\">\n\t\t\t<img src={logoImageSource} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\t\t\t</div>\n\t\t</Column>\n\t);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<img src={coverImageSource} alt={name} className={styles.cover} />\n\t\t\t<div className={styles.content}>\n\t\t\t\t{noBranch ? <BusinessInfo /> : <BranchInfo />}\n\t\t\t\t{!noBranch && (\n\t\t\t\t\t<div className={styles.labels}>\n\t\t\t\t\t\t<Column alignItems=\"center\" justifyContent=\"center\" gap={0.75} fullHeight>\n\t\t\t\t\t\t\t<IconLink icon={Wifi} href=\"/\" size=\"sm\" shape=\"circle\" />\n\t\t\t\t\t\t</Column>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t\t{!noBranch && (\n\t\t\t\t<div className={styles.social}>\n\t\t\t\t\t<div className={styles.links}>\n\t\t\t\t\t\t<Row alignItems=\"center\" justifyContent=\"center\" gap={0.5}>\n\t\t\t\t\t\t\t<IconLink icon={Phone} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Whatsapp} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Instagram} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Telegram} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Tiktok} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t\t<IconLink icon={Facebook} href=\"/\" size=\"sm\" shape=\"circle\" theme=\"light\" />\n\t\t\t\t\t\t</Row>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default Header;\n","import { Carousel, CarouselItem, Chip, DivElementMap, UIElementType } from \"@sorocraft/ui\";\nimport { useRef } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as categoryModels from \"src/models/category\";\n\ninterface Props {\n\tcategories: categoryModels.Category[];\n\tlanguage: string;\n\tselectedCategoryId: number;\n\tonSelectCategory: (id: number) => void;\n}\n\nconst Categories = ({ categories, language, selectedCategoryId, onSelectCategory }: Props) => {\n\tconst categoryBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToCategoryBlock = (categoryId: number) => {\n\t\tconst categoryBlock = categoryBlocksRef?.current?.[categoryId];\n\t\tif (!categoryBlock) return;\n\n\t\tcategoryBlock.scrollIntoView({ behavior: \"smooth\", inline: \"center\" });\n\t};\n\n\tconst handleSelectCategory = (id: number) => {\n\t\tscrollToCategoryBlock(id);\n\t\tonSelectCategory(id);\n\t};\n\n\treturn (\n\t\t<div className={styles.categories}>\n\t\t\t<Carousel gap={1}>\n\t\t\t\t{categories.map(({ id, translations }) => {\n\t\t\t\t\tconst { name } = translations.find((item) => item.language === language) || {};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CarouselItem key={id}>\n\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\tonClick={() => handleSelectCategory(id)}\n\t\t\t\t\t\t\t\ttype={UIElementType.BORDERED_PRIMARY}\n\t\t\t\t\t\t\t\tactive={id === selectedCategoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={(el) => (categoryBlocksRef.current[id] = el)}>{name}</div>\n\t\t\t\t\t\t\t</Chip>\n\t\t\t\t\t\t</CarouselItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Carousel>\n\t\t</div>\n\t);\n};\nexport default Categories;\n","export const DEFAULT_CURRENCY = \"AZN\";\n","import { Column, Row } from \"@sorocraft/ui\";\nimport { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport styles from \"./ProductsListItem.module.scss\";\n\nimport * as productModels from \"src/models/product\";\n\nimport { DEFAULT_CURRENCY } from \"../PublicMenu.constants\";\n\ninterface Props {\n\tproduct: productModels.Product;\n\tcurrency: string;\n\tlanguage: string;\n}\n\nconst ProductsListItem = ({ product, currency, language }: Props) => {\n\tconst { translations, price, imageUrl } = product || {};\n\tconst { name, description } = translations.find((item) => item.language === language) || {};\n\tconst formattedPrice = priceFormatter(price, currency || DEFAULT_CURRENCY, language);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Row justifyContent=\"space-between\">\n\t\t\t\t<div className={styles.data}>\n\t\t\t\t\t<Column gap={0.5}>\n\t\t\t\t\t\t<h3 className={styles.name}>{name}</h3>\n\t\t\t\t\t\t<div className={styles.description}>{description}</div>\n\t\t\t\t\t\t<div className={styles.price}>{formattedPrice}</div>\n\t\t\t\t\t</Column>\n\t\t\t\t</div>\n\t\t\t\t{imageUrl && <img src={imageUrl} alt={name} className={styles.image} />}\n\t\t\t</Row>\n\t\t</div>\n\t);\n};\nexport default ProductsListItem;\n","import { RefObject, useEffect } from \"react\";\nimport { Column, DivElementMap } from \"@sorocraft/ui\";\nimport { groupBy } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Products.module.scss\";\n\nimport * as productModels from \"src/models/product\";\nimport * as categoryModels from \"src/models/category\";\nimport * as categoryUtils from \"src/utils/category\";\n\nimport ProductsListItem from \"../ProductsListItem\";\n\ninterface Props {\n\tproducts: productModels.Product[];\n\tcategories: categoryModels.Category[];\n\tproductBlocksRef: RefObject<DivElementMap>;\n\tcurrency: string;\n\tlanguage: string;\n\tonCategoryInView: (categoryId: number) => void;\n}\n\nconst Products = ({\n\tproducts,\n\tcategories,\n\tcurrency,\n\tlanguage,\n\tproductBlocksRef,\n\tonCategoryInView,\n}: Props) => {\n\t// const [layout, setLayout] = useState<\"list\" | \"grid\">(\"list\");\n\n\tconst groupedProducts = groupBy(products, \"categoryId\");\n\n\tuseEffect(() => {\n\t\tconst observer = new IntersectionObserver(\n\t\t\t(entries) => {\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tif (entry.isIntersecting) {\n\t\t\t\t\t\tconst categoryId = Number(entry.target.getAttribute(\"data-category-id\"));\n\t\t\t\t\t\tonCategoryInView(categoryId); // Notify the parent when a category is in view\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\t{\n\t\t\t\troot: null, // Use the viewport as the container\n\t\t\t\tthreshold: 0.5, // Trigger when 50% of the product block is in view\n\t\t\t}\n\t\t);\n\n\t\tObject.values(productBlocksRef?.current || {}).forEach((block) => {\n\t\t\tif (block) {\n\t\t\t\tobserver.observe(block);\n\t\t\t}\n\t\t});\n\n\t\treturn () => {\n\t\t\tobserver.disconnect(); // Clean up the observer on component unmount\n\t\t};\n\t}, [productBlocksRef, onCategoryInView]);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t{/* <div className={styles.header}>\n\t\t\t\t<Row>\n\t\t\t\t\t<IconButton icon={List} onClick={() => setLayout(\"list\")} isActive={layout === \"list\"} />\n\t\t\t\t\t<IconButton icon={Grid} onClick={() => setLayout(\"grid\")} isActive={layout === \"grid\"} />\n\t\t\t\t</Row>\n\t\t\t</div> */}\n\t\t\t<Column>\n\t\t\t\t{Object.keys(groupedProducts).map((categoryId) => {\n\t\t\t\t\tconst category = (categories.find(({ id }) => id === Number(categoryId)) ||\n\t\t\t\t\t\t{}) as categoryModels.Category;\n\t\t\t\t\tconst { name } = categoryUtils.getCategoryTranslation(category, language);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={styles.products}\n\t\t\t\t\t\t\tkey={categoryId}\n\t\t\t\t\t\t\tref={(el) => (productBlocksRef!.current![category.id] = el)}\n\t\t\t\t\t\t\tdata-category-id={categoryId}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<h2 className={styles.category}>{name}</h2>\n\t\t\t\t\t\t\t<div className={styles.list}>\n\t\t\t\t\t\t\t\t<Column gap={2}>\n\t\t\t\t\t\t\t\t\t{groupedProducts[categoryId].map((product) => (\n\t\t\t\t\t\t\t\t\t\t<ProductsListItem\n\t\t\t\t\t\t\t\t\t\t\tproduct={product}\n\t\t\t\t\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\t\t\t\t\t\tkey={product.id}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Column>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Column>\n\t\t</div>\n\t);\n};\nexport default Products;\n","import { Category, CategoryTranslation } from \"src/models/category\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n","import { Card, Container, Flex } from \"@sorocraft/ui\";\n\nimport styles from \"./Branches.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranches: branchModels.Branch[];\n}\n\nconst Branches = ({ branches = [] }: Props) => {\n\treturn (\n\t\t<div className={styles.branches}>\n\t\t\t<Container className={styles.list}>\n\t\t\t\t{branches.map(({ id, name }) => (\n\t\t\t\t\t<a key={id} href=\"/\">\n\t\t\t\t\t\t<Card noBottomMargin>\n\t\t\t\t\t\t\t<Flex justifyContent=\"center\" alignItems=\"center\" fullHeight>\n\t\t\t\t\t\t\t\t<h2 className={styles.name}>{name}</h2>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</a>\n\t\t\t\t))}\n\t\t\t</Container>\n\t\t</div>\n\t);\n};\nexport default Branches;\n","import { DivElementMap } from \"@sorocraft/ui\";\nimport { useRef, useState } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as menuModels from \"src/models/menu\";\n\nimport Header from \"./Header\";\nimport Categories from \"./Categories\";\nimport Products from \"./Products\";\nimport Branches from \"./Branches\";\n\ninterface Props {\n\tdata: menuModels.PublicMenuData;\n}\n\nconst PublicMenu = ({ data }: Props) => {\n\tconst {\n\t\tname,\n\t\tcoverImage,\n\t\tlogoImage,\n\t\tbranches = [],\n\t\tbranchId,\n\t\tlanguage,\n\t\tcategories,\n\t\tproducts,\n\t\tcurrency,\n\t} = data || {};\n\n\tconst hasSingleBranch = branches.length <= 1;\n\tconst selectedBranch = branches.find((item) => item.id === Number(branchId));\n\tconst venueName = hasSingleBranch || !selectedBranch?.name ? name : selectedBranch?.name || \"\";\n\n\tconst [selectedCategoryId, setSelectedCategoryId] = useState<number>(categories?.[0]?.id);\n\tconst productBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToProductBlock = (categoryId: number) => {\n\t\tconst productBlock = productBlocksRef?.current?.[categoryId];\n\t\tif (!productBlock) return;\n\n\t\tproductBlock.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n\t};\n\n\tconst handleSelectCategory = (categoryId: number) => {\n\t\tsetSelectedCategoryId(categoryId);\n\n\t\tscrollToProductBlock(categoryId);\n\t};\n\n\tconst handleCategoryInView = (categoryId: number) => {\n\t\tif (categoryId !== selectedCategoryId) {\n\t\t\tsetSelectedCategoryId(categoryId);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Header\n\t\t\t\tbranch={selectedBranch}\n\t\t\t\tname={venueName}\n\t\t\t\tcoverImage={coverImage}\n\t\t\t\tlogoImage={logoImage}\n\t\t\t/>\n\t\t\t{!hasSingleBranch && !branchId ? (\n\t\t\t\t<Branches branches={branches} />\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Categories\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tselectedCategoryId={selectedCategoryId}\n\t\t\t\t\t\tonSelectCategory={handleSelectCategory}\n\t\t\t\t\t/>\n\t\t\t\t\t<Products\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tproducts={products}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tproductBlocksRef={productBlocksRef}\n\t\t\t\t\t\tonCategoryInView={handleCategoryInView}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default PublicMenu;\n"],"names":["Header","branch","coverImage","logoImage","name","defaultCover","defaultLogo","address","latitude","longitude","noBranch","isEmpty","coverImageSource","logoImageSource","googleMapLink","_jsxs","jsxs","className","styles","children","_jsx","jsx","src","alt","Column","fullWidth","fullHeight","alignItems","justifyContent","Row","gap","href","target","rel","SVGIcon","icon","MarkerPin","theme","IconLink","Wifi","size","shape","Phone","Whatsapp","Instagram","Telegram","Tiktok","Facebook","Categories","categories","language","selectedCategoryId","onSelectCategory","categoryBlocksRef","useRef","handleSelectCategory","id","categoryId","categoryBlock","_a","current","scrollIntoView","behavior","inline","scrollToCategoryBlock","Carousel","map","translations","find","item","CarouselItem","Chip","onClick","type","UIElementType","BORDERED_PRIMARY","active","ref","el","ProductsListItem","product","currency","price","imageUrl","description","formattedPrice","priceFormatter","container","data","image","Products","products","productBlocksRef","onCategoryInView","groupedProducts","groupBy","useEffect","observer","IntersectionObserver","entries","forEach","entry","isIntersecting","Number","getAttribute","root","threshold","Object","values","block","observe","disconnect","keys","category","_b","call","categoryUtils.getCategoryTranslation","list","Branches","branches","Container","Card","noBottomMargin","Flex","branchId","hasSingleBranch","length","selectedBranch","venueName","setSelectedCategoryId","useState","_Fragment","Fragment","productBlock","scrollToProductBlock"],"mappings":"4iBA0BA,MAAMA,EAAS,EACdC,SACAC,aACAC,YACAC,OACAC,eAAe,GACfC,cAAc,OAEd,MAAMC,QAAEA,EAAOC,SAAEA,EAAQC,UAAEA,GAAcR,GAAU,CAAA,EAC7CS,EAAWC,UAAQV,GAEnBW,EAAmBV,GAAcG,EACjCQ,EAAkBV,GAAaG,EAE/BQ,EAAgB,qCAAqCN,KAAYC,IAgCvE,OACCM,EAAAC,KAAA,MAAA,CAAKC,UAAWC,EAAgBC,SAAA,CAC/BC,EAAKC,IAAA,MAAA,CAAAC,IAAKV,EAAkBW,IAAKnB,EAAMa,UAAWC,IAClDH,EAAAA,KAAK,MAAA,CAAAE,UAAWC,YACdR,EAAWU,EAACC,KAbK,IACpBN,EAAAC,KAACQ,SAAM,CAACC,WAAS,EAACC,YAAU,EAACC,WAAW,SAASC,eAAe,SAC/DT,SAAA,CAAAC,MAAA,MAAA,CAAKE,IAAKT,EAAiBU,IAAKnB,EAAMa,UAAWC,IACjDE,EAAAA,IAAK,MAAA,CAAAH,UAAWC,WACfE,EAAIC,IAAA,KAAA,CAAAJ,UAAWC,EAAcC,SAAAf,UASD,IAAGgB,OAlCf,IAClBL,OAACc,EAAAA,IAAI,CAAAC,IAAK,EAACX,SAAA,CACVC,aAAKE,IA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O,GAAQ,CAAA,EAENqC,EAAkBN,EAASO,QAAU,EACrCC,EAAiBR,EAASnD,MAAMC,GAASA,EAAKb,KAAO+C,OAAOqB,KAC5DI,EAAYH,KAAoBE,aAAc,EAAdA,EAAgB3H,MAAOA,GAAO2H,aAAc,EAAdA,EAAgB3H,OAAQ,IAErF+C,EAAoB8E,GAAyBC,EAAQA,SAA0B,QAAjBvE,EAAAV,aAAU,EAAVA,EAAa,UAAI,IAAAU,OAAA,EAAAA,EAAAH,IAChFoC,EAAmBtC,SAAsB,CAAA,GAqB/C,OACCvC,cAAKE,UAAWC,EACfC,SAAA,CAAAC,EAAAC,IAACrB,EAAM,CACNC,OAAQ8H,EACR3H,KAAM4H,EACN9H,WAAYA,EACZC,UAAWA,IAEV0H,GAAoBD,EAGrB7G,EAAAC,KAAAmH,EAAAC,SAAA,CAAAjH,SAAA,CACCC,MAAC4B,EAAU,CACVC,WAAYA,EACZC,SAAUA,EACVC,mBAAoBA,EACpBC,iBA5ByBK,IAC7BwE,EAAsBxE,GARM,CAACA,UAC7B,MAAM4E,EAA2C,QAA5B1E,EAAAiC,aAAA,EAAAA,EAAkBhC,eAAU,IAAAD,OAAA,EAAAA,EAAAF,GAC5C4E,GAELA,EAAaxE,eAAe,CAAEC,SAAU,SAAU+C,MAAO,SAAU,EAMnEyB,CAAqB7E,EAAW,IA2B7BrC,EAAAA,IAACsE,EACA,CAAAzC,WAAYA,EACZ0C,SAAUA,EACVV,SAAUA,EACV/B,SAAUA,EACV0C,iBAAkBA,EAClBC,iBA9ByBpC,IACzBA,IAAeN,GAClB8E,EAAsBxE,EACtB,OAYCrC,EAAAA,IAACkG,EAAQ,CAACC,SAAUA,MAoBrB"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/PublicMenu/Header/Header.tsx","../src/components/PublicMenu/Categories.tsx","../src/components/PublicMenu/PublicMenu.constants.ts","../src/components/PublicMenu/ProductsListItem/ProductsListItem.tsx","../src/components/PublicMenu/Products/Products.tsx","../src/utils/category.ts","../src/components/PublicMenu/Branches/Branches.tsx","../src/components/PublicMenu/PublicMenu.tsx"],"sourcesContent":["import { Column, IconLink, Row, SVGIcon } from \"@sorocraft/ui\";\nimport {\n\tMarkerPin,\n\tPhone,\n\tWifi,\n\tInstagram,\n\tWhatsapp,\n\tTiktok,\n\tFacebook,\n\tTelegram,\n} from \"@sorocraft/ui/icons\";\nimport { isEmpty } from \"@sorocraft/js-utils\";\n\nimport styles from \"./Header.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\nimport * as menuModels from \"src/models/menu\";\n\ninterface Props\n\textends Pick<\n\t\tmenuModels.PublicMenuData,\n\t\t| \"coverImage\"\n\t\t| \"logoImage\"\n\t\t| \"name\"\n\t\t| \"instagram\"\n\t\t| \"facebook\"\n\t\t| \"whatsapp\"\n\t\t| \"telegram\"\n\t\t| \"tiktok\"\n\t> {\n\tbranch?: branchModels.Branch;\n}\n\nconst Header = ({\n\tbranch,\n\tcoverImage,\n\tlogoImage,\n\tname,\n\tinstagram,\n\tfacebook,\n\twhatsapp,\n\ttelegram,\n\ttiktok,\n}: Props) => {\n\tconst { address, latitude, longitude, phone } = branch || {};\n\tconst noBranch = isEmpty(branch);\n\n\tconst googleMapLink = `https://www.google.com/maps/place/${latitude},${longitude}`;\n\n\t// const languageOptions = useMemo(\n\t// \t() =>\n\t// \t\t[\"az\", \"en\"].map((language) => ({\n\t// \t\t\tvalue: language,\n\t// \t\t\tlabel: language,\n\t// \t\t})),\n\t// \t[]\n\t// );\n\n\tconst BranchInfo = () => (\n\t\t<Row gap={1}>\n\t\t\t<img src={logoImage} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\n\t\t\t\t<a\n\t\t\t\t\tclassName={styles.address}\n\t\t\t\t\thref={googleMapLink}\n\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t>\n\t\t\t\t\t<Row alignItems=\"center\" gap={0.5}>\n\t\t\t\t\t\t<SVGIcon icon={MarkerPin} theme=\"dark\" />\n\t\t\t\t\t\t<span>{address}</span>\n\t\t\t\t\t</Row>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t</Row>\n\t);\n\n\tconst BusinessInfo = () => (\n\t\t<Column fullWidth fullHeight alignItems=\"center\" justifyContent=\"center\">\n\t\t\t<img src={logoImage} alt={name} className={styles.logo} />\n\t\t\t<div className={styles.info}>\n\t\t\t\t<h1 className={styles.name}>{name}</h1>\n\t\t\t</div>\n\t\t</Column>\n\t);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<img src={coverImage} alt={name} className={styles.cover} />\n\t\t\t<div className={styles.content}>{noBranch ? <BusinessInfo /> : <BranchInfo />}</div>\n\t\t\t{!noBranch && (\n\t\t\t\t<div className={styles.social}>\n\t\t\t\t\t<div className={styles.links}>\n\t\t\t\t\t\t<Row gap={2}>\n\t\t\t\t\t\t\t<Row alignItems=\"center\" justifyContent=\"center\" gap={0.5}>\n\t\t\t\t\t\t\t\t{phone && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Phone}\n\t\t\t\t\t\t\t\t\t\thref={`tel:+${phone}`}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{whatsapp && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Whatsapp}\n\t\t\t\t\t\t\t\t\t\thref={`https://wa.me/${whatsapp}`}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{instagram && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Instagram}\n\t\t\t\t\t\t\t\t\t\thref={instagram}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{telegram && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Telegram}\n\t\t\t\t\t\t\t\t\t\thref={telegram}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{tiktok && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Tiktok}\n\t\t\t\t\t\t\t\t\t\thref={tiktok}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{facebook && (\n\t\t\t\t\t\t\t\t\t<IconLink\n\t\t\t\t\t\t\t\t\t\ticon={Facebook}\n\t\t\t\t\t\t\t\t\t\thref={facebook}\n\t\t\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t\t\tshape=\"circle\"\n\t\t\t\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Row>\n\t\t\t\t\t\t\t<Row>\n\t\t\t\t\t\t\t\t<SVGIcon icon={Wifi} size=\"sm\" />\n\t\t\t\t\t\t\t</Row>\n\t\t\t\t\t\t</Row>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default Header;\n","import { Carousel, CarouselItem, Chip, DivElementMap, UIElementType } from \"@sorocraft/ui\";\nimport { useRef } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as categoryModels from \"src/models/category\";\n\ninterface Props {\n\tcategories: categoryModels.Category[];\n\tlanguage: string;\n\tselectedCategoryId: number;\n\tonSelectCategory: (id: number) => void;\n}\n\nconst Categories = ({ categories, language, selectedCategoryId, onSelectCategory }: Props) => {\n\tconst categoryBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToCategoryBlock = (categoryId: number) => {\n\t\tconst categoryBlock = categoryBlocksRef?.current?.[categoryId];\n\t\tif (!categoryBlock) return;\n\n\t\tcategoryBlock.scrollIntoView({ behavior: \"smooth\", inline: \"center\" });\n\t};\n\n\tconst handleSelectCategory = (id: number) => {\n\t\tscrollToCategoryBlock(id);\n\t\tonSelectCategory(id);\n\t};\n\n\treturn (\n\t\t<div className={styles.categories}>\n\t\t\t<Carousel gap={1}>\n\t\t\t\t{categories.map(({ id, translations }) => {\n\t\t\t\t\tconst { name } = translations.find((item) => item.language === language) || {};\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<CarouselItem key={id}>\n\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\tonClick={() => handleSelectCategory(id)}\n\t\t\t\t\t\t\t\ttype={UIElementType.BORDERED_PRIMARY}\n\t\t\t\t\t\t\t\tactive={id === selectedCategoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div ref={(el) => (categoryBlocksRef.current[id] = el)}>{name}</div>\n\t\t\t\t\t\t\t</Chip>\n\t\t\t\t\t\t</CarouselItem>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Carousel>\n\t\t</div>\n\t);\n};\nexport default Categories;\n","export const DEFAULT_CURRENCY = \"AZN\";\n","import { Column, Row } from \"@sorocraft/ui\";\nimport { priceFormatter } from \"@sorocraft/js-utils\";\n\nimport styles from \"./ProductsListItem.module.scss\";\n\nimport * as productModels from \"src/models/product\";\n\nimport { DEFAULT_CURRENCY } from \"../PublicMenu.constants\";\n\ninterface Props {\n\tproduct: productModels.Product;\n\tcurrency: string;\n\tlanguage: string;\n}\n\nconst ProductsListItem = ({ product, currency, language }: Props) => {\n\tconst { translations, price, imageUrl } = product || {};\n\tconst { name, description } = translations.find((item) => item.language === language) || {};\n\tconst formattedPrice = priceFormatter(price, currency || DEFAULT_CURRENCY, language);\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Row justifyContent=\"space-between\">\n\t\t\t\t<div className={styles.data}>\n\t\t\t\t\t<Column gap={0.5}>\n\t\t\t\t\t\t<h3 className={styles.name}>{name}</h3>\n\t\t\t\t\t\t<div className={styles.description}>{description}</div>\n\t\t\t\t\t\t<div className={styles.price}>{formattedPrice}</div>\n\t\t\t\t\t</Column>\n\t\t\t\t</div>\n\t\t\t\t{imageUrl && <img src={imageUrl} alt={name} className={styles.image} />}\n\t\t\t</Row>\n\t\t</div>\n\t);\n};\nexport default ProductsListItem;\n","import { RefObject, useEffect, memo, useCallback } from \"react\";\nimport { Column, DivElementMap } from \"@sorocraft/ui\";\nimport { groupBy } from \"@sorocraft/js-utils\";\nimport styles from \"./Products.module.scss\";\nimport * as productModels from \"src/models/product\";\nimport * as categoryModels from \"src/models/category\";\nimport * as categoryUtils from \"src/utils/category\";\nimport ProductsListItem from \"../ProductsListItem\";\n\ninterface Props {\n\tproducts: productModels.Product[];\n\tcategories: categoryModels.Category[];\n\tproductBlocksRef: RefObject<DivElementMap>;\n\tcurrency: string;\n\tlanguage: string;\n\tonCategoryInView: (categoryId: number) => void;\n}\n\nconst Products = memo(\n\t({ products, categories, currency, language, productBlocksRef, onCategoryInView }: Props) => {\n\t\tconst groupedProducts = groupBy(products, \"categoryId\");\n\n\t\tconst handleIntersection = useCallback(\n\t\t\t(entries: IntersectionObserverEntry[]) => {\n\t\t\t\tlet bestMatchCategoryId: number | null = null;\n\t\t\t\tlet maxVisibility = 0;\n\n\t\t\t\tentries.forEach((entry) => {\n\t\t\t\t\tconst categoryId = Number(entry.target.getAttribute(\"data-category-id\"));\n\t\t\t\t\tconst visiblePercentage = entry.intersectionRatio;\n\n\t\t\t\t\t// Track the category block that has the highest visible percentage\n\t\t\t\t\tif (visiblePercentage > maxVisibility) {\n\t\t\t\t\t\tmaxVisibility = visiblePercentage;\n\t\t\t\t\t\tbestMatchCategoryId = categoryId;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t// Only update if the best matching category is different from the currently selected one\n\t\t\t\tif (bestMatchCategoryId) {\n\t\t\t\t\tonCategoryInView(bestMatchCategoryId);\n\t\t\t\t}\n\t\t\t},\n\t\t\t[onCategoryInView]\n\t\t);\n\n\t\tuseEffect(() => {\n\t\t\tconst observer = new IntersectionObserver(handleIntersection, {\n\t\t\t\troot: null,\n\t\t\t\tthreshold: [0.1, 0.5, 0.75], // Different levels of visibility\n\t\t\t});\n\n\t\t\tObject.values(productBlocksRef?.current || {}).forEach((block) => {\n\t\t\t\tif (block) {\n\t\t\t\t\tobserver.observe(block);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\treturn () => {\n\t\t\t\tobserver.disconnect();\n\t\t\t};\n\t\t}, [productBlocksRef, handleIntersection]);\n\n\t\treturn (\n\t\t\t<div className={styles.container}>\n\t\t\t\t<Column>\n\t\t\t\t\t{Object.keys(groupedProducts).map((categoryId) => {\n\t\t\t\t\t\tconst category = (categories.find(({ id }) => id === Number(categoryId)) ||\n\t\t\t\t\t\t\t{}) as categoryModels.Category;\n\t\t\t\t\t\tconst { name } = categoryUtils.getCategoryTranslation(category, language);\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName={styles.products}\n\t\t\t\t\t\t\t\tkey={categoryId}\n\t\t\t\t\t\t\t\tref={(el) => (productBlocksRef!.current![category.id] = el)}\n\t\t\t\t\t\t\t\tdata-category-id={categoryId}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<h2 className={styles.category}>{name}</h2>\n\t\t\t\t\t\t\t\t<div className={styles.list}>\n\t\t\t\t\t\t\t\t\t<Column gap={2}>\n\t\t\t\t\t\t\t\t\t\t{groupedProducts[categoryId].map((product) => (\n\t\t\t\t\t\t\t\t\t\t\t<ProductsListItem\n\t\t\t\t\t\t\t\t\t\t\t\tproduct={product}\n\t\t\t\t\t\t\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\t\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\t\t\t\t\t\t\tkey={product.id}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</Column>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t})}\n\t\t\t\t</Column>\n\t\t\t</div>\n\t\t);\n\t},\n\t(prevProps, nextProps) => {\n\t\treturn (\n\t\t\tprevProps.products === nextProps.products &&\n\t\t\tprevProps.categories === nextProps.categories &&\n\t\t\tprevProps.currency === nextProps.currency &&\n\t\t\tprevProps.language === nextProps.language\n\t\t);\n\t}\n);\n\nexport default Products;\n","import { Category, CategoryTranslation } from \"src/models/category\";\n\nexport const getCategoryTranslation = (\n\tcategory: Category,\n\tlanguage: string\n): CategoryTranslation => {\n\treturn (category?.translations?.find?.((item) => item.language === language) ||\n\t\t{}) as CategoryTranslation;\n};\n","import { Card, Container, Flex } from \"@sorocraft/ui\";\n\nimport styles from \"./Branches.module.scss\";\n\nimport * as branchModels from \"src/models/branch\";\n\ninterface Props {\n\tbranches: branchModels.Branch[];\n}\n\nconst Branches = ({ branches = [] }: Props) => {\n\treturn (\n\t\t<div className={styles.branches}>\n\t\t\t<Container className={styles.list}>\n\t\t\t\t{branches.map(({ id, name }) => (\n\t\t\t\t\t<a key={id} href=\"/\">\n\t\t\t\t\t\t<Card noBottomMargin>\n\t\t\t\t\t\t\t<Flex justifyContent=\"center\" alignItems=\"center\" fullHeight>\n\t\t\t\t\t\t\t\t<h2 className={styles.name}>{name}</h2>\n\t\t\t\t\t\t\t</Flex>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</a>\n\t\t\t\t))}\n\t\t\t</Container>\n\t\t</div>\n\t);\n};\nexport default Branches;\n","import { DivElementMap } from \"@sorocraft/ui\";\nimport { useRef, useState } from \"react\";\n\nimport styles from \"./PublicMenu.module.scss\";\n\nimport * as menuModels from \"src/models/menu\";\n\nimport Header from \"./Header\";\nimport Categories from \"./Categories\";\nimport Products from \"./Products\";\nimport Branches from \"./Branches\";\n\ninterface Props {\n\tdata: menuModels.PublicMenuData;\n}\n\nconst PublicMenu = ({ data }: Props) => {\n\tconst {\n\t\tname,\n\t\tcoverImage,\n\t\tlogoImage,\n\t\tbranches = [],\n\t\tbranchId,\n\t\tlanguage,\n\t\tcategories,\n\t\tproducts,\n\t\tcurrency,\n\t\tdefaultCover = \"\",\n\t\tdefaultLogo = \"\",\n\t\tinstagram,\n\t\tfacebook,\n\t\twhatsapp,\n\t\ttelegram,\n\t\ttiktok,\n\t} = data || {};\n\n\tconst hasSingleBranch = branches.length <= 1;\n\tconst selectedBranch = branches.find((item) => item.id === Number(branchId));\n\tconst venueName = hasSingleBranch || !selectedBranch?.name ? name : selectedBranch?.name || \"\";\n\n\tconst coverImageSource = coverImage || defaultCover;\n\tconst logoImageSource = logoImage || defaultLogo;\n\n\tconst [selectedCategoryId, setSelectedCategoryId] = useState<number>(categories?.[0]?.id);\n\tconst productBlocksRef = useRef<DivElementMap>({});\n\n\tconst scrollToProductBlock = (categoryId: number) => {\n\t\tconst productBlock = productBlocksRef?.current?.[categoryId];\n\t\tif (!productBlock) return;\n\n\t\tproductBlock.scrollIntoView({ behavior: \"smooth\", block: \"start\" });\n\t};\n\n\tconst handleSelectCategory = (categoryId: number) => {\n\t\tsetSelectedCategoryId(categoryId);\n\n\t\tscrollToProductBlock(categoryId);\n\t};\n\n\tconst handleCategoryInView = (categoryId: number) => {\n\t\tif (categoryId !== selectedCategoryId) {\n\t\t\tsetSelectedCategoryId(categoryId);\n\t\t}\n\t};\n\n\treturn (\n\t\t<div className={styles.container}>\n\t\t\t<Header\n\t\t\t\tbranch={selectedBranch}\n\t\t\t\tname={venueName}\n\t\t\t\tcoverImage={coverImageSource}\n\t\t\t\tlogoImage={logoImageSource}\n\t\t\t\tinstagram={instagram}\n\t\t\t\tfacebook={facebook}\n\t\t\t\twhatsapp={whatsapp}\n\t\t\t\ttelegram={telegram}\n\t\t\t\ttiktok={tiktok}\n\t\t\t/>\n\t\t\t{!hasSingleBranch && !branchId ? (\n\t\t\t\t<Branches branches={branches} />\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<Categories\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tselectedCategoryId={selectedCategoryId}\n\t\t\t\t\t\tonSelectCategory={handleSelectCategory}\n\t\t\t\t\t/>\n\t\t\t\t\t<Products\n\t\t\t\t\t\tcategories={categories}\n\t\t\t\t\t\tproducts={products}\n\t\t\t\t\t\tcurrency={currency}\n\t\t\t\t\t\tlanguage={language}\n\t\t\t\t\t\tproductBlocksRef={productBlocksRef}\n\t\t\t\t\t\tonCategoryInView={handleCategoryInView}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\nexport default PublicMenu;\n"],"names":["Header","branch","coverImage","logoImage","name","instagram","facebook","whatsapp","telegram","tiktok","address","latitude","longitude","phone","noBranch","isEmpty","googleMapLink","_jsxs","jsxs","className","styles","children","_jsx","src","alt","jsx","Column","fullWidth","fullHeight","alignItems","justifyContent","Row","gap","href","target","rel","SVGIcon","icon","MarkerPin","theme","IconLink","Phone","size","shape","Whatsapp","Instagram","Telegram","Tiktok","Facebook","Wifi","Categories","categories","language","selectedCategoryId","onSelectCategory","categoryBlocksRef","useRef","handleSelectCategory","id","categoryId","categoryBlock","_a","current","scrollIntoView","behavior","inline","scrollToCategoryBlock","Carousel","map","translations","find","item","CarouselItem","Chip","onClick","type","UIElementType","BORDERED_PRIMARY","active","ref","el","ProductsListItem","product","currency","price","imageUrl","description","formattedPrice","priceFormatter","container","data","image","Products","memo","products","productBlocksRef","onCategoryInView","groupedProducts","groupBy","handleIntersection","useCallback","entries","bestMatchCategoryId","maxVisibility","forEach","entry","Number","getAttribute","visiblePercentage","intersectionRatio","useEffect","observer","IntersectionObserver","root","threshold","Object","values","block","observe","disconnect","keys","category","_b","call","categoryUtils.getCategoryTranslation","list","prevProps","nextProps","Branches","branches","Container","Card","noBottomMargin","Flex","branchId","defaultCover","defaultLogo","hasSingleBranch","length","selectedBranch","venueName","coverImageSource","logoImageSource","setSelectedCategoryId","useState","_Fragment","productBlock","scrollToProductBlock"],"mappings":"4gBAiCA,MAAMA,EAAS,EACdC,SACAC,aACAC,YACAC,OACAC,YACAC,WACAC,WACAC,WACAC,aAEA,MAAMC,QAAEA,EAAOC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,GAAUZ,GAAU,GACpDa,EAAWC,UAAQd,GAEnBe,EAAgB,qCAAqCL,KAAYC,IAyCvE,OACCK,EAAAC,KAAA,MAAA,CAAKC,UAAWC,EACfC,SAAA,CAAAC,MAAA,MAAA,CAAKC,IAAKrB,EAAYsB,IAAKpB,EAAMe,UAAWC,IAC5CE,MAAK,MAAA,CAAAH,UAAWC,EAAcC,SAA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,EAAAA,KAAK,MAAA,CAAAE,UAAWC,EACfC,SAAA,CAAAC,EAAAA,IAACtB,EAAM,CACNC,OAAQ0I,EACRvI,KAAMwI,EACN1I,WAAY2I,EACZ1I,UAAW2I,EACXzI,UAAWA,EACXC,SAAUA,EACVC,SAAUA,EACVC,SAAUA,EACVC,OAAQA,IAEPgI,GAAoBH,EAGrBrH,EACCC,KAAA+H,WAAA,CAAA5H,SAAA,CAAAC,EAAAA,IAAC4B,EAAU,CACVC,WAAYA,EACZC,SAAUA,EACVC,mBAAoBA,EACpBC,iBAjCyBK,IAC7BoF,EAAsBpF,GARM,CAACA,UAC7B,MAAMuF,EAA2C,QAA5BrF,EAAAkC,aAAA,EAAAA,EAAkBjC,eAAU,IAAAD,OAAA,EAAAA,EAAAF,GAC5CuF,GAELA,EAAanF,eAAe,CAAEC,SAAU,SAAUqD,MAAO,SAAU,EAMnE8B,CAAqBxF,EAAW,IAgC7BrC,EAAAG,IAACmE,EAAQ,CACRzC,WAAYA,EACZ2C,SAAUA,EACVX,SAAUA,EACV/B,SAAUA,EACV2C,iBAAkBA,EAClBC,iBAnCyBrC,IACzBA,IAAeN,GAClB0F,EAAsBpF,EACtB,OAiBCrC,EAAAG,IAACuG,EAAQ,CAACC,SAAUA,MAoBrB"}
|
package/dist/models/menu.d.ts
CHANGED
|
@@ -11,4 +11,11 @@ export interface PublicMenuData {
|
|
|
11
11
|
products: productModels.Product[];
|
|
12
12
|
categories: categoryModels.Category[];
|
|
13
13
|
language: string;
|
|
14
|
+
defaultCover: string;
|
|
15
|
+
defaultLogo: string;
|
|
16
|
+
instagram?: string;
|
|
17
|
+
facebook?: string;
|
|
18
|
+
whatsapp?: string;
|
|
19
|
+
telegram?: string;
|
|
20
|
+
tiktok?: string;
|
|
14
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function throttle(callback: (...args: any[]) => void, delay: number): (...args: any[]) => void;
|