This commit is contained in:
everythingonblack
2025-04-03 05:19:27 +07:00
parent a64b999a05
commit 931f3f90e8
12 changed files with 849 additions and 58 deletions

View File

@@ -10,6 +10,7 @@ import {
import "../App.css";
import Watermark from "../components/Watermark";
import { getImageUrl, createItem, updateItem, moveItemType } from "../helpers/itemHelper.js";
import SearchInput from "../components/SearchInput";
import ItemTypeLister from "../components/ItemTypeLister";
@@ -139,7 +140,7 @@ function CafePage({
socket.on("joined-room", (response) => {
const { isSpotifyNeedLogin, isExceededDeadline } = response;
setNeedSpotifyLogin(isSpotifyNeedLogin);
if (isExceededDeadline) setModal('unavailable');
if (isExceededDeadline) setModal('message',{returnMessage:'Kafe sedang tidak tersedia'});
setIsExceededDeadline(isExceededDeadline);
});
}
@@ -210,8 +211,8 @@ function CafePage({
/>
) : (
welcomePageConfig != null && (
<div className="Cafe" style={{ filter: isExceededDeadline ? 'grayscale(1)' : '', pointerEvents: isExceededDeadline ? 'none' : '' }}>
<body className="App-header">
<div className="Cafe" style={{ display: 'flex', flexDirection: 'column', justifyContent: 'space-between', minHeight: '100vh', filter: isExceededDeadline ? 'grayscale(1)' : '', pointerEvents: isExceededDeadline ? 'none' : '' }}>
<div className="App-header">
<Header
HeaderText={"Menu"}
showProfile={true}
@@ -359,8 +360,8 @@ function CafePage({
</div>
}
</div>
<div style={{ marginTop: '30px', height: '27px', backgroundColor: 'rgb(222 237 100)', fontWeight: 700, fontSize: '15px', lineHeight: '1rem', letterSpacing: '-1px', color: 'rgb(37, 79, 26)', padding: '10px' }}><div>KEDAIMASTER</div></div>
</body>
</div>
<Watermark/>
</div>
)
)}

View File

@@ -14,6 +14,7 @@ import API_BASE_URL from '../config';
import DailyCharts from '../components/DailyCharts';
import Coupon from '../components/Coupon';
import Reports from './Reports'
import Watermark from '../components/Watermark.js';
const LinktreePage = ({ user, setModal }) => {
const navigate = useNavigate();
@@ -297,7 +298,7 @@ const LinktreePage = ({ user, setModal }) => {
{getLocalStorage('auth') == null && (
<div className={styles.LoginForm}>
<div className={`${styles.FormUsername} ${inputtingPassword ? styles.animateForm : wasInputtingPassword ? styles.reverseForm : ''}`}>
<label htmlFor="username" className={styles.usernameLabel}>---- Masuk -------------------------------</label>
<label htmlFor="username" className={styles.usernameLabel}>---- Masuk -----------------------------</label>
<input
id="username"
placeholder="username"
@@ -316,7 +317,7 @@ const LinktreePage = ({ user, setModal }) => {
<label onClick={() => setInputtingPassword(false)} htmlFor="password" className={styles.usernameLabel}> &lt;--- &lt;-- Kembali </label>
<label htmlFor="password" className={styles.usernameLabel}> &nbsp; ----- &nbsp; </label>
<label onClick={() => setModal('reset-password', { username: username })} className={styles.usernameLabel}>
lupa password? -
lupa password?
</label>
</span>
<input
@@ -360,9 +361,9 @@ const LinktreePage = ({ user, setModal }) => {
onError={(e) => e.target.src = '/fallback-image.png'}
/>
</div>
<a style={{ left: 0, right: 0, bottom: 0, textAlign: 'center', color: '#254F1A', fontSize: '13px', position: 'fixed' }}>©2025 KEDIRITECHNOPARK.COM</a>
</div>
</div>
<Watermark dontShowName={true}/>
</div>
)}
</>

View File

@@ -78,6 +78,8 @@ const LinktreePage = ({ data, setModal }) => {
// Handle manual coupon code check
const handleLogCouponForUser = async (code = couponCode) => {
const result = await logCouponForUser(code); // Call the helper
return result.success;
};
// Listen for query parameter changes (using the `location` object)
@@ -106,20 +108,11 @@ const LinktreePage = ({ data, setModal }) => {
<div className={styles.subHeadingTransparent}>
Daftarkan kedaimu sekarang dan mulai gunakan semua fitur unggulan kami.
</div>
<form className={styles.linktreeForm}>
<label htmlFor="username" className={styles.usernameLabel}>
--------------------------------------------
</label>
<input
id="username"
placeholder="nomor whatsapp atau email"
maxLength="30"
className={styles.usernameInput}
/>
<button type="submit" className={styles.claimButton}>
<span></span>
<div className={styles.linktreeForm}>
<button onClick={()=>window.open("https://api.whatsapp.com/send?phone=6281318894994&text=Saya%20ingin%20coba%20gratis%203%20bulan")} className={styles.claimButton}>
<span>Dapatkan voucher gratis 3 bulan</span>
</button>
</form>
</div>
<div className={styles.footer}>
<div className={styles.footerLinks}>
<a
@@ -131,7 +124,10 @@ const LinktreePage = ({ data, setModal }) => {
Pelajari lebih lanjut
</a>
<a
onClick={() => setIsUsingCoupon(true)}
onClick={(e) => {
e.preventDefault(); // Prevent the default anchor behavior
setIsUsingCoupon(true);
}}
className={styles.footerLink}
>
Gunakan Voucher
@@ -141,14 +137,14 @@ const LinktreePage = ({ data, setModal }) => {
</div>
) : (
<div className={styles.dashboardContainer}>
<div className={styles.mainHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Dengan Voucher'}</div>
<div className={styles.voucherHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Dengan Voucher'}</div>
<div className={styles.subHeading}>
Voucher dapat digunakan untuk pembuatan akun bisnis maupun untuk memperpanjang masa berlangganan.
</div>
{couponStatus === 0 ? (
<form className={styles.linktreeForm} onSubmit={(e) => e.preventDefault()}>
<label htmlFor="coupon" className={styles.usernameLabel}>
--------------------------------------------
----------------------------------------
</label>
<input
id="coupon"
@@ -179,21 +175,31 @@ const LinktreePage = ({ data, setModal }) => {
<button
className={styles.claimButton}
style={{ width: '266px' }}
onClick={() => {
onClick={async () => {
if (!isOnlyClaimCoupon) {
const secretKey = 'xixixi666'; // Your AES-256 key (32 characters)
// Encrypt couponCode inline
const encryptedCouponCode = CryptoJS.AES.encrypt(couponCode, secretKey).toString();
console.log(encryptedCouponCode)
// If it's only claiming a coupon, trigger claim logic
console.log(encryptedCouponCode);
// If it's not for claiming a coupon, trigger the create user modal logic
setModal('create_user', { codeStatus: 200, c: encryptedCouponCode });
} else {
// Otherwise, handle the coupon for user creation
handleLogCouponForUser();
try {
// Otherwise, handle the coupon for user creation
setModal('loading');
const loggingcoupon = await handleLogCouponForUser(); // Await the coupon logging process
setModal('message', {
returnMessage: loggingcoupon ? 'Kupon berhasil ditambahkan' : 'Kupon gagal ditambahkan'
});
} catch (error) {
console.error('Error during coupon handling:', error);
setModal('message', { returnMessage: 'Kupon gagal ditambahkan' });
}
}
}}
}}
>
<span>{isOnlyClaimCoupon ? 'Aktifkan untuk akun ini' : 'Buat akun bisnis dengan voucher ini'}</span>
</button>

View File

@@ -17,6 +17,7 @@
/* Main Heading */
.mainHeading {
width: 222px;
font-weight: 700;
font-size: 32px;
line-height: 2.25rem;
@@ -25,6 +26,15 @@
color: rgb(37, 79, 26);
}
/* Main Heading */
.voucherHeading {
font-weight: 700;
font-size: 32px;
line-height: 2.25rem;
margin-bottom: 1rem;
letter-spacing: -1px;
color: rgb(37, 79, 26);
}
.swipeContainer {
height: 75px;
overflow: hidden;
@@ -109,7 +119,7 @@
}
.claimButton {
width: 200px;
width: 236px;
height: 45px;
background-color: #254F1A;
color: #D2E823;

View File

@@ -1,21 +1,11 @@
/* General container */
.centeredLinktreePage {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
background-color: rgb(222 237 100);
}
.nonCenteredLinktreePage {
height: 100vh;
display: flex;
flex-direction: column;
justify-content: start;
background-color: rgb(255 255 255);
position: relative;
}
.dashboardLine {
position: fixed;
left: 0px;
@@ -29,7 +19,7 @@
background-color: inherit;
z-index: 6;
padding: 0 1rem;
padding-top: 40px;
padding-top: 100px;
}
/* Main Heading */

28
src/pages/Message.js Normal file
View File

@@ -0,0 +1,28 @@
// LinktreePage.js
import React, { useState, useEffect } from 'react';
import styles from './Join.module.css'; // Import the module.css file
const LinktreePage = () => {
const [returnMessage, setReturnMessage] = useState('');
useEffect(() => {
const newQueryParams = new URLSearchParams(window.location.search);
const r = newQueryParams.get('returnMessage');
if (r) {
setReturnMessage(r)
}
}, []);
return (
<div className={styles.linktreePage}>
<div className={styles.dashboardContainer}>
<div className={styles.mainHeading}>{returnMessage}</div>
<div className={styles.subHeadingTransparent}>
Daftarkan kedaimu sekarang dan mulai gunakan semua fitur unggulan kami.
</div>
</div>
</div>
);
};
export default LinktreePage;

View File

@@ -315,26 +315,29 @@ const App = ({ forCafe = true, cafeId = -1,
if (otherCafes != null) {
console.log(otherCafes)
let updatedFullTexts;
if (otherCafes.length === 0) {
updatedFullTexts = [[user.roleId == 0 ? "Buat Voucher" : "Buat bisnis", 0]];
// Only include the role-specific option if user.roleId is 1
updatedFullTexts = user.roleId == 1 ? [["Buat Bisnis", 0]] : [];
setSelectedCafeId(-1);
} else if (otherCafes.length === 1) {
updatedFullTexts = [
[otherCafes[0].name || otherCafes[0].username, otherCafes[0].cafeId || otherCafes[0].userId],
[user.roleId == 0 ? "Buat Voucher" : "Buat bisnis", -1]
[otherCafes[0].cafeIdentifyName || otherCafes[0].username, otherCafes[0].cafeId || otherCafes[0].userId],
// Only add the "Buat Bisnis" option for user.roleId == 1
...(user.roleId == 1 ? [["Buat Bisnis", -1]] : [])
];
setSelectedCafeId(otherCafes[0].cafeId); // Get the cafeId (second part of the pair)
} else {
updatedFullTexts = [
["semua", 0], // First entry is "semua"
...otherCafes.map(item => [item.name || item.username, item.cafeId || item.userId]), // Map over cafes to get name and cafeId pairs
[user.roleId == 0 ? "Buat Voucher" : "Tambah Bisnis +", -1] // Add the "+" entry
...otherCafes.map(item => [item.cafeIdentifyName || item.username, item.cafeId || item.userId]), // Map over cafes to get name and cafeId pairs
// Only add "Buat Bisnis +" option for user.roleId == 1
...(user.roleId == 1 ? [["Buat Bisnis +", -1]] : [])
];
setSelectedCafeId(0);
}
setFullTexts(updatedFullTexts); // Set fullTexts with the original structure
// Set fullTextsVisible to an array of names only
@@ -400,7 +403,7 @@ const App = ({ forCafe = true, cafeId = -1,
setSelectedCafeId(selectedItem[1]); // Get the cafeId (second part of the pair)
}
let nextSelectedId = selectedItem[1]
if (selectedItem[1] == -1 && user.roleId == 0) setModal('create_coupon', {}, () => { setSelectedSwitch(1); setSelectedCafeId(unSelectedItem[1]); nextSelectedId=unSelectedItem[1] });
console.log(analytics)
if (user && user.roleId === 0 && analytics) {
// Filter the analytics items based on userId
@@ -448,9 +451,9 @@ const App = ({ forCafe = true, cafeId = -1,
} else {
setModal('loading');
const create = await createCafe(itemName);
if (!create) {
setModalStatus('failed');
}
setModal('message', {
returnMessage: create ? 'Berhasil membuat cafe' : 'Gagal membuat cafe'
});
// Add a 2-second delay before proceeding
await delay(2000);