Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ VITE_CONTEXT = "branch-deploy"
"AF", "BY", "MM", "CF", "CU", "CD", "ET", "IR", "IQ", "LB", "LY", "ML", "NI", "KP", "RU", "SO", "SS", "SD", "VE", "YE", "ZW"
]}

[[redirects]]
from = "/v2/referrals*"
to = "/programs-unavailable-kr.html"
status = 302
force = true
conditions = { Country = ["KR"] }

[[redirects]]
from = "/v2/affiliates*"
to = "/programs-unavailable-kr.html"
status = 302
force = true
conditions = { Country = ["KR"] }

[[redirects]]
from = "/api/hubspot"
to = "/.netlify/functions/hubspot"
Expand Down
29 changes: 27 additions & 2 deletions packages/frontend/app/components/PageHeader/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default function PageHeader() {
// Feedback modal state
const [isFeedbackOpen, setIsFeedbackOpen] = useState(false);

const [countryISOCode, setCountryISOCode] = useState<string | null>(null);

// run the FUUL context
const { trackPageView } = useFuul();

Expand Down Expand Up @@ -391,21 +393,44 @@ export default function PageHeader() {

const { totVolume } = useReferralStore();

useEffect(() => {
fetch('/.netlify/functions/show-country')
.then((response) => response.json())
.then((data) => {
const detected = data?.country;
if (typeof detected === 'string') {
setCountryISOCode(detected.toUpperCase());
} else {
setCountryISOCode(null);
}
})
.catch(() => {
setCountryISOCode(null);
});
}, []);

// track page views with Fuul
useEffect(() => {
if (
isFuulInitialized &&
totVolume !== undefined &&
!Number.isNaN(totVolume) &&
// totVolume < 10000 &&
userDataStore.userAddress
userDataStore.userAddress &&
countryISOCode !== 'KR'
) {
console.log('sending pageview for: ', location.pathname);
trackPageView();
} else {
localStorage.removeItem('fuul.sent_pageview');
}
}, [location, isFuulInitialized, totVolume, userDataStore.userAddress]);
}, [
location,
isFuulInitialized,
totVolume,
userDataStore.userAddress,
countryISOCode,
]);

const showDepositSlot = isUserConnected || !isShortScreen;
const navigate = useNavigate();
Expand Down
84 changes: 84 additions & 0 deletions packages/frontend/public/programs-unavailable-kr.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Program Unavailable</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
background: #f8f9fa;
color: #222;
font-family: 'Segoe UI', Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
margin: 0;
}
.container {
background: #fff;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
padding: 2rem 2.5rem;
max-width: 440px;
text-align: center;
}
h1 {
color: #d32f2f;
margin-bottom: 0.5em;
}
p {
margin: 1em 0;
font-size: 1.05em;
line-height: 1.45;
}
.icon {
font-size: 3em;
margin-bottom: 0.5em;
color: #d32f2f;
}
.actions {
margin-top: 1.25rem;
}
.button {
display: inline-block;
background: #111827;
color: #fff;
text-decoration: none;
padding: 0.75rem 1.25rem;
border-radius: 10px;
font-weight: 600;
}
.button:focus,
.button:hover {
background: #0b1220;
}
@media (max-width: 500px) {
.container {
padding: 1.2rem 0.9rem;
}
}
</style>
</head>
<body>
<div class="container">
<div class="icon">🚫</div>
<h1>Program Unavailable</h1>
<p>
The Referrals and Affiliates programs are not currently
available in Korea.
<br />
한국에서는 현재 추천 및 제휴 프로그램을 이용하실 수 없습니다.
</p>
<p>
You can continue to use the trading interface.
<br />
거래 기능은 계속 이용하실 수 있습니다.
</p>
<div class="actions">
<a class="button" href="/v2/trade">Return to Trade</a>
</div>
</div>
</body>
</html>