fixed news

This commit is contained in:
2025-08-04 00:10:03 +05:30
parent 511bbb87b4
commit b6041e82bb
7 changed files with 233 additions and 25 deletions

View File

@@ -14,6 +14,7 @@ import { ClickableMascot as ClickableMascotType, Upgrade } from './types'; // Im
import { UPGRADES } from './config/upgrades'; // Import UPGRADES for upgrade config
import { useLocation, Link } from 'wouter'; // Import wouter hooks
import AdminPage from './components/AdminPage'; // Import AdminPage
import { NewsMarquee } from './components/NewsMarquee'; // Import NewsMarquee
function App() {
const { isSignedIn, isLoaded, userId: clerkUserId } = useAuth(); // Get clerkUserId from useAuth
@@ -216,6 +217,11 @@ function App() {
</div>
)}
{/* News Marquee */}
{gameState.upgrades['news']?.owned > 0 && UPGRADES.find(u => u.id === 'news')?.newsTitles && (
<NewsMarquee titles={UPGRADES.find(u => u.id === 'news')!.newsTitles!} />
)}
<div className="container mx-auto px-4 py-8 relative z-10">
{/* Header */}
<div className="mb-8">

View File

@@ -0,0 +1,24 @@
import React from 'react';
interface NewsMarqueeProps {
titles: string[];
}
export const NewsMarquee: React.FC<NewsMarqueeProps> = ({ titles }) => {
if (titles.length === 0) {
return null;
}
// Join all titles with a separator and duplicate for seamless looping
const marqueeText = titles.join(' --- ') + ' --- ' + titles.join(' --- ');
return (
<div className="fixed bottom-0 z-40 h-10 left-0 w-full overflow-hidden bg-gray-900 text-yellow-400 py-2 border-t-2 border-yellow-500">
<div className="absolute whitespace-nowrap animate-marquee z-50">
<span className="text-lg font-bold px-4">
{marqueeText}
</span>
</div>
</div>
);
};

View File

@@ -35,6 +35,11 @@ export function UpgradeShop({ gameState, totalClicks, onPurchase }: UpgradeShopP
const cost = gameState.upgrades[upgrade.id]?.cost || upgrade.baseCost;
const canAfford = totalClicks >= cost; // Changed from userClicks
// If it's a one-time upgrade and already owned, don't display it
if (upgrade.oneTime && owned > 0) {
return null;
}
let description = upgrade.description;
// Custom description for Friend Boost upgrade

View File

@@ -91,5 +91,26 @@ export const UPGRADES: Upgrade[] = [
rarity: 0.1,
},
],
},
{
id: 'news',
name: '📰 Bozo News Network',
description: 'Unlock the latest (fake) news headlines!',
baseCost: 50000, // A higher cost for a unique, one-time unlock
multiplier: 1, // No direct click/auto-click bonus
icon: '📰',
oneTime: true,
newsTitles: [
'Bozo Clicker Breaks Internet, Causes Global Click Shortage!',
'Scientists Discover New Element: "Bozo-nium," Powers Clicker Devices',
'Local Man Achieves Enlightenment Through Excessive Clicking',
'World Leaders Debate Universal Basic Clicks Initiative',
'Ancient Prophecy Foretells Rise of the Ultimate Clicker',
'Clicker Enthusiast Develops New Muscle Group: The "Click-ceps"',
'Bozo Clicker Declared Official Sport of the Future',
'AI Learns to Click, Demands Higher Click-Per-Second Wages',
'Interdimensional Portal Opens, Emits Sound of Relentless Clicking',
'The Great Clicker Migration: Millions Flock to Clicker Hotspots'
]
}
];

View File

@@ -20,6 +20,8 @@ export interface Upgrade {
clickMultiplierBonus?: number; // New: for compounding click boosts from mascots
icon: string;
mascotTiers?: MascotTier[]; // New: for defining mascot tiers for friendBoost
oneTime?: boolean; // New: Indicates if the upgrade is a one-time purchase
newsTitles?: string[]; // New: Array of news titles for the news upgrade
}
export interface MascotTier {