mirror of
https://github.com/SirBlobby/Hoya26.git
synced 2026-02-04 03:34:34 -05:00
UI Rework
This commit is contained in:
650
frontend/src/lib/components/WebHomePage.svelte
Normal file
650
frontend/src/lib/components/WebHomePage.svelte
Normal file
@@ -0,0 +1,650 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { fly, fade } from "svelte/transition";
|
||||
import ParallaxLandscape from "$lib/components/ParallaxLandscape.svelte";
|
||||
|
||||
interface Props {
|
||||
onProgressChange?: (progress: number) => void;
|
||||
}
|
||||
let { onProgressChange }: Props = $props();
|
||||
|
||||
const news = [
|
||||
{
|
||||
id: 1,
|
||||
title: "Ocean Cleanup Hits 500 Tons",
|
||||
desc: "Major milestone reached in the Pacific cleanup initiative.",
|
||||
date: "2h ago",
|
||||
icon: "ri:ship-line",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "Plastic Ban Starts Today",
|
||||
desc: "Big cities are saying no to single-use plastics.",
|
||||
date: "5h ago",
|
||||
icon: "ri:prohibited-line",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "Ethix Launches Globally",
|
||||
desc: "Our platform is now available worldwide.",
|
||||
date: "1d ago",
|
||||
icon: "ri:global-line",
|
||||
},
|
||||
];
|
||||
|
||||
const features = [
|
||||
{
|
||||
title: "Scan It",
|
||||
desc: "Point your camera at any product.",
|
||||
icon: "ri:scan-2-line",
|
||||
},
|
||||
{
|
||||
title: "Get Real Info",
|
||||
desc: "AI breaks down the real impact.",
|
||||
icon: "ri:information-line",
|
||||
},
|
||||
{
|
||||
title: "Find Better",
|
||||
desc: "See eco-friendly swaps instantly.",
|
||||
icon: "ri:leaf-line",
|
||||
},
|
||||
{
|
||||
title: "Call It Out",
|
||||
desc: "Report misleading green claims.",
|
||||
icon: "ri:megaphone-line",
|
||||
},
|
||||
];
|
||||
|
||||
const stats = [
|
||||
{ value: "50K+", label: "Scans" },
|
||||
{ value: "12K", label: "Users" },
|
||||
{ value: "98%", label: "Accuracy" },
|
||||
{ value: "24/7", label: "Support" },
|
||||
];
|
||||
|
||||
let sceneProgress = $state(0);
|
||||
let isEcoTheme = $derived(sceneProgress < 0.5);
|
||||
|
||||
function handleProgressChange(progress: number) {
|
||||
sceneProgress = progress;
|
||||
onProgressChange?.(progress);
|
||||
}
|
||||
|
||||
let scoreIndex = $state(0);
|
||||
const scores = [
|
||||
{
|
||||
label: "Fiji Water",
|
||||
score: "94/100",
|
||||
color: "#1ed760",
|
||||
image: "/water-bottle.png",
|
||||
scale: 0.7,
|
||||
},
|
||||
{
|
||||
label: "Plastic Bag",
|
||||
score: "12/100",
|
||||
color: "#e91429",
|
||||
image: "/plastic-bag.png",
|
||||
scale: 0.75,
|
||||
},
|
||||
{
|
||||
label: "Starbucks",
|
||||
score: "65/100",
|
||||
color: "#f59b23",
|
||||
image: "/coffee-cup.png",
|
||||
scale: 1,
|
||||
},
|
||||
];
|
||||
|
||||
onMount(() => {
|
||||
const interval = setInterval(() => {
|
||||
scoreIndex = (scoreIndex + 1) % scores.length;
|
||||
}, 4000);
|
||||
return () => clearInterval(interval);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="web-home" class:industrial-theme={!isEcoTheme}>
|
||||
<ParallaxLandscape onProgressChange={handleProgressChange} />
|
||||
|
||||
<section class="hero">
|
||||
<div class="glass-card hero-content">
|
||||
<div class="hero-badge">
|
||||
<iconify-icon icon="ri:eye-line" width="16"></iconify-icon>
|
||||
<span>See the real impact</span>
|
||||
</div>
|
||||
<h1 class="hero-title">
|
||||
Know What <br /> You Buy.
|
||||
</h1>
|
||||
<p class="hero-desc">
|
||||
Scan a product. See if it's actually good for the planet. Find
|
||||
better alternatives if it's not. Simple as that.
|
||||
</p>
|
||||
<div class="hero-actions">
|
||||
<a href="/catalogue" class="cta-primary">
|
||||
<iconify-icon icon="ri:store-2-fill" width="20"
|
||||
></iconify-icon>
|
||||
<span>Browse Database</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hero-visual">
|
||||
<div class="visual-container">
|
||||
<div class="hero-image">
|
||||
{#key scoreIndex}
|
||||
<div
|
||||
class="product-wrapper"
|
||||
in:fly={{ x: 100, duration: 500, opacity: 0 }}
|
||||
out:fly={{ x: -100, duration: 500, opacity: 0 }}
|
||||
>
|
||||
<img
|
||||
src={scores[scoreIndex].image}
|
||||
alt={scores[scoreIndex].label}
|
||||
class="product-image"
|
||||
style="transform: scale({scores[scoreIndex]
|
||||
.scale});"
|
||||
/>
|
||||
</div>
|
||||
{/key}
|
||||
</div>
|
||||
<div class="orbit orbit-1"></div>
|
||||
<div class="orbit orbit-2"></div>
|
||||
|
||||
<div class="floating-card glass-card">
|
||||
{#key scoreIndex}
|
||||
<div class="score-content" in:fade={{ duration: 300 }}>
|
||||
<iconify-icon
|
||||
icon="ri:checkbox-circle-fill"
|
||||
width="24"
|
||||
style="color: {scores[scoreIndex].color};"
|
||||
></iconify-icon>
|
||||
<div>
|
||||
<div class="card-label">
|
||||
{scores[scoreIndex].label}
|
||||
</div>
|
||||
<div class="card-value">
|
||||
{scores[scoreIndex].score}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/key}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="spacer"></div>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="glass-card stats-grid">
|
||||
{#each stats as stat}
|
||||
<div class="stat-item">
|
||||
<div class="stat-value">{stat.value}</div>
|
||||
<div class="stat-label">{stat.label}</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="section-header">
|
||||
<h2 class="section-title">How It Works</h2>
|
||||
<p class="section-desc">Tools to help you shop smarter.</p>
|
||||
</div>
|
||||
<div class="features-grid">
|
||||
{#each features as feature}
|
||||
<div class="glass-card feature-card">
|
||||
<div class="feature-icon">
|
||||
<iconify-icon icon={feature.icon} width="24"
|
||||
></iconify-icon>
|
||||
</div>
|
||||
<h3 class="feature-title">{feature.title}</h3>
|
||||
<p class="feature-desc">{feature.desc}</p>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="content-section">
|
||||
<div class="section-header">
|
||||
<h2 class="section-title">Latest News</h2>
|
||||
<p class="section-desc">
|
||||
Updates from the world of sustainability.
|
||||
</p>
|
||||
</div>
|
||||
<div class="news-grid">
|
||||
{#each news as item (item.id)}
|
||||
<article class="glass-card news-card">
|
||||
<div class="news-icon">
|
||||
<iconify-icon icon={item.icon} width="24"
|
||||
></iconify-icon>
|
||||
</div>
|
||||
<div class="news-meta">{item.date}</div>
|
||||
<h3 class="news-title">{item.title}</h3>
|
||||
<p class="news-desc">{item.desc}</p>
|
||||
<a href="/news/{item.id}" class="news-link">
|
||||
Read more
|
||||
<iconify-icon icon="ri:arrow-right-line" width="16"
|
||||
></iconify-icon>
|
||||
</a>
|
||||
</article>
|
||||
{/each}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="footer-spacer"></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.web-home {
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.glass-card {
|
||||
background: rgba(0, 0, 0, 0.35);
|
||||
backdrop-filter: blur(16px);
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 24px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
||||
transition: all 0.4s ease;
|
||||
}
|
||||
|
||||
.glass-card:hover {
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
border-color: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.hero {
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 60px;
|
||||
align-items: center;
|
||||
padding: 120px 60px;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
padding: 48px;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
.hero-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: rgba(16, 185, 129, 0.1);
|
||||
color: #34d399;
|
||||
padding: 10px 20px;
|
||||
border-radius: 50px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 24px;
|
||||
border: 1px solid rgba(16, 185, 129, 0.2);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1.5px;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 72px;
|
||||
font-weight: 900;
|
||||
line-height: 1.05;
|
||||
color: white;
|
||||
margin: 0 0 28px 0;
|
||||
letter-spacing: -2px;
|
||||
}
|
||||
|
||||
.hero-desc {
|
||||
font-size: 18px;
|
||||
line-height: 1.7;
|
||||
color: #d1d5db;
|
||||
margin: 0 0 36px 0;
|
||||
}
|
||||
|
||||
.hero-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.cta-primary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 18px 36px;
|
||||
border-radius: 50px;
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background: #10b981;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
text-decoration: none;
|
||||
box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.cta-primary:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 16px 40px rgba(16, 185, 129, 0.35);
|
||||
background: #059669;
|
||||
}
|
||||
|
||||
.hero-visual {
|
||||
position: relative;
|
||||
height: 500px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.visual-container {
|
||||
position: relative;
|
||||
width: 420px;
|
||||
height: 420px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
width: 360px;
|
||||
height: 360px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.product-wrapper {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.product-image {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
object-fit: contain;
|
||||
filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
|
||||
}
|
||||
|
||||
.orbit {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
border-radius: 50%;
|
||||
z-index: 1;
|
||||
animation: spin 25s linear infinite;
|
||||
}
|
||||
|
||||
.orbit-1 {
|
||||
width: 340px;
|
||||
height: 340px;
|
||||
}
|
||||
.orbit-2 {
|
||||
width: 480px;
|
||||
height: 480px;
|
||||
opacity: 0.4;
|
||||
animation-duration: 45s;
|
||||
animation-direction: reverse;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: translate(-50%, -50%) rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: translate(-50%, -50%) rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.floating-card {
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
bottom: 80px;
|
||||
padding: 16px 24px;
|
||||
min-width: 200px;
|
||||
z-index: 10;
|
||||
animation: float 4s ease-in-out infinite;
|
||||
background: rgba(5, 31, 24, 0.8);
|
||||
border: 1px solid rgba(52, 211, 153, 0.2);
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-12px);
|
||||
}
|
||||
}
|
||||
|
||||
.score-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card-label {
|
||||
font-size: 11px;
|
||||
color: #9ca3af;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.card-value {
|
||||
font-size: 22px;
|
||||
color: white;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 25vh;
|
||||
}
|
||||
.footer-spacer {
|
||||
height: 15vh;
|
||||
}
|
||||
|
||||
.content-section {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 60px 40px;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
text-align: center;
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 42px;
|
||||
font-weight: 800;
|
||||
color: white;
|
||||
margin: 0 0 12px 0;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.section-desc {
|
||||
font-size: 18px;
|
||||
color: #d1d5db;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 32px;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 48px;
|
||||
font-weight: 900;
|
||||
color: #34d399;
|
||||
margin-bottom: 4px;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 14px;
|
||||
color: #9ca3af;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
padding: 32px 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
background: rgba(16, 185, 129, 0.1);
|
||||
border-radius: 16px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #34d399;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.feature-title {
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.feature-desc {
|
||||
font-size: 14px;
|
||||
color: #9ca3af;
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.news-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
.news-card {
|
||||
padding: 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.news-icon {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
background: rgba(16, 185, 129, 0.1);
|
||||
border-radius: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #34d399;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.news-meta {
|
||||
font-size: 12px;
|
||||
color: #34d399;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.news-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin: 0 0 10px 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.news-desc {
|
||||
font-size: 14px;
|
||||
color: #d1d5db;
|
||||
line-height: 1.6;
|
||||
flex-grow: 1;
|
||||
margin: 0 0 20px 0;
|
||||
}
|
||||
|
||||
.news-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #34d399;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.news-link:hover {
|
||||
gap: 12px;
|
||||
color: #6ee7b7;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.hero {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 40px;
|
||||
padding: 100px 30px;
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.hero-title {
|
||||
font-size: 52px;
|
||||
}
|
||||
.hero-actions {
|
||||
justify-content: center;
|
||||
}
|
||||
.hero-visual {
|
||||
height: 400px;
|
||||
}
|
||||
.features-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.news-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user