fix(performance): eliminate device thermal throttling and remove expand icon from trendy bento

This commit is contained in:
2026-11-05 15:04:28 +05:30
parent 6635ecc6e2
commit b00566fb99
7 changed files with 220 additions and 97 deletions
+3 -33
View File
@@ -11,8 +11,6 @@ import {
SunMedium,
Layers,
ArrowRight,
Maximize2,
Minimize2,
GripHorizontal,
Smile,
Camera,
@@ -40,7 +38,6 @@ interface TileItem {
badge: string;
icon: React.ElementType;
imageUrl: string;
isWide?: boolean;
}
const CATEGORIES: { id: EffectCategory; label: string }[] = [
@@ -170,24 +167,13 @@ export function TrendyBentoSection({
subtitle = 'Discover our collection of viral AI effects. Tap any category to explore specialized tools.',
}: TrendyBentoSectionProps) {
const [activeCategory, setActiveCategory] = useState<EffectCategory>('all');
const [tiles, setTiles] = useState<TileItem[]>(INITIAL_TILES);
const tiles = INITIAL_TILES;
// Filtered tiles based on category
const displayedTiles = activeCategory === 'all'
? tiles
: tiles.filter((t) => t.category === activeCategory);
// Toggle individual tile width (1x1 to 2x1)
const toggleTileSize = (id: string, e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();
setTiles((prev) =>
prev.map((tile) =>
tile.id === id ? { ...tile, isWide: !tile.isWide } : tile
)
);
};
return (
<section id="trendy-effects" className="py-14 sm:py-20 px-4 sm:px-6 md:px-8 lg:px-10 bg-[#FAF8F5] relative overflow-hidden border-t border-slate-900/[0.06]">
{/* Symbolic Elemental Ambient Background Animation */}
@@ -252,9 +238,7 @@ export function TrendyBentoSection({
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
{displayedTiles.map((tile) => {
const Icon = tile.icon;
const tileClasses = tile.isWide
? 'col-span-1 sm:col-span-2 aspect-[16/9] sm:aspect-[2/1] rounded-[36px] sm:rounded-[42px]'
: 'col-span-1 aspect-square rounded-[36px] sm:rounded-[42px]';
const tileClasses = 'col-span-1 aspect-square rounded-[36px] sm:rounded-[42px]';
return (
<Link
@@ -279,25 +263,11 @@ export function TrendyBentoSection({
{/* Vignette Overlay for Readability (GPU Opacity) */}
<div className="absolute inset-0 bg-gradient-to-t from-slate-950/90 via-slate-950/30 to-slate-950/20 opacity-100 group-hover:opacity-85 transition-opacity duration-500 ease-[cubic-bezier(0.16,1,0.3,1)] pointer-events-none" />
{/* Top Tile Bar: Badge and Quick-Settings Resize Button */}
{/* Top Tile Bar: Badge */}
<div className="relative z-20 flex items-center justify-between p-5">
<span className="px-3 py-1 rounded-full text-[10px] font-mono font-bold tracking-wider uppercase bg-black/60 backdrop-blur-md text-cyan-400 border border-cyan-500/30 shadow-sm">
{tile.badge}
</span>
{/* Android Quick Settings Size Toggle Button (1x1 to 2x1) */}
<button
type="button"
onClick={(e) => toggleTileSize(tile.id, e)}
title={tile.isWide ? 'Shrink tile' : 'Expand tile'}
className="w-9 h-9 rounded-2xl bg-white/90 hover:bg-white text-slate-800 shadow-md flex items-center justify-center transition-[transform,background-color] duration-200 ease-[cubic-bezier(0.16,1,0.3,1)] hover:scale-110 active:scale-95 z-30"
>
{tile.isWide ? (
<Minimize2 className="w-4 h-4 text-blue-600" />
) : (
<Maximize2 className="w-4 h-4 text-blue-600" />
)}
</button>
</div>
{/* Bottom Tile Info & Link */}