From aacb1da8a5467f68d1bbd9b6db4661fd4d4780e5 Mon Sep 17 00:00:00 2001 From: everythingonblack Date: Tue, 13 May 2025 13:24:21 +0700 Subject: [PATCH] ok --- src/App.js | 10 +++++++++- src/components/Modal.js | 12 ++++-------- src/components/MusicPlayer.js | 2 +- src/config.js | 2 +- src/pages/CafePage.js | 2 +- src/pages/CreateCoupon.js | 2 +- src/pages/Join.js | 4 ++-- src/pages/Join.module.css | 3 ++- src/pages/Message.js | 14 +++++++++----- src/pages/Reports.js | 2 +- 10 files changed, 31 insertions(+), 22 deletions(-) diff --git a/src/App.js b/src/App.js index 265b578..3b43976 100644 --- a/src/App.js +++ b/src/App.js @@ -268,6 +268,14 @@ function App() { socket.on("transaction_success", async (data) => { console.log("transaction notification"); 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) => { @@ -306,7 +314,7 @@ function App() { let searchModal = searchParams.get("modal") || ''; // Get transactionId or set it to empty string 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); } }; diff --git a/src/components/Modal.js b/src/components/Modal.js index 91f48f0..991f780 100644 --- a/src/components/Modal.js +++ b/src/components/Modal.js @@ -63,14 +63,10 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal onClose(); // Close the modal }; - const handleYes = (event) => { - if(onModalYesFunction) - onModalYesFunction(); - onClose(); // Close the modal - } - const handleNo = (event) => { - if(onModalCloseFunction) onModalCloseFunction(); + if(onModalCloseFunction) + onModalCloseFunction(); + onClose(); } // Function to handle clicks on the modal content @@ -133,7 +129,7 @@ const Modal = ({ user, shop, isOpen, onClose, modalContent, deviceType, setModal {modalContent === "join" && } {modalContent === "claim-coupon" && } {modalContent === "loading" && } - {modalContent === "message" && } + {modalContent === "message" && } {modalContent === "player-prompt" && } diff --git a/src/components/MusicPlayer.js b/src/components/MusicPlayer.js index 84ac216..754932f 100644 --- a/src/components/MusicPlayer.js +++ b/src/components/MusicPlayer.js @@ -108,7 +108,7 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo // setSubtitleColor("white"); // 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); } catch (error) { diff --git a/src/config.js b/src/config.js index 6cf67cc..967c5ce 100644 --- a/src/config.js +++ b/src/config.js @@ -1,5 +1,5 @@ // 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; diff --git a/src/pages/CafePage.js b/src/pages/CafePage.js index 3c53d0d..10abf1f 100644 --- a/src/pages/CafePage.js +++ b/src/pages/CafePage.js @@ -141,7 +141,7 @@ function CafePage({ socket.on("joined-room", (response) => { const { isSpotifyNeedLogin, isExceededDeadline } = response; setNeedSpotifyLogin(isSpotifyNeedLogin); - if (isExceededDeadline) setModal('message',{captMessage:'Kafe sedang tidak tersedia'}); + if (isExceededDeadline) setModal("message",{captMessage:'Kafe sedang tidak tersedia'}); setIsExceededDeadline(isExceededDeadline); }); } diff --git a/src/pages/CreateCoupon.js b/src/pages/CreateCoupon.js index 3833ee6..0ed594a 100644 --- a/src/pages/CreateCoupon.js +++ b/src/pages/CreateCoupon.js @@ -46,7 +46,7 @@ const CreateCouponPage = () => { let encodedCouponCode = encodeURIComponent(encryptedCouponCode); // 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 setCouponUrl(urlWithCoupon); diff --git a/src/pages/Join.js b/src/pages/Join.js index 3bf2482..2f4367e 100644 --- a/src/pages/Join.js +++ b/src/pages/Join.js @@ -191,12 +191,12 @@ const LinktreePage = ({ data, setModal }) => { setModal('loading'); const loggingcoupon = await handleLogCouponForUser(); // Await the coupon logging process - setModal('message', { + setModal("message", { captMessage: loggingcoupon ? 'Kupon berhasil ditambahkan' : 'Kupon gagal ditambahkan' }); } catch (error) { console.error('Error during coupon handling:', error); - setModal('message', { captMessage: 'Kupon gagal ditambahkan' }); + setModal("message", { captMessage: 'Kupon gagal ditambahkan' }); } } }} diff --git a/src/pages/Join.module.css b/src/pages/Join.module.css index a7f14e0..18f4696 100644 --- a/src/pages/Join.module.css +++ b/src/pages/Join.module.css @@ -38,9 +38,10 @@ padding: 0px 0px 0px 18px; width: 222px; font-weight: 700; - font-size: 32px; + font-size: 27px; line-height: 2.25rem; letter-spacing: -1px; + margin-bottom: 6px; } .descHeading { diff --git a/src/pages/Message.js b/src/pages/Message.js index 3abd725..d3c4ca8 100644 --- a/src/pages/Message.js +++ b/src/pages/Message.js @@ -2,20 +2,23 @@ import React, { useState, useEffect } from 'react'; import styles from './Join.module.css'; // Import the module.css file -const LinktreePage = ({ handleYes }) => { +const LinktreePage = ({ handleYes, handleNo }) => { const [captMessage, setCaptMessage] = useState(''); const [descMessage, setDescMessage] = useState(''); - const [closeText, setCloseText] = useState(''); + const [yesText, setYesText] = useState(''); + const [noText, setNoText] = useState(''); useEffect(() => { const newQueryParams = new URLSearchParams(window.location.search); const r = newQueryParams.get('captMessage'); const s = newQueryParams.get('descMessage'); - const v = newQueryParams.get('closeText') || 'Tutup'; + const v = newQueryParams.get('yesText'); + const vn = newQueryParams.get('noText'); if (r) { setCaptMessage(r) setDescMessage(s) - setCloseText(v) + setYesText(v) + setNoText(vn) } }, []); @@ -24,7 +27,8 @@ const LinktreePage = ({ handleYes }) => {
{captMessage}
{descMessage &&
{descMessage}
} - {handleYes &&
{closeText}
} + {handleYes &&
{yesText}
} + {noText &&
{noText}
}
); diff --git a/src/pages/Reports.js b/src/pages/Reports.js index 1dd6c9a..9956e9d 100644 --- a/src/pages/Reports.js +++ b/src/pages/Reports.js @@ -455,7 +455,7 @@ const App = ({ forCafe = true, cafeId = -1, } else { setModal('loading'); const create = await createCafe(itemName); - setModal('message', { + setModal("message", { captMessage: create ? 'Berhasil membuat cafe' : 'Gagal membuat cafe' });