Skip to content

Commit 6595779

Browse files
committed
Refactor pricing plans structure and rendering logic in script.js
- Consolidated starter and advanced plans into a single data structure. - Updated pricing card generation to include badges and original prices. - Enhanced color mapping for better visual distinction. - Improved navigation setup for mobile menu interactions. - Streamlined rendering functions for clarity and maintainability.
1 parent 90ead99 commit 6595779

3 files changed

Lines changed: 440 additions & 646 deletions

File tree

index.html

Lines changed: 104 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"@type": "Offer",
138138
"name": "Free Plan",
139139
"description": "Create your free TC Card digital identity with basic features. Includes customizable personal information fields, simple share options, a mobile-responsive design for your profile, and the ability to generate a shareable link. No NFC card included - digital profile only watermark present.",
140-
"url": "https://tccards.tn/plans/free/"
140+
"url": "https://tccards.tn/plans/free/#start"
141141
},
142142
{
143143
"@type": "Offer",
@@ -356,47 +356,57 @@
356356
<div class="header-wrapper">
357357
<canvas id="color-bends-canvas"></canvas>
358358
<header class="header-content" id="home">
359-
<div class="max-w-3xl mx-auto text-center">
360-
<div class="inline-flex items-center gap-2 bg-gray-900 backdrop-blur px-3 py-1 rounded-full text-sm font-medium mb-4">
361-
<span class="relative flex h-2 w-2">
362-
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-100 opacity-75"></span>
363-
<span class="relative inline-flex rounded-full h-2 w-2 bg-yellow-400"></span>
364-
</span>
365-
<p class="bg-gradient-to-br from-blue-200 via-blue-500 to-blue-100 bg-clip-text text-transparent">
366-
Digital Business Cards
367-
</p>
368-
</div>
369-
370-
<h1 class="text-5xl sm:text-6xl lg:text-7xl font-extrabold mb-6 leading-tight tracking-tight">
371-
<span class="bg-gradient-to-br from-blue-100 via-blue-400 to-blue-600 bg-clip-text text-transparent">
372-
Tap. Connect.
373-
</span>
374-
<span class="text-[#00ffff] drop-shadow-[0_0_8px_#00ffff] animate-pulse">
375-
Be Remembered.
376-
</span>
377-
</h1>
378-
379-
<p class="text-lg sm:text-xl lg:text-2xl text-gray-200 mb-8 max-w-2xl mx-auto leading-relaxed">
380-
No paper. No handoffs. Just one smooth tap — and they've got you.
381-
<span class="block mt-2">
382-
This isn't a business card. It's your first impression — evolved.
383-
</span>
384-
</p>
385-
386-
<div class="flex flex-col sm:flex-row gap-4 justify-center items-center mt-8">
387-
<a href="#learn-more"
388-
class="group px-8 py-4 border-2 border-blue-400 text-white rounded-xl font-semibold bg-gray-900 hover:bg-blue-500 transition-all duration-300 flex items-center gap-2">
389-
<span class="relative flex items-center">Learn More</span>
390-
<span class="inline-block ml-2 transition-transform group-hover:translate-x-2"></span>
391-
</a>
392-
<a href="/plans/"
393-
class="group px-8 py-4 border-2 border-yellow-400 text-yellow-200 rounded-xl font-semibold bg-yellow-900 hover:bg-yellow-500 transition-all duration-300 flex items-center gap-2">
394-
<span class="relative flex items-center">Get Started</span>
395-
<span class="inline-block ml-2 transition-transform group-hover:translate-x-2"></span>
396-
</a>
397-
</div>
359+
<div class="max-w-3xl mx-auto text-center">
360+
<!-- 标签 -->
361+
<div class="mb-3">
362+
<span class="inline-block px-4 py-1.5 rounded-full bg-blue-500/10 border border-blue-400/30 text-blue-300 text-sm font-medium tracking-wider">
363+
✦ Free Plan Available
364+
</span>
365+
</div>
366+
<!-- 主标题 -->
367+
<h2 class="text-4xl sm:text-5xl lg:text-6xl font-bold mb-3 text-white leading-tight">
368+
Your digital identity
369+
<span class="bg-gradient-to-br from-blue-200 via-blue-400 to-blue-600 bg-clip-text text-transparent">
370+
starts here
371+
</span>
372+
</h2>
373+
<!-- 副文案 -->
374+
<p class="text-base sm:text-lg text-gray-300/90 mb-8 max-w-lg mx-auto">
375+
Claim your unique @username and build your professional webfolio in minutes — no credit card needed.
376+
</p>
377+
378+
<!-- 输入区 -->
379+
<div class="flex flex-col sm:flex-row items-center justify-center gap-3 max-w-xl mx-auto">
380+
<div class="flex items-center w-full sm:flex-1 bg-gray-900/60 backdrop-blur-sm rounded-xl border border-gray-700/60 overflow-hidden focus-within:border-blue-400/70 transition-colors">
381+
<span class="text-gray-400 px-4 py-3.5 whitespace-nowrap text-sm font-mono border-r border-gray-700/50 bg-gray-800/30">
382+
at.tccards.tn/@
383+
</span>
384+
<input
385+
type="text"
386+
id="username-input"
387+
placeholder="yourname"
388+
class="bg-transparent text-white px-4 py-3.5 w-full focus:outline-none text-sm sm:text-base"
389+
pattern="^[a-zA-Z][a-zA-Z0-9-]*$"
390+
title="Start with a letter, use letters, numbers, or hyphens"
391+
autocomplete="off"
392+
spellcheck="false"
393+
/>
398394
</div>
399-
</header>
395+
<button
396+
id="go-button"
397+
class="px-8 py-3.5 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white font-semibold rounded-xl transition-all transform hover:scale-[1.03] shadow-lg shadow-blue-500/30 w-full sm:w-auto flex items-center justify-center gap-1.5 group"
398+
>
399+
Go <span class="inline-block transition-transform group-hover:translate-x-1"></span>
400+
</button>
401+
</div>
402+
403+
<!-- 底部提示 -->
404+
<p class="text-xs text-gray-400/80 mt-4 flex items-center justify-center gap-2">
405+
<span class="inline-block w-1.5 h-1.5 rounded-full bg-green-400"></span>
406+
Free to start • No credit card required • Instant setup
407+
</p>
408+
</div>
409+
</header>
400410
</div>
401411

402412
<!-- Rest of content unchanged -->
@@ -558,7 +568,59 @@ <h2 id="faq-title" class="text-4xl md:text-5xl font-bold mb-6 bg-gradient-to-br
558568
<script src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script>
559569
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
560570
<script src="script.js"></script>
561-
571+
<script>
572+
(function() {
573+
const input = document.getElementById('username-input');
574+
const goBtn = document.getElementById('go-button');
575+
576+
function getUsername() {
577+
return input.value.trim();
578+
}
579+
580+
function isValidUsername(name) {
581+
return /^[a-zA-Z][a-zA-Z0-9-]*$/.test(name);
582+
}
583+
584+
function showError() {
585+
input.classList.add('border-red-500', 'ring-2', 'ring-red-500/40');
586+
input.style.backgroundColor = 'rgba(220, 38, 38, 0.08)';
587+
setTimeout(() => {
588+
input.classList.remove('border-red-500', 'ring-2', 'ring-red-500/40');
589+
input.style.backgroundColor = '';
590+
}, 1800);
591+
}
592+
593+
function goToOnboarding() {
594+
const name = getUsername();
595+
if (!name) {
596+
input.focus();
597+
showError();
598+
return;
599+
}
600+
if (!isValidUsername(name)) {
601+
showError();
602+
return;
603+
}
604+
// 跳转到免费套餐注册页,带上用户名参数
605+
window.location.href = '/plans/free/#start?username=' + encodeURIComponent(name);
606+
}
607+
608+
goBtn.addEventListener('click', goToOnboarding);
609+
610+
input.addEventListener('keydown', function(e) {
611+
if (e.key === 'Enter') {
612+
e.preventDefault();
613+
goToOnboarding();
614+
}
615+
});
616+
617+
input.addEventListener('input', function() {
618+
input.classList.remove('border-red-500', 'ring-2', 'ring-red-500/40');
619+
input.style.backgroundColor = '';
620+
});
621+
})();
622+
</script>
623+
<script src="https://kit.fontawesome.com/your-fontawesome-kit.js" crossorigin="anonymous"></script>
562624
<!-- Three.js Shader Background - only inside header-wrapper -->
563625
<script type="module">
564626
import * as THREE from 'three';

0 commit comments

Comments
 (0)