diff --git a/package.json b/package.json index a9fcfa5..36ee313 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "@floating-ui/dom": "^1.6.13", "@types/node": "^22.13.9", "@vercel/analytics": "^1.5.0", - "@vercel/kv": "^3.0.0", "astro": "^5.4.2", "feed": "^4.2.2", "ioredis": "^5.6.0", diff --git a/src/components/AnnouncementBanner.astro b/src/components/AnnouncementBanner.astro index 5248dab..954f333 100644 --- a/src/components/AnnouncementBanner.astro +++ b/src/components/AnnouncementBanner.astro @@ -7,13 +7,28 @@ interface Props { const { announcement } = Astro.props; -const bgColorClass = { - info: 'bg-[rgb(var(--accent))] text-[rgb(var(--accent-text))]', - warning: 'bg-yellow-500 text-white', - success: 'bg-emerald-500 text-white' -}[announcement.type]; +// Define colors based on announcement type +const typeStyles = { + info: { + bgColor: 'bg-[rgb(var(--accent))]', + textColor: 'text-[rgb(var(--accent-text))]', + icon: 'info-icon' + }, + warning: { + bgColor: 'bg-yellow-500', + textColor: 'text-white', + icon: 'warning-icon' + }, + success: { + bgColor: 'bg-emerald-500', + textColor: 'text-white', + icon: 'success-icon' + } +}; -// Create a simple hash of the announcement content +const { bgColor, textColor, icon } = typeStyles[announcement.type]; + +// Create a simple hash of the announcement content for localStorage key const announcementHash = btoa(JSON.stringify({ message: announcement.message, type: announcement.type, @@ -21,44 +36,79 @@ const announcementHash = btoa(JSON.stringify({ })); --- -