Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add easter egg 🐝 #1115

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added frontend/src/assets/images/flying-bee.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 26 additions & 1 deletion frontend/src/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
} from "src/components/ui/tooltip";
import { useAlbyMe } from "src/hooks/useAlbyMe";

import bee from "src/assets/images/flying-bee.png";
import { useAlbyInfo } from "src/hooks/useAlbyInfo";
import { useHealthCheck } from "src/hooks/useHealthCheck";
import { useInfo } from "src/hooks/useInfo";
Expand Down Expand Up @@ -374,6 +375,20 @@ function AppVersion() {

function HealthIndicator() {
const { data: health } = useHealthCheck();
const [flyingBees, setFlyingBees] = React.useState<
Array<{ id: number; top: number }>
>([]);

const addFlyingBee = () => {
const randomTop = Math.floor(Math.random() * window.innerHeight * 0.8);
const newId = new Date().getTime();
setFlyingBees((prev) => [...prev, { id: newId, top: randomTop }]);
};

const handleAnimationEnd = (id: number) => {
setFlyingBees((prev) => prev.filter((item) => item.id !== id));
};

if (!health) {
return null;
}
Expand All @@ -400,7 +415,7 @@ function HealthIndicator() {
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger>
<TooltipTrigger onClick={addFlyingBee}>
<span className="text-xs flex items-center text-muted-foreground">
<div
className={cn(
Expand All @@ -427,6 +442,16 @@ function HealthIndicator() {
)}
</TooltipContent>
</Tooltip>
{flyingBees.map((item) => (
<img
key={item.id}
src={bee}
alt="🐝"
className="fixed left-0 w-32 pointer-events-none z-[9999] animate-fly-right"
style={{ top: item.top }}
onAnimationEnd={() => handleAnimationEnd(item.id)}
/>
))}
</TooltipProvider>
);
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,19 @@ module.exports = {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
flyRight: {
"0%": {
transform: "translateX(-100px)",
},
"100%": {
transform: "translateX(110vw)",
},
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
"fly-right": "flyRight 2s linear forwards",
"spin-slow": "spin 3s linear infinite",
},
fontFamily: {
Expand Down
Loading