ok
This commit is contained in:
@@ -4,6 +4,9 @@ import styles from './Join.module.css'; // Import the module.css file
|
||||
import { checkCoupon, logCouponForUser } from '../helpers/couponHelpers'; // Import the new helper
|
||||
import Coupon from '../components/Coupon';
|
||||
|
||||
import {
|
||||
getLocalStorage,
|
||||
} from "../helpers/localStorageHelpers";
|
||||
|
||||
const LinktreePage = ({ data, setModal }) => {
|
||||
const queryParams = new URLSearchParams(window.location.search);
|
||||
@@ -21,9 +24,24 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
|
||||
console.log(code)
|
||||
if (modal == 'claim-coupon') {
|
||||
if (!getLocalStorage('auth')) {
|
||||
|
||||
// Preserve the couponCode query param while navigating to the claim-coupon modal
|
||||
const newUrl = `?modal=join${code ? `&couponCode=${code}` : ''}`;
|
||||
window.location.href = newUrl; // This will update the URL and reload the page
|
||||
}
|
||||
|
||||
setIsOnlyClaimCoupon(true)
|
||||
setIsUsingCoupon(true); // Automatically switch to the coupon input state
|
||||
}
|
||||
else {
|
||||
if (getLocalStorage('auth')) {
|
||||
|
||||
// Preserve the couponCode query param while navigating to the claim-coupon modal
|
||||
const newUrl = `?modal=claim-coupon${code ? `&couponCode=${code}` : ''}`;
|
||||
window.location.href = newUrl; // This will update the URL and reload the page
|
||||
}
|
||||
}
|
||||
if (code) {
|
||||
setCouponCode(code);
|
||||
setIsUsingCoupon(true); // Automatically switch to the coupon input state
|
||||
@@ -104,9 +122,9 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.dashboardContainer}>
|
||||
<div className={styles.mainHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Menggunakan Voucher'}</div>
|
||||
<div className={styles.mainHeading}>{isOnlyClaimCoupon ? 'Aktifkan Voucher' : 'Daftar Dengan Voucher'}</div>
|
||||
<div className={styles.subHeading}>
|
||||
Voucher dapat digunakan untuk pembuatan akun penyewa maupun untuk memperpanjang masa berlangganan.
|
||||
Voucher dapat digunakan untuk pembuatan akun bisnis maupun untuk memperpanjang masa berlangganan.
|
||||
</div>
|
||||
{couponStatus === 0 ? (
|
||||
<form className={styles.linktreeForm} onSubmit={(e) => e.preventDefault()}>
|
||||
@@ -152,7 +170,7 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
<span>{isOnlyClaimCoupon ? 'Aktifkan untuk akun ini' : 'Buat akun dengan voucher ini'}</span>
|
||||
<span>{isOnlyClaimCoupon ? 'Aktifkan untuk akun ini' : 'Buat akun bisnis dengan voucher ini'}</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
@@ -161,6 +179,16 @@ const LinktreePage = ({ data, setModal }) => {
|
||||
)}
|
||||
<div className={styles.footer}>
|
||||
<div className={styles.footerLinks}>
|
||||
{!getLocalStorage('auth') &&
|
||||
<a
|
||||
href="https://linktr.ee/discover/trending"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className={styles.footerLink}
|
||||
>
|
||||
Sudah punya akun bisnis?
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
href="https://linktr.ee/discover/trending"
|
||||
target="_blank"
|
||||
|
||||
Reference in New Issue
Block a user