Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
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.
42 changes: 42 additions & 0 deletions frontend/src/components/easter-eggs/FlyingBees.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as React from "react";
import bee from "src/assets/images/flying-bee.png";

type FlyingBee = { id: number; top: number };

export type FlyingBeesRef = {
addFlyingBee: () => void;
};

export const FlyingBees = React.forwardRef<FlyingBeesRef>((_, ref) => {
const [flyingBees, setFlyingBees] = React.useState<FlyingBee[]>([]);
const idCounter = React.useRef(0);

const addFlyingBee = React.useCallback(() => {
const randomTop = Math.floor(Math.random() * window.innerHeight * 0.8);
const newId = idCounter.current++;
setFlyingBees((prev) => [...prev, { id: newId, top: randomTop }]);
}, []);

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

React.useImperativeHandle(ref, () => ({
addFlyingBee,
}));

return (
<>
{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)}
/>
))}
</>
);
});
17 changes: 16 additions & 1 deletion frontend/src/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ import {
} from "src/components/ui/tooltip";
import { useAlbyMe } from "src/hooks/useAlbyMe";

import {
FlyingBees,
FlyingBeesRef,
} from "src/components/easter-eggs/FlyingBees";
import { useAlbyInfo } from "src/hooks/useAlbyInfo";
import { useHealthCheck } from "src/hooks/useHealthCheck";
import { useInfo } from "src/hooks/useInfo";
Expand All @@ -65,6 +69,7 @@ export default function AppLayout() {
const [mobileMenuOpen, setMobileMenuOpen] = React.useState(false);
const location = useLocation();
const navigate = useNavigate();
const flyingBeesRef = React.useRef<FlyingBeesRef>(null);
useRemoveSuccessfulChannelOrder();
useNotifyReceivedPayments();

Expand Down Expand Up @@ -133,7 +138,16 @@ export default function AppLayout() {
function MainMenuContent() {
return (
<>
<MenuItem to="/home">
<FlyingBees ref={flyingBeesRef} />
<MenuItem
to="/home"
onClick={(e) => {
if (location.pathname === "/home") {
flyingBeesRef.current?.addFlyingBee();
e.preventDefault();
}
}}
>
<Home className="h-4 w-4" />
Home
</MenuItem>
Expand Down Expand Up @@ -349,6 +363,7 @@ function AppVersion() {

function HealthIndicator() {
const { data: health } = useHealthCheck();

if (!health) {
return null;
}
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