ok
This commit is contained in:
10
src/App.js
10
src/App.js
@@ -268,6 +268,14 @@ function App() {
|
|||||||
socket.on("transaction_success", async (data) => {
|
socket.on("transaction_success", async (data) => {
|
||||||
console.log("transaction notification");
|
console.log("transaction notification");
|
||||||
setModal("transaction_success", data);
|
setModal("transaction_success", data);
|
||||||
|
|
||||||
|
// If 'lastTransaction' exists, proceed
|
||||||
|
localStorage.removeItem("lastTransaction");
|
||||||
|
|
||||||
|
if (lastTransaction != null) {
|
||||||
|
setLastTransaction(null);
|
||||||
|
console.log('remove last transaction')
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("transaction_end", async (data) => {
|
socket.on("transaction_end", async (data) => {
|
||||||
@@ -306,7 +314,7 @@ function App() {
|
|||||||
let searchModal = searchParams.get("modal") || ''; // Get transactionId or set it to empty string
|
let searchModal = searchParams.get("modal") || ''; // Get transactionId or set it to empty string
|
||||||
|
|
||||||
if (permission !== "granted" && searchModal == '') {
|
if (permission !== "granted" && searchModal == '') {
|
||||||
setModal("message", { captMessage: 'Notifikasi tidak aktif', descMessage: 'Aktifkan notifikasi supaya kamu tetap dapat info pesanan, meski sedang buka aplikasi lain.' }, null, handleNotificationClick);
|
setModal("message", { captMessage: 'Notifikasi tidak aktif', descMessage: 'Aktifkan notifikasi supaya kamu tetap dapat info pesanan, meski sedang buka aplikasi lain.', yesText: 'Aktifkan', noText: 'Tutup' }, null, handleNotificationClick);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -63,14 +63,10 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal
|
|||||||
onClose(); // Close the modal
|
onClose(); // Close the modal
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleYes = (event) => {
|
|
||||||
if(onModalYesFunction)
|
|
||||||
onModalYesFunction();
|
|
||||||
onClose(); // Close the modal
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleNo = (event) => {
|
const handleNo = (event) => {
|
||||||
if(onModalCloseFunction) onModalCloseFunction();
|
if(onModalCloseFunction)
|
||||||
|
onModalCloseFunction();
|
||||||
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to handle clicks on the modal content
|
// Function to handle clicks on the modal content
|
||||||
@@ -133,7 +129,7 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal
|
|||||||
{modalContent === "join" && <Join setModal={setModal} />}
|
{modalContent === "join" && <Join setModal={setModal} />}
|
||||||
{modalContent === "claim-coupon" && <Join setModal={setModal} />}
|
{modalContent === "claim-coupon" && <Join setModal={setModal} />}
|
||||||
{modalContent === "loading" && <Loading setModal={setModal} />}
|
{modalContent === "loading" && <Loading setModal={setModal} />}
|
||||||
{modalContent === "message" && <Message handleYes={handleYes}/>}
|
{modalContent === "message" && <Message handleYes={onModalYesFunction} handleNo={handleNo}/>}
|
||||||
{modalContent === "player-prompt" && <PlayerPrompt cafeId={shop.cafeId} setModal={setModal} handleClose={handleOverlayClick} welcomePageConfig={shop.welcomePageConfig}/>}
|
{modalContent === "player-prompt" && <PlayerPrompt cafeId={shop.cafeId} setModal={setModal} handleClose={handleOverlayClick} welcomePageConfig={shop.welcomePageConfig}/>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
|
|||||||
// setSubtitleColor("white");
|
// setSubtitleColor("white");
|
||||||
// setSubtitleBG("black");
|
// setSubtitleBG("black");
|
||||||
// }
|
// }
|
||||||
const proxiedUrl = `https://dev.api.kedaimaster.com/image?url=${encodeURIComponent(modifyUrl(imageUrl))}`; // Use your proxy to fetch the image
|
const proxiedUrl = `https://api.kedaimaster.com/image?url=${encodeURIComponent(modifyUrl(imageUrl))}`; // Use your proxy to fetch the image
|
||||||
|
|
||||||
setBackgroundImage(proxiedUrl);
|
setBackgroundImage(proxiedUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// src/config.js
|
// src/config.js
|
||||||
|
|
||||||
const API_BASE_URL = 'https://dev.api.kedaimaster.com';
|
const API_BASE_URL = 'https://api.kedaimaster.com';
|
||||||
|
|
||||||
export default API_BASE_URL;
|
export default API_BASE_URL;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ function CafePage({
|
|||||||
socket.on("joined-room", (response) => {
|
socket.on("joined-room", (response) => {
|
||||||
const { isSpotifyNeedLogin, isExceededDeadline } = response;
|
const { isSpotifyNeedLogin, isExceededDeadline } = response;
|
||||||
setNeedSpotifyLogin(isSpotifyNeedLogin);
|
setNeedSpotifyLogin(isSpotifyNeedLogin);
|
||||||
if (isExceededDeadline) setModal('message',{captMessage:'Kafe sedang tidak tersedia'});
|
if (isExceededDeadline) setModal("message",{captMessage:'Kafe sedang tidak tersedia'});
|
||||||
setIsExceededDeadline(isExceededDeadline);
|
setIsExceededDeadline(isExceededDeadline);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const CreateCouponPage = () => {
|
|||||||
let encodedCouponCode = encodeURIComponent(encryptedCouponCode);
|
let encodedCouponCode = encodeURIComponent(encryptedCouponCode);
|
||||||
|
|
||||||
// Construct the URL with the encoded coupon code as a query parameter
|
// Construct the URL with the encoded coupon code as a query parameter
|
||||||
const urlWithCoupon = `https://dev.coupon.kedaimaster.com/coupon?c=${encodedCouponCode}`;
|
const urlWithCoupon = `https://coupon.kedaimaster.com/coupon?c=${encodedCouponCode}`;
|
||||||
|
|
||||||
// Optionally, set the URL to use with the coupon
|
// Optionally, set the URL to use with the coupon
|
||||||
setCouponUrl(urlWithCoupon);
|
setCouponUrl(urlWithCoupon);
|
||||||
|
|||||||
@@ -191,12 +191,12 @@ const LinktreePage = ({ data, setModal }) => {
|
|||||||
setModal('loading');
|
setModal('loading');
|
||||||
|
|
||||||
const loggingcoupon = await handleLogCouponForUser(); // Await the coupon logging process
|
const loggingcoupon = await handleLogCouponForUser(); // Await the coupon logging process
|
||||||
setModal('message', {
|
setModal("message", {
|
||||||
captMessage: loggingcoupon ? 'Kupon berhasil ditambahkan' : 'Kupon gagal ditambahkan'
|
captMessage: loggingcoupon ? 'Kupon berhasil ditambahkan' : 'Kupon gagal ditambahkan'
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error during coupon handling:', error);
|
console.error('Error during coupon handling:', error);
|
||||||
setModal('message', { captMessage: 'Kupon gagal ditambahkan' });
|
setModal("message", { captMessage: 'Kupon gagal ditambahkan' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -38,9 +38,10 @@
|
|||||||
padding: 0px 0px 0px 18px;
|
padding: 0px 0px 0px 18px;
|
||||||
width: 222px;
|
width: 222px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 32px;
|
font-size: 27px;
|
||||||
line-height: 2.25rem;
|
line-height: 2.25rem;
|
||||||
letter-spacing: -1px;
|
letter-spacing: -1px;
|
||||||
|
margin-bottom: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.descHeading {
|
.descHeading {
|
||||||
|
|||||||
@@ -2,20 +2,23 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import styles from './Join.module.css'; // Import the module.css file
|
import styles from './Join.module.css'; // Import the module.css file
|
||||||
|
|
||||||
const LinktreePage = ({ handleYes }) => {
|
const LinktreePage = ({ handleYes, handleNo }) => {
|
||||||
const [captMessage, setCaptMessage] = useState('');
|
const [captMessage, setCaptMessage] = useState('');
|
||||||
const [descMessage, setDescMessage] = useState('');
|
const [descMessage, setDescMessage] = useState('');
|
||||||
const [closeText, setCloseText] = useState('');
|
const [yesText, setYesText] = useState('');
|
||||||
|
const [noText, setNoText] = useState('');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newQueryParams = new URLSearchParams(window.location.search);
|
const newQueryParams = new URLSearchParams(window.location.search);
|
||||||
const r = newQueryParams.get('captMessage');
|
const r = newQueryParams.get('captMessage');
|
||||||
const s = newQueryParams.get('descMessage');
|
const s = newQueryParams.get('descMessage');
|
||||||
const v = newQueryParams.get('closeText') || 'Tutup';
|
const v = newQueryParams.get('yesText');
|
||||||
|
const vn = newQueryParams.get('noText');
|
||||||
if (r) {
|
if (r) {
|
||||||
setCaptMessage(r)
|
setCaptMessage(r)
|
||||||
setDescMessage(s)
|
setDescMessage(s)
|
||||||
setCloseText(v)
|
setYesText(v)
|
||||||
|
setNoText(vn)
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -24,7 +27,8 @@ const LinktreePage = ({ handleYes }) => {
|
|||||||
<div className={styles.dashboardContainer} >
|
<div className={styles.dashboardContainer} >
|
||||||
<div className={styles.mainHeading}>{captMessage}</div>
|
<div className={styles.mainHeading}>{captMessage}</div>
|
||||||
{descMessage && <div className={styles.descHeading}>{descMessage}</div>}
|
{descMessage && <div className={styles.descHeading}>{descMessage}</div>}
|
||||||
{handleYes && <div onClick={handleYes} className={styles.button}>{closeText}</div>}
|
{handleYes && <div onClick={handleYes} className={styles.button}>{yesText}</div>}
|
||||||
|
{noText && <div onClick={handleNo} className={styles.button}>{noText}</div>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ const App = ({ forCafe = true, cafeId = -1,
|
|||||||
} else {
|
} else {
|
||||||
setModal('loading');
|
setModal('loading');
|
||||||
const create = await createCafe(itemName);
|
const create = await createCafe(itemName);
|
||||||
setModal('message', {
|
setModal("message", {
|
||||||
captMessage: create ? 'Berhasil membuat cafe' : 'Gagal membuat cafe'
|
captMessage: create ? 'Berhasil membuat cafe' : 'Gagal membuat cafe'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user