Compare commits

..

3 Commits

Author SHA1 Message Date
karyamanswasta
3fbe0bb870 ok 2025-08-27 07:41:31 +07:00
karyamanswasta
dae7fb9221 ok 2025-08-27 07:12:39 +07:00
karyamanswasta
6ed982d6ef ok 2025-08-27 07:00:14 +07:00
14 changed files with 338 additions and 171 deletions

View File

@@ -36,7 +36,7 @@ body {
height: 100%;
width: 100%;
background-image: url(https://i.ibb.co.com/F4FMw1jz/testuseonly.png);
z-index: 1000;
z-index: 0; /* align with item lister */
filter: opacity(0.04);
pointer-events: none;
}
@@ -67,15 +67,136 @@ body {
/* Ensure sticky cart bar stays above item overlays */
.StickyCartBar {
z-index: 100 !important; /* Menurunkan z-index agar tidak menutupi material list */
z-index: 120 !important; /* above content, below modal */
position: fixed;
bottom: 0;
left: 0;
right: 0;
background-color: white;
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
padding: 15px 20px;
border-radius: 20px 20px 0 0;
bottom: 24px;
background: transparent;
box-shadow: none;
pointer-events: none; /* only children capture clicks */
display: flex;
justify-content: center;
align-items: center;
padding: 0 12px;
}
/* Intro slide/fade when bar first appears */
.StickyCartBar.intro { animation: bar-in 450ms ease-out; }
@keyframes bar-in {
0% { opacity: 0; transform: translateY(12px); }
100% { opacity: 1; transform: translateY(0); }
}
/* Floating cart buttons inside sticky bar */
.StickyCartBar .cartBtn {
pointer-events: auto;
display: flex;
align-items: center;
justify-content: space-between;
height: 44px;
padding: 0 14px;
border-radius: 999px;
border: none;
background: rgba(115,165,133,0.96);
color: #fff;
backdrop-filter: blur(3px);
box-shadow: 0 12px 28px rgba(115,165,133,0.35);
width: clamp(200px, 60vw, 420px);
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
position: relative;
}
.StickyCartBar .cartBtn:hover { box-shadow: 0 14px 32px rgba(115,165,133,0.4); transform: translateY(-1px); }
.StickyCartBar .cartBtn:active { transform: translateY(0); }
.StickyCartBar .cartBtn:focus-visible { outline: 3px solid rgba(115,165,133,0.4); outline-offset: 2px; }
/* Bump + ping animation when items are added */
.StickyCartBar .cartBtn.bump { animation: cart-bump 300ms ease; }
.StickyCartBar .cartBtn.bump::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
box-shadow: 0 0 0 0 rgba(115,165,133,0.35);
animation: cart-ping 600ms ease-out;
}
@keyframes cart-bump {
0% { transform: scale(1); }
10% { transform: scale(0.98); }
30% { transform: scale(1.04); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
@keyframes cart-ping {
0% { box-shadow: 0 0 0 0 rgba(115,165,133,0.35); }
100% { box-shadow: 0 0 0 14px rgba(115,165,133,0); }
}
.StickyCartBar .historyBtn {
pointer-events: auto;
display: flex;
align-items: center;
justify-content: center;
width: 48px;
height: 44px;
margin-left: 8px;
border-radius: 999px;
border: none;
background: rgba(115,165,133,0.96);
color: #fff;
backdrop-filter: blur(3px);
box-shadow: 0 12px 28px rgba(115,165,133,0.35);
transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.StickyCartBar .historyBtn:hover { box-shadow: 0 14px 32px rgba(115,165,133,0.4); transform: translateY(-1px); }
.StickyCartBar .historyBtn:active { transform: translateY(0); }
.StickyCartBar .historyBtn:focus-visible { outline: 3px solid rgba(115,165,133,0.4); outline-offset: 2px; }
/* Subtle pulse to draw attention on new transaction */
.StickyCartBar .historyBtn.pulse { animation: btn-pulse 900ms ease-out; }
@keyframes btn-pulse {
0% { box-shadow: 0 12px 28px rgba(115,165,133,0.35); }
60% { box-shadow: 0 18px 38px rgba(115,165,133,0.5); }
100% { box-shadow: 0 12px 28px rgba(115,165,133,0.35); }
}
.StickyCartBar .summary {
display: flex;
align-items: center;
gap: 8px;
font-weight: 700;
}
.StickyCartBar .value { white-space: nowrap; font-weight: 800; }
.StickyCartBar .icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 8px; }
.StickyCartBar .icon { position: relative; }
.StickyCartBar .icon .badge {
position: absolute;
top: -6px;
right: -6px;
width: 18px;
height: 18px;
border-radius: 50%;
background: #ff6b6b;
color: #fff;
font-size: 11px;
font-weight: 800;
line-height: 18px;
text-align: center;
padding: 0;
box-shadow: 0 2px 6px rgba(255,107,107,0.35);
}
.StickyCartBar .icon .badge.pop { animation: badge-pop 280ms ease-out; }
@keyframes badge-pop {
0% { transform: scale(0.8); }
50% { transform: scale(1.2); }
100% { transform: scale(1); }
}
@media (max-width: 420px) {
.StickyCartBar { bottom: 16px; }
.StickyCartBar .cartBtn { height: 46px; }
.StickyCartBar .historyBtn { height: 46px; width: 48px; }
}
.App-link {
@@ -100,4 +221,4 @@ body {
to {
transform: rotate(360deg);
}
}
}

View File

@@ -23,7 +23,7 @@ const HeaderBar = styled.div`
padding: 12px 14px;
color: black;
background-color: #ffffff;
z-index: 200;
z-index: ${(props) => (props.zIndexLevel !== undefined ? props.zIndexLevel : 200)};
border: 1px solid #00000000;
margin: 20px 12px;
border-radius: 13px;
@@ -148,7 +148,7 @@ const Rectangle = styled.div`
width: 240px;
max-height: 75vh;
background-color: white;
z-index: 198;
z-index: ${(props) => (props.baseZIndex !== undefined ? props.baseZIndex : 198)};
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
border: 1px solid #f0f0f0;
border-radius: 12px;
@@ -276,7 +276,9 @@ const Header = ({
removeConnectedGuestSides,
setIsEditMode,
isEditMode,
HeaderMargin = '25px'
HeaderMargin = '25px',
zIndexLevel,
rectZIndex
}) => {
const { goToLogin, goToGuestSideLogin, goToAdminCafes } =
useNavigationHelpers(shopId, tableCode);
@@ -354,7 +356,7 @@ const Header = ({
};
return (
<HeaderBarbackground shopName={shopName}>
<HeaderBar HeaderMargin={HeaderMargin} shopName={shopName}>
<HeaderBar HeaderMargin={HeaderMargin} shopName={shopName} zIndexLevel={zIndexLevel}>
<LeftGroup>
<CafeAvatar
src={shopImage && !shopImage.includes('undefined') ? shopImage : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-DjX_bGBax4NL14ULvkAdU4FP3FKoWXWu5w&s"}
@@ -378,7 +380,7 @@ const Header = ({
<HamburgerIcon />
</HamburgerButton>
{showRectangle && (
<Rectangle ref={rectangleRef} animate={animate}>
<Rectangle ref={rectangleRef} animate={animate} baseZIndex={rectZIndex !== undefined ? rectZIndex : zIndexLevel}>
<ChildContainer>
{guestSideOfClerk && guestSideOfClerk.clerkUsername && (
<Child hasChildren>

View File

@@ -5,6 +5,7 @@ const Item = ({
forCart,
forInvoice,
portrait,
hideDetails,
name: initialName,
description: initialDescription,
price: initialPrice,
@@ -147,75 +148,14 @@ const Item = ({
)}
</div>
)}
<div className={styles.itemDetails}>
{forInvoice &&
<div className={styles.plusNegative2} onClick={onRemoveClick}>
</div>
}
{/* Title under image for portrait, non-overlay */}
{portrait && null}
{!portrait && (
<div style={{ marginRight: forInvoice ? 10 : 0 }}>
<h3 className={styles.title} style={{ width: forInvoice ? 160 : 'auto' }}>{displayName}</h3>
{initialDescription && !forInvoice && (
<p className={styles.desc}>{initialDescription}</p>
)}
{!forInvoice && (
<div className={styles.priceRow}>
{promoPrice && promoPrice != 0 && promoPrice != '' ? (
<>
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
<span className={`${styles.itemPriceList} ${styles.promo}`}>Rp {formatCurrency(promoPrice)}</span>
<span className={`${styles.itemPriceList} ${styles.original}`}>Rp {formatCurrency(initialPrice)}</span>
</div>
</>
) : (
<span className={styles.itemPriceList}>Rp {formatCurrency(initialPrice)}</span>
)}
</div>
)}
</div>
)}
{forInvoice && (
<>
<p className={styles.multiplySymbol}>x</p>
<p className={styles.qtyInvoice}>{itemQty}</p>
</>
)}
{!forInvoice && (
portrait ? (
(blank || isBeingEdit) ? (
<div className={styles.itemQty}>
<button className={styles.addButton} style={{ backgroundColor: '#ffffff', color: 'var(--brand-sage, #6B8F71)', borderColor: 'var(--brand-sage, #6B8F71)', minWidth: 90, height: 36, fontSize: 14 }} onClick={isBeingEdit ? handleUpdate : handleCreate}>
{isBeingEdit ? 'Simpan' : 'Buat'}
</button>
</div>
) : null
) : (
!isBeingEdit ? (
<div className={styles.itemQty}>
<div className={styles.qtyGroup}>
<button className={styles.qtyBtn} onClick={handleNegativeClick} aria-label="Kurangi" style={{ width: 36, height: 36, fontSize: 18 }}>-</button>
<span className={styles.qtyVal}>{itemQty}</span>
<button className={styles.qtyBtn} onClick={handlePlusClick} aria-label="Tambah" style={{ width: 36, height: 36, fontSize: 18 }}>+</button>
</div>
</div>
) : (
<div className={styles.itemQty}>
<button className={styles.addButton} style={{ backgroundColor: '#ffffff', color: 'var(--brand-sage, #6B8F71)', borderColor: 'var(--brand-sage, #6B8F71)', width: 130, height: 36, fontSize: 14 }} onClick={isBeingEdit ? handleUpdate : handleCreate}>
{isBeingEdit ? 'Simpan' : 'Buat'}
</button>
</div>
)
)
)}
{forInvoice && (
{forInvoice && (
<div className={styles.itemDetails}>
<div className={styles.plusNegative2} onClick={onRemoveClick}></div>
<p className={styles.multiplySymbol}>x</p>
<p className={styles.qtyInvoice}>{itemQty}</p>
<p className={styles.itemPriceInvoice}>Rp {formatCurrency(itemQty * (promoPrice > 0 ? promoPrice : itemPrice))}</p>
)}
</div>
</div>
)}
{forCart && (
<div className={styles.remove} onClick={handleRemoveClick}>
@@ -227,4 +167,4 @@ const Item = ({
);
};
export default Item;
export default Item;

View File

@@ -20,10 +20,7 @@
position: relative;
}
.item:hover {
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
transform: translateY(-2px);
}
.item:hover { /* remove hover effect on list items */ }
/* Portrait variant for cafe page grid */
.itemPortrait {
@@ -726,10 +723,7 @@
transition: all 0.2s ease;
}
.item-card:hover {
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
transform: translateY(-2px);
}
.item-card:hover { /* no hover */ }
/* List variant */
.item-list-item {
@@ -743,6 +737,4 @@
transition: all 0.2s ease;
}
.item-list-item:hover {
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.item-list-item:hover { /* no hover */ }

View File

@@ -1,4 +1,5 @@
import React, { useState, useEffect, useRef } from "react";
import { createPortal } from "react-dom";
import styles from "./Modal.module.css";
import { getImageUrl } from "../helpers/itemHelper.js";
@@ -106,7 +107,7 @@ const ItemConfig = ({
}
};
return (
return createPortal(
<div onClick={handleOverlayClick} className={styles.modalOverlay}>
<div onClick={handleContentClick} className={styles.modalContent}>
<div className={styles.imageSection}>
@@ -208,7 +209,8 @@ const ItemConfig = ({
</div>
</div>
</div>
</div>
</div>,
document.body
);
};

View File

@@ -8,7 +8,7 @@
bottom: 0;
display: flex;
flex-direction: column-reverse;
z-index: 200;
z-index: 2147483600 !important; /* above watermark and page layers */
background-color: rgba(0, 0, 0, 0.38); /* #00000061 */
}
@@ -98,4 +98,4 @@
display: flex;
justify-content: center;
align-items: center;
}
}

View File

@@ -88,7 +88,7 @@ const ItemLister = ({
availability: true,
selectedImage: null,
}));
const displayItems = showGrid ? [...items, ...dummyItems] : items;
const displayItems = items; // no dummy items on cafe page
const handlePlusClick = (itemId) => {
const updatedItems = items.map((item) => {
@@ -913,7 +913,7 @@ const ItemLister = ({
cancelEdit={() => toggleAddNewItem()}
handleCreateItem={onCreateItem}
/>
<Item blank={true} handleCreateItem={onCreateItem} />
<Item blank={true} handleCreateItem={onCreateItem} hideDetails={!showGrid} />
</>
)}
</>
@@ -977,6 +977,7 @@ const ItemLister = ({
qty={item.qty}
imageUrl={item.image}
imageFile={item.selectedImage}
hideDetails={!showGrid}
onPlusClick={() => handlePlusClick(item.itemId)}
onNegativeClick={() => handleNegativeClick(item.itemId)}
onRemoveClick={() => handleRemoveClick(item.itemId)}
@@ -991,7 +992,7 @@ const ItemLister = ({
) : null;
})}
{(showGrid ? [...items, ...dummyItems] : items).map((item, indexx) => {
{items.map((item, indexx) => {
return !forCart || (forCart && item.qty > 0) ? (
<div
key={item.itemId}>
@@ -1061,10 +1062,11 @@ const ItemLister = ({
<Item
key={item.itemId}
last={index === indexTotal - 1 && indexx === (showGrid ? (items.length + dummyItems.length) : items.length) - 1}
last={index === indexTotal - 1 && indexx === items.length - 1}
forCart={forCart}
forInvoice={forInvoice}
portrait={showGrid}
hideDetails={!showGrid}
name={item.name}
price={item.price}
promoPrice={item.promoPrice}
@@ -1111,4 +1113,4 @@ const ItemLister = ({
);
};
export default ItemLister;
export default ItemLister;

View File

@@ -10,7 +10,7 @@
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
margin-bottom: 20px;
position: relative;
z-index: 150; /* Memastikan berada di bawah material list */
z-index: 0 !important; /* ensure behind modal overlay */
}
.fullscreen {
@@ -20,7 +20,7 @@
left: 0;
right: 0;
background-color: white;
z-index: 1000;
z-index: 100; /* keep above page, below modal overlays (>=200) */
overflow-y: auto;
}
@@ -97,7 +97,7 @@
margin-bottom: 20px;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
position: relative;
z-index: 151;
z-index: 0 !important; /* ensure behind modal overlay */
}
.titleActions {
@@ -120,7 +120,7 @@
transition: all 0.2s ease;
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
position: relative;
z-index: 152;
z-index: 0 !important; /* ensure behind modal overlay */
}
.iconBtn:disabled {
opacity: 0.5;
@@ -169,26 +169,50 @@
}
.add-item-button {
margin-top: 16px;
padding: 12px 20px;
font-size: 16px;
background-color: #359d42d1;
color: #fff;
margin: 0; /* follow parent gap for top/bottom spacing */
display: inline-block;
width: 275px; /* requested size */
height: 275px; /* requested size */
padding: 0; /* match image padding (none) */
border: none;
border-radius: 10px;
background: transparent; /* card drawn via ::before */
color: transparent; /* no visible text */
border-radius: 12px; /* match portrait image radius */
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 2px 6px rgba(53, 157, 66, 0.2);
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
transition: none;
box-shadow: none;
position: relative;
z-index: 151;
z-index: 1; /* behind modal overlay */
}
.add-item-button::before {
content: "";
position: absolute;
inset: 0; /* fill container */
border-radius: 12px; /* match portrait image radius */
background:
/* vertical bar */
linear-gradient(var(--brand-sage, #6B8F71), var(--brand-sage, #6B8F71)) center/5px 20% no-repeat,
/* horizontal bar */
linear-gradient(var(--brand-sage, #6B8F71), var(--brand-sage, #6B8F71)) center/20% 5px no-repeat,
/* base */
var(--brand-sage-50, #F0F6F2);
border: 2px dashed var(--brand-sage, #6B8F71);
box-shadow: 0 4px 12px rgba(0,0,0,0.10);
}
.add-item-button:focus-visible {
outline: 2px solid var(--brand-sage, #6B8F71);
outline-offset: 2px;
border-radius: 12px;
}
/* Overlay text inside the left tile area */
.add-item-button::after { content: none; }
.add-item-button:hover {
background-color: #2d8a39;
box-shadow: 0 4px 10px rgba(53, 157, 66, 0.3);
background-color: #ffffff;
box-shadow: none;
}
.item-list {
@@ -196,7 +220,20 @@
flex-direction: column;
gap: 16px;
position: relative;
z-index: 150;
z-index: 0 !important; /* ensure behind modal overlay */
}
/* Generic switch row styling reused in multiple spots */
.switch-container {
display: inline-flex;
align-items: center;
gap: 8px;
}
.switch-label {
font-size: 13px;
font-weight: 600;
color: #333;
}
/* Grid layout for portrait cards on cafe page */
@@ -234,33 +271,62 @@
position: relative;
z-index: 150;
}
.itemWrapper:hover {
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
transform: translateY(-2px);
}
.itemWrapper:hover { /* remove hover effect */ }
.editModeLayout {
border-radius: 12px 12px 0 0;
.editModeLayout {
/* Turn full-width bar into subtle corner controls over image */
position: absolute;
z-index: 155; /* Memastikan berada di atas itemWrapper */
background-color: #000000cc;
width: 100%;
top: 0;
left: 0;
right: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding: 12px 16px;
color: white;
inset: 0;
z-index: 155; /* above itemWrapper */
pointer-events: none; /* only children are interactive */
}
.editModeLayout h3 {
margin: 0;
font-weight: 500;
font-size: 14px;
/* Left badge: availability switch + label */
.editModeLayout > div:first-child {
position: absolute;
top: 16px;
left: 16px;
display: inline-flex;
align-items: center;
gap: 8px;
background: rgba(0, 0, 0, 0.55);
color: #fff;
border-radius: 999px;
padding: 6px 10px;
pointer-events: auto;
backdrop-filter: blur(2px);
}
/* Right badge: edit/unmark button */
.editModeLayout > div:last-child {
position: absolute;
top: 16px;
right: 16px;
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
background: rgba(0, 0, 0, 0.55);
color: #fff;
border-radius: 999px;
pointer-events: auto;
cursor: pointer;
transition: background 0.2s ease, transform 0.2s ease;
backdrop-filter: blur(2px);
}
.editModeLayout > div:last-child:hover {
background: rgba(0, 0, 0, 0.7);
transform: translateY(-1px);
}
/* When label exists, keep it compact and readable */
.editModeLayout .switch-label {
font-size: 12px;
font-weight: 600;
color: #fff;
white-space: nowrap;
}
.PaymentOption {
@@ -384,4 +450,4 @@
color: #727272;
font-size: 12px;
text-decoration: line-through;
}
}

View File

@@ -97,7 +97,7 @@
top: 0;
right: 0;
background-color: white;
z-index: 300;
z-index: 0; /* align with item lister */
display: flex;
flex-direction: column;
}
@@ -246,4 +246,4 @@
font-size: 12px;
margin: 0 2px;
}
}
}

View File

@@ -1,4 +1,5 @@
import React, {useState, useEffect} from "react";
import { createPortal } from "react-dom";
import styles from "./Modal.module.css";
import AccountUpdatePage from "../components/AccountUpdatePage.js";
@@ -75,7 +76,7 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal
event.stopPropagation();
};
if(modalContent == '') handleOverlayClick();
return (
return createPortal(
<div key={updateKey} onClick={handleOverlayClick} className={styles.modalOverlay}>
<div className={`${styles.modalContent} ${(modalContent === 'edit_tables' || modalContent === 'payment_option' || modalContent === 'create_clerk') ? styles.modalContentWide : ''}`} onClick={handleContentClick}>
@@ -132,7 +133,8 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal
{modalContent === "message" && <Message handleYes={onModalYesFunction} handleNo={handleNo}/>}
{modalContent === "player-prompt" && <PlayerPrompt cafeId={shop.cafeId} setModal={setModal} handleClose={handleOverlayClick} welcomePageConfig={shop.welcomePageConfig}/>}
</div>
</div>
</div>,
document.body
);
};

View File

@@ -8,7 +8,7 @@
display: flex;
justify-content: center;
align-items: center;
z-index: 9999;
z-index: 2147483647 !important; /* ensure above any app layers */
padding: 20px;
}

View File

@@ -31,14 +31,14 @@
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
border-radius: 0 0 15px 15px;
z-index: 1;
z-index: 0; /* align with item lister */
}
.current-name {
white-space: nowrap;
pointer-events: none;
position: relative;
z-index: 2;
z-index: 1;
text-align: left;
margin: 35px 30px;
font-size: 16px;
@@ -70,7 +70,7 @@
.current-artist {
pointer-events: none;
position: relative;
z-index: 2;
z-index: 1;
text-align: left;
margin: -32px 30px;
font-size: 18px;
@@ -83,7 +83,7 @@
.progress-container {
pointer-events: none;
position: relative;
z-index: 2;
z-index: 1;
text-align: left;
margin: 12px 30px;
}
@@ -318,4 +318,3 @@
.search-button.clicked {
background-color: #d0c7b3; /* The color when clicked */
}

View File

@@ -1,5 +1,5 @@
.watermark {
z-index: 5;
z-index: 0; /* align with item lister */
margin-top: 30px;
background-color: rgb(222, 237, 100);
font-weight: 700;
@@ -28,7 +28,7 @@
/* Media query for desktop */
@media (min-width: 768px) { /* Adjust the min-width as needed */
.watermark {
z-index: 5;
z-index: 0; /* align with item lister */
margin-top: 30px;
background-color: rgb(222, 237, 100);
font-weight: 700;
@@ -52,4 +52,4 @@
.watermarkFooter {
margin-top: 8px;
}
}

View File

@@ -1,6 +1,6 @@
// src/CafePage.js
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useRef } from "react";
import {
useParams,
useSearchParams,
@@ -77,6 +77,40 @@ function CafePage({
const [config, setConfig] = useState({});
const [beingEditedType, setBeingEditedType] = useState(0);
// Sticky floating cart bar animations and visibility
const [cartBump, setCartBump] = useState(false);
const [barIntro, setBarIntro] = useState(false);
const [historyPulse, setHistoryPulse] = useState(false);
const prevShowRef = useRef(false);
const prevTxnRef = useRef(null);
const showBar = !isEditMode && (user.username || cartItemsLength > 0);
useEffect(() => {
if (cartItemsLength > 0) {
setCartBump(true);
const t = setTimeout(() => setCartBump(false), 450);
return () => clearTimeout(t);
}
}, [cartItemsLength]);
useEffect(() => {
if (showBar && !prevShowRef.current) {
setBarIntro(true);
const t = setTimeout(() => setBarIntro(false), 500);
prevShowRef.current = true;
return () => clearTimeout(t);
}
if (!showBar) prevShowRef.current = false;
}, [showBar]);
useEffect(() => {
if (lastTransaction && lastTransaction !== prevTxnRef.current) {
setHistoryPulse(true);
const t = setTimeout(() => setHistoryPulse(false), 900);
prevTxnRef.current = lastTransaction;
return () => clearTimeout(t);
}
}, [lastTransaction]);
// const checkWelcomePageConfig = () => {
// const parsedConfig = JSON.parse(welcomePageConfig);
@@ -246,6 +280,8 @@ function CafePage({
removeConnectedGuestSides={removeConnectedGuestSides}
setIsEditMode={(e) => setIsEditMode(e)}
isEditMode={isEditMode}
zIndexLevel={9000}
rectZIndex={9000}
/>
<MusicPlayer
socket={socket}
@@ -319,29 +355,33 @@ function CafePage({
}
/>
))}
{!isEditMode && (user.username || cartItemsLength > 0) &&
<div className="StickyCartBar" style={{ marginTop: '10px', height: '40px', position: 'sticky', bottom: '40px', display: 'flex', justifyContent: 'center', alignItems: 'center', textAlign: 'center' }}>
{showBar &&
<div className={`StickyCartBar${barIntro ? ' intro' : ''}`}>
{(lastTransaction != null || cartItemsLength > 0) &&
<div onClick={goToCart} style={{ backgroundColor: '#73a585', width: user.username ? '55vw' : '70vw', height: '40px', borderRadius: '30px', display: 'flex', justifyContent: 'space-between', padding: '0 20px' }}>
<div style={{ display: 'flex', flexWrap: 'wrap', alignContent: 'center' }}>{lastTransaction != null && '+'}{cartItemsLength} item</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', width: '130px' }}>
<div role="button" tabIndex={0} aria-label="Buka keranjang" onKeyDown={(e)=>{ if(e.key==='Enter'||e.key===' ') { e.preventDefault(); goToCart(); } }} onClick={goToCart} className={`cartBtn${cartBump ? ' bump' : ''}`}>
<div className="summary">
{(lastTransaction != null) && <span>+</span>}
<span>{cartItemsLength} item</span>
</div>
<div className="summary" style={{ gap: 6 }}>
{((lastTransaction == null || lastTransaction?.payment_type != 'paylater')) ?
<span style={{ whiteSpace: 'nowrap' }}>Rp{totalPrice}</span>
<span className="value">{`Rp ${Number(totalPrice || 0).toLocaleString('id-ID')}`}</span>
:
<span style={{ whiteSpace: 'nowrap' }}>Open bill</span>
<span className="value">Open bill</span>
}
<div style={{ display: 'flex', alignItems: 'center', marginLeft: '5px', width: '20px' }}>
<div className="icon">
<svg viewBox="0 0 34 34" style={{ fill: 'white', marginTop: '4px' }}>
<path d="M9.79175 24.75C8.09591 24.75 6.72383 26.1375 6.72383 27.8333C6.72383 29.5292 8.09591 30.9167 9.79175 30.9167C11.4876 30.9167 12.8751 29.5292 12.8751 27.8333C12.8751 26.1375 11.4876 24.75 9.79175 24.75ZM0.541748 0.0833435V3.16668H3.62508L9.17508 14.8679L7.09383 18.645C6.84717 19.0767 6.70842 19.5854 6.70842 20.125C6.70842 21.8208 8.09591 23.2083 9.79175 23.2083H28.2917V20.125H10.4392C10.2234 20.125 10.0538 19.9554 10.0538 19.7396L10.1001 19.5546L11.4876 17.0417H22.973C24.1292 17.0417 25.1467 16.4096 25.6709 15.4538L31.1901 5.44834C31.3134 5.23251 31.3751 4.97043 31.3751 4.70834C31.3751 3.86043 30.6813 3.16668 29.8334 3.16668H7.03217L5.583 0.0833435H0.541748ZM25.2084 24.75C23.5126 24.75 22.1405 26.1375 22.1405 27.8333C22.1405 29.5292 23.5126 30.9167 25.2084 30.9167C26.9042 30.9167 28.2917 29.5292 28.2917 27.8333C28.2917 26.1375 26.9042 24.75 25.2084 24.75Z"></path>
</svg>
{cartItemsLength > 0 && <span className={`badge${cartBump ? ' pop' : ''}`}>{cartItemsLength > 9 ? '9+' : cartItemsLength}</span>}
</div>
</div>
</div>
}
{user.username &&
<div onClick={goToTransactions} style={{ backgroundColor: '#73a585', width: '15vw', height: '40px', borderRadius: '30px', display: 'flex', justifyContent: 'center', marginLeft: (lastTransaction != null || cartItemsLength > 0) ? '6px' : '0px' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: '38px', marginRight: '5px' }}>
<div style={{ display: 'flex', alignItems: 'center', marginLeft: '5px', width: '20px' }}>
<div role="button" tabIndex={0} aria-label="Lihat riwayat" onKeyDown={(e)=>{ if(e.key==='Enter'||e.key===' ') { e.preventDefault(); goToTransactions(); } }} onClick={goToTransactions} className={`historyBtn${historyPulse ? ' pulse' : ''}`}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', width: 38, marginRight: 6 }}>
<div className="icon">
<svg viewBox="0 0 512 512">
<g
transform="translate(0 460) scale(0.09 -0.09)"
@@ -389,3 +429,4 @@ function CafePage({
}
export default CafePage;