Skip to content

Commit 865f1c6

Browse files
Merge pull request #471 from sei-protocol/new-year
add new year celebration
2 parents 28005a2 + f49b576 commit 865f1c6

File tree

7 files changed

+81
-16
lines changed

7 files changed

+81
-16
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"nextra": "^4.6.1",
3434
"nextra-theme-docs": "^4.6.1",
3535
"react": "^19.2.3",
36+
"react-confetti": "^6.4.0",
3637
"react-dom": "^19.2.3",
3738
"react-snowfall": "^2.4.0",
3839
"sonner": "^2.0.7",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use client';
2+
3+
import React from 'react';
4+
import ReactConfetti from 'react-confetti';
5+
6+
export const Confetti = () => {
7+
// We need window size for react-confetti to work properly full screen
8+
// If react-use is not available we might need a custom hook or just 100vw/100vh
9+
// Let's check if react-use is installed, otherwise fallback to CSS approach or basic hook
10+
11+
const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });
12+
13+
React.useEffect(() => {
14+
const updateDimensions = () => {
15+
setDimensions({
16+
width: window.innerWidth,
17+
height: window.innerHeight
18+
});
19+
};
20+
21+
// Initial set
22+
updateDimensions();
23+
24+
window.addEventListener('resize', updateDimensions);
25+
return () => window.removeEventListener('resize', updateDimensions);
26+
}, []);
27+
28+
return (
29+
<div className='fixed inset-0 w-screen h-screen z-0 pointer-events-none'>
30+
<ReactConfetti width={dimensions.width} height={dimensions.height} numberOfPieces={50} recycle={true} />
31+
</div>
32+
);
33+
};

src/components/Logo/Logo.tsx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ENABLE_CHRISTMAS_THEME } from '../../constants/featureFlags';
1+
import { ENABLE_CHRISTMAS_THEME, ENABLE_NEW_YEAR_THEME } from '../../constants/featureFlags';
22

33
export function Logo() {
44
return (
@@ -29,6 +29,15 @@ export function Logo() {
2929
<rect x='18' y='-4' width='36' height='8' rx='4' fill='white' />
3030
</g>
3131
)}
32+
{/* New Year Hat */}
33+
{ENABLE_NEW_YEAR_THEME && (
34+
<g transform='translate(15 5) rotate(-30) scale(1.2) translate(-36 0)'>
35+
<path d='M25 5 L 55 5 L 40 -35 Z' fill='#FFD700' />
36+
<circle cx='40' cy='-35' r='4' fill='#FF4500' />
37+
<circle cx='35' cy='-15' r='3' fill='#4169E1' />
38+
<circle cx='45' cy='-5' r='3' fill='#32CD32' />
39+
</g>
40+
)}
3241
</svg>
3342
);
3443
}
@@ -50,6 +59,15 @@ export function LogoMobile() {
5059
<rect x='18' y='-4' width='36' height='8' rx='4' fill='white' />
5160
</g>
5261
)}
62+
{/* New Year Hat */}
63+
{ENABLE_NEW_YEAR_THEME && (
64+
<g transform='translate(15 5) rotate(-30) scale(1.2) translate(-36 0)'>
65+
<path d='M25 5 L 55 5 L 40 -35 Z' fill='#FFD700' />
66+
<circle cx='40' cy='-35' r='4' fill='#FF4500' />
67+
<circle cx='35' cy='-15' r='3' fill='#4169E1' />
68+
<circle cx='45' cy='-5' r='3' fill='#32CD32' />
69+
</g>
70+
)}
5371
</svg>
5472
);
5573
}
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
'use client';
22

3-
import React from 'react';
43
import Snowfall from 'react-snowfall';
54

65
export const Snowflakes = () => {
76
return (
8-
<Snowfall
9-
style={{
10-
position: 'fixed',
11-
width: '100vw',
12-
height: '100vh',
13-
zIndex: 50,
14-
pointerEvents: 'none'
15-
}}
16-
snowflakeCount={200}
17-
/>
7+
<div className='fixed inset-0 w-screen h-screen z-40 pointer-events-none'>
8+
<Snowfall
9+
style={{
10+
position: 'absolute',
11+
width: '100%',
12+
height: '100%'
13+
}}
14+
snowflakeCount={150}
15+
/>
16+
</div>
1817
);
1918
};

src/constants/featureFlags.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export const ENABLE_CHRISTMAS_THEME = true;
2+
export const ENABLE_NEW_YEAR_THEME = false;

src/providers/DocsProviders.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { Layout, Navbar } from 'nextra-theme-docs';
44
import dynamic from 'next/dynamic';
55
import { AskAIAssistant } from '../components/AskAIAssistant/AskAIAssistant';
66
import { Logo, LogoMobile } from '../components/Logo';
7-
import React, { useState, useEffect } from 'react';
7+
import { useState, useEffect } from 'react';
88
import { Footer } from '../components/Footer/Footer';
99
import { Theme } from '@radix-ui/themes';
1010
import { ThemeSwitch } from 'nextra-theme-docs';
1111
import { usePathname } from 'next/navigation';
1212
import { Snowflakes } from '../components/Snowflakes/Snowflakes';
13-
import { ENABLE_CHRISTMAS_THEME } from '../constants/featureFlags';
13+
import { Confetti } from '../components/Confetti/Confetti';
14+
import { ENABLE_CHRISTMAS_THEME, ENABLE_NEW_YEAR_THEME } from '../constants/featureFlags';
1415

1516
// Defer Nextra Search until user clicks the trigger (client-only wrapper)
1617
const SearchDynamic = dynamic(() => import('../components/NextraSearch/NextraSearch'), { ssr: false, loading: () => <div /> });
@@ -58,7 +59,6 @@ export default function DocsProviders({ children, pageMap }) {
5859
<Navbar
5960
logo={<Logo />}
6061
logoLink='/'
61-
/* Remove excessive horizontal padding on small/medium screens; restore on large */
6262
className='flex items-center justify-between w-full dark:bg-neutral-900 bg-neutral-100 px-2 lg:px-4'
6363
children={
6464
<div className='flex items-center justify-between gap-4'>
@@ -88,8 +88,9 @@ export default function DocsProviders({ children, pageMap }) {
8888
{isMobile && <ConditionalNavbar />}
8989
<Theme accentColor='red' grayColor='gray' scaling='100%'>
9090
{ENABLE_CHRISTMAS_THEME && <Snowflakes />}
91+
{ENABLE_NEW_YEAR_THEME && <Confetti />}
9192
{!isMobile && <ConditionalNavbar />}
92-
{children}
93+
<div className='relative z-10'>{children}</div>
9394
</Theme>
9495
</Layout>
9596
</>

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7698,6 +7698,13 @@ react-compiler-runtime@^19.1.0-rc.2:
76987698
resolved "https://registry.yarnpkg.com/react-compiler-runtime/-/react-compiler-runtime-19.1.0-rc.1-rc-af1b7da-20250421.tgz#996cf954a27b7f73ade1710e44f4303fa84e80e2"
76997699
integrity sha512-Til/juI+Zfq+eYpGYn9lFxqW5RyJDs3ThOxmg0757aMrPpfx/Zb0SnGMVJhF3vw+bEQjJiD+xPFD3+kE0WbyeA==
77007700

7701+
react-confetti@^6.4.0:
7702+
version "6.4.0"
7703+
resolved "https://registry.yarnpkg.com/react-confetti/-/react-confetti-6.4.0.tgz#e9416b5b3c8baf6f0bb1c5a8e1e3c89babd2c837"
7704+
integrity sha512-5MdGUcqxrTU26I2EU7ltkWPwxvucQTuqMm8dUz72z2YMqTD6s9vMcDUysk7n9jnC+lXuCPeJJ7Knf98VEYE9Rg==
7705+
dependencies:
7706+
tween-functions "^1.2.0"
7707+
77017708
react-dom@^19.2.3:
77027709
version "19.2.3"
77037710
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.2.3.tgz#f0b61d7e5c4a86773889fcc1853af3ed5f215b17"
@@ -8689,6 +8696,11 @@ tsx@^4.19.3:
86898696
optionalDependencies:
86908697
fsevents "~2.3.3"
86918698

8699+
tween-functions@^1.2.0:
8700+
version "1.2.0"
8701+
resolved "https://registry.yarnpkg.com/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff"
8702+
integrity sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==
8703+
86928704
86938705
version "0.3.4"
86948706
resolved "https://registry.yarnpkg.com/twoslash-protocol/-/twoslash-protocol-0.3.4.tgz#276ccd73dbbc99e19d8df7214b28c01a04d2294a"

0 commit comments

Comments
 (0)