This commit is contained in:
Vassshhh
2025-07-31 17:33:20 +07:00
parent 74fdca2007
commit 7a0a0983dd
4 changed files with 14 additions and 18 deletions

View File

@@ -167,7 +167,7 @@ function App() {
} }
/> />
<Route <Route
path="/" path="/products"
element={ element={
<ProductsPage/> <ProductsPage/>
} }

View File

@@ -21,15 +21,11 @@ const Header = ({ username, scrollToProduct, scrollToCourse, setShowedModal }) =
onMouseEnter={() => setHoveredNav(2)} onMouseEnter={() => setHoveredNav(2)}
onMouseLeave={() => setHoveredNav(null)} onMouseLeave={() => setHoveredNav(null)}
onClick={() => { onClick={() => {
if (username == null) { navigate('/');
scrollToProduct();
}
else {
navigate('/products');
}
}} }}
> >
PRODUCTS HOME
</a> </a>
<a <a
className={`${styles.navLink} ${hoveredNav === 3 ? styles.navLinkHover : ''}`} className={`${styles.navLink} ${hoveredNav === 3 ? styles.navLinkHover : ''}`}

View File

@@ -85,8 +85,8 @@ const ProductDetail = ({ product, setPostLoginAction, setShowedModal }) => {
return; return;
} }
// Redirect dengan token dan itemsId di query // Redirect dengan token dan itemsId di query route ke checkout.kediritechnopark.com
window.location.href = `http://localhost:3001/?token=${token}&itemsId=${itemsParam}&redirect_uri=http://localhost:3000/courses&redirect_failed=http://localhost:3000`; window.location.href = `http://localhost:3002/?token=${token}&itemsId=${itemsParam}&redirect_uri=http://localhost:3000/products&redirect_failed=http://localhost:3000`;
}; };
@@ -100,8 +100,8 @@ const ProductDetail = ({ product, setPostLoginAction, setShowedModal }) => {
<div className={styles.headerRow}> <div className={styles.headerRow}>
<h2 className={styles.title}>{product.name}</h2> <h2 className={styles.title}>{product.name}</h2>
<div className={styles.price} style={{ color: priceColor }}> <div className={styles.price} style={{ color: priceColor }}>
{product.price === 0 {product.price == null
? 'Free' ? 'Pay-As-You-Go'
: `Rp ${parseInt(product.price).toLocaleString('id-ID')}`} : `Rp ${parseInt(product.price).toLocaleString('id-ID')}`}
</div> </div>
</div> </div>

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import ProductDetailPage from './ProductDetailPage'; import ProductDetailPage from '../ProductDetailPage';
import Login from './Login'; import Login from '../Login';
import styles from './Styles.module.css'; import styles from '../Styles.module.css';
// Fungsi simple untuk parsing token JWT dan mengembalikan payload JSON // Fungsi simple untuk parsing token JWT dan mengembalikan payload JSON
function parseJwt(token) { function parseJwt(token) {
@@ -90,7 +90,7 @@ const CoursePage = () => {
onMouseLeave={() => setHoveredCard(null)} onMouseLeave={() => setHoveredCard(null)}
> >
<div className={styles.courseImage}> <div className={styles.courseImage}>
{product.price === 0 && ( {product.price == 0 && (
<span className={styles.courseLabel}>Free</span> <span className={styles.courseLabel}>Free</span>
)} )}
</div> </div>
@@ -100,12 +100,12 @@ const CoursePage = () => {
<div className={styles.coursePrice}> <div className={styles.coursePrice}>
<span <span
className={ className={
product.price === 0 product.price == 0
? styles.freePrice ? styles.freePrice
: styles.currentPrice : styles.currentPrice
} }
> >
{product.price === 0 {product.price == 0
? 'Free' ? 'Free'
: `Rp ${product.price.toLocaleString('id-ID')}`} : `Rp ${product.price.toLocaleString('id-ID')}`}
</span> </span>