ok
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
width: 40vw;
|
width: 100%;
|
||||||
height: 260px;
|
height: 260px;
|
||||||
background-color: #e2e8f0;
|
background-color: #e2e8f0;
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
margin-bottom: 1.5rem;
|
margin-bottom: 1.5rem;
|
||||||
|
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-size: cover;
|
background-size: contain;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,10 +94,6 @@
|
|||||||
.buttonGroup {
|
.buttonGroup {
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.image {
|
|
||||||
width: 63vw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.childSelector {
|
.childSelector {
|
||||||
|
|||||||
@@ -12,22 +12,6 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
const [showNamingInput, setShowNamingInput] = useState(false);
|
const [showNamingInput, setShowNamingInput] = useState(false);
|
||||||
const [customName, setCustomName] = useState('');
|
const [customName, setCustomName] = useState('');
|
||||||
|
|
||||||
const parseJWT = (token) => {
|
|
||||||
try {
|
|
||||||
const base64Url = token.split('.')[1];
|
|
||||||
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
||||||
const jsonPayload = decodeURIComponent(
|
|
||||||
atob(base64)
|
|
||||||
.split('')
|
|
||||||
.map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))
|
|
||||||
.join('')
|
|
||||||
);
|
|
||||||
return JSON.parse(jsonPayload);
|
|
||||||
} catch {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onCheckout = () => {
|
const onCheckout = () => {
|
||||||
const tokenCookie = document.cookie.split('; ').find(row => row.startsWith('token='));
|
const tokenCookie = document.cookie.split('; ').find(row => row.startsWith('token='));
|
||||||
const token = tokenCookie ? tokenCookie.split('=')[1] : '';
|
const token = tokenCookie ? tokenCookie.split('=')[1] : '';
|
||||||
@@ -85,8 +69,8 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setShowNamingInput(true);
|
setShowNamingInput(true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
// No children, no matching subscription
|
// No children, no matching subscription
|
||||||
@@ -170,11 +154,13 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
className={`${styles.button} ${styles.checkoutButton}`}
|
className={`${styles.button} ${styles.checkoutButton}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const token = (document.cookie.split('; ').find(row => row.startsWith('token=')) || '').split('=')[1] || '';
|
const token = (document.cookie.split('; ').find(row => row.startsWith('token=')) || '').split('=')[1] || '';
|
||||||
const url = `https://${product.site_url}/dashboard/${product.name.split('%%%')[0]}?token=${token}`;
|
const url = product.end_date
|
||||||
|
? `https://${product.site_url}/dashboard/${product.name.split('%%%')[0]}?token=${token}`
|
||||||
|
: `https://${product.site_url}`;
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
KUNJUNGI
|
PELAJARI LEBIH LANJUT
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -289,11 +275,11 @@ const ProductDetail = ({ subscriptions, product, requestLogin, setShowedModal })
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowNamingInput(false);
|
setShowNamingInput(false);
|
||||||
|
|
||||||
const hasMatchingSubscription = Array.isArray(subscriptions) &&
|
const hasMatchingSubscription = Array.isArray(subscriptions) &&
|
||||||
subscriptions.some(sub =>
|
subscriptions.some(sub =>
|
||||||
String(sub.product_id) === String(product.id) || String(sub.product_parent_id) === String(product.id)
|
String(sub.product_id) === String(product.id) || String(sub.product_parent_id) === String(product.id)
|
||||||
);
|
);
|
||||||
if(hasMatchingSubscription) setShowSubscriptionSelector(true);
|
if (hasMatchingSubscription) setShowSubscriptionSelector(true);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Kembali
|
Kembali
|
||||||
|
|||||||
Reference in New Issue
Block a user