@@ -6,16 +6,39 @@ type FFTData = FFTChannel[];
66interface BrightCandleViewProps {
77 fftData ?: FFTData ;
88 betaPower : number ;
9+ fullscreen ?: boolean ;
910}
1011
1112interface CandleLitProps {
1213 betaPower : number ;
1314}
1415
15- const BrightCandleView : React . FC < BrightCandleViewProps > = ( { fftData = [ ] , betaPower } ) => {
16+ const BrightCandleView : React . FC < BrightCandleViewProps > = ( { fftData = [ ] , betaPower, fullscreen } ) => {
1617 const brightness = Math . max ( 0 , betaPower / 100 ) ; // Normalize brightness
1718 // Add smoothing and minimum brightness
1819 const [ displayBrightness , setDisplayBrightness ] = useState ( 0.1 ) ; // Start with small flame
20+ const [ screenSize , setScreenSize ] = useState ( 'normal' ) ; // 'normal', 'large' (150%), 'xlarge' (175%)
21+
22+ useEffect ( ( ) => {
23+ // Detect screen size
24+ const detectScreenSize = ( ) => {
25+ const width = window . innerWidth ;
26+ if ( width >= 1920 ) { // Assuming 1920px is 175% of standard size
27+ setScreenSize ( 'xlarge' ) ;
28+ } else if ( width >= 1680 ) { // Assuming 1680px is 150% of standard size
29+ setScreenSize ( 'large' ) ;
30+ } else {
31+ setScreenSize ( 'normal' ) ;
32+ }
33+ } ;
34+
35+ // Set initial size
36+ detectScreenSize ( ) ;
37+
38+ // Update on resize
39+ window . addEventListener ( 'resize' , detectScreenSize ) ;
40+ return ( ) => window . removeEventListener ( 'resize' , detectScreenSize ) ;
41+ } , [ ] ) ;
1942
2043 useEffect ( ( ) => {
2144 // Always show at least a small flame (0.1) and cap at 1.0
@@ -53,10 +76,10 @@ const BrightCandleView: React.FC<BrightCandleViewProps> = ({ fftData = [], betaP
5376 // Generate a slightly randomized organic flame path
5477 const generateFlamePath = ( ) => {
5578 const basePoints = [
56- { x : 100 , y : 50 } ,
57- { x : 70 , y : 100 } ,
58- { x : 100 , y : 180 } ,
59- { x : 130 , y : 100 }
79+ { x : 100 , y : 30 } , // Adjusted Y positions
80+ { x : 60 , y : 80 } , // Increased vertical spread
81+ { x : 100 , y : 200 } , // Increased height
82+ { x : 140 , y : 80 } // Wider horizontal spread
6083 ] ;
6184 const controlPoints = basePoints . map ( point => ( {
6285 x : point . x + ( Math . random ( ) - 0.5 ) * ( 10 * brightness ) ,
@@ -69,28 +92,59 @@ const BrightCandleView: React.FC<BrightCandleViewProps> = ({ fftData = [], betaP
6992 ` ;
7093 } ;
7194
72- return (
73- < div className = "w-full h-full flex items-center justify-center min-h-0 min-w-0 " >
74- { /* Candle Container with reduced width */ }
75- < div className = "relative w-32 h-64 group" >
76- { /* Candle Holder with a glassy, frosted look */ }
77- < div className = "absolute bottom-0 w-full h-32
78- bg-gradient-to-b from-gray-100 to-gray-200 dark:from-stone-600 dark:to-stone-700
79- rounded-b-xl rounded-t-md
80- border border-gray-300 dark:border-white/20
81- backdrop-blur-md shadow-xl
82- transition-transform duration-300
83- before:absolute before:inset-0 before:bg-white/10 before:opacity-40 before:rounded-b-xl before:rounded-t-md
84- "
85- >
95+ // Calculate candle size based on screen size and fullscreen state
96+ const getCandleWidthClass = ( ) => {
97+ if ( fullscreen ) {
98+ return screenSize === 'xlarge' ? 'w-40' : screenSize === 'large' ? 'w-36' : 'w-32' ;
99+ } else {
100+ return screenSize === 'xlarge' ? 'w-28' : screenSize === 'large' ? 'w-24' : 'w-20' ;
101+ }
102+ } ;
86103
87- < div className = "absolute inset-0 overflow-hidden rounded-b-xl rounded-t-md bg-gradient-to-b from-cyan-300 via-blue-400 to-blue-400
88- " >
104+ const getCandleHeightClass = ( ) => {
105+ if ( fullscreen ) {
106+ return 'h-96' ;
107+ } else {
108+ return screenSize === 'xlarge' ? 'h-56' : screenSize === 'large' ? 'h-48' : 'h-40' ;
109+ }
110+ } ;
89111
90- < div className = "absolute top-2 left-2 right-2 h-0.5 bg-gray-300/30" > </ div >
112+ const getCandleHolderHeightClass = ( ) => {
113+ if ( fullscreen ) {
114+ return 'h-48' ;
115+ } else {
116+ return screenSize === 'xlarge' ? 'h-28' : screenSize === 'large' ? 'h-24' : 'h-20' ;
117+ }
118+ } ;
91119
120+ const getFlameHeightClass = ( ) => {
121+ if ( fullscreen ) {
122+ return 'h-64' ; // Increased from h-48
123+ } else {
124+ return screenSize === 'xlarge' ? 'h-56' : // Increased from h-40
125+ screenSize === 'large' ? 'h-48' : // Increased from h-36
126+ 'h-40' ; // Increased from h-32
127+ }
128+ } ;
129+ return (
130+ < div className = { `w-full h-full flex items-end justify-center min-h-0 min-w-0 ${ fullscreen ? 'pb-4' : '' } ` } >
131+ { /* Candle Container with dynamic width based on screen size and fullscreen mode */ }
132+ < div className = { `relative ${ getCandleWidthClass ( ) } ${ getCandleHeightClass ( ) } group` } >
133+ { /* Candle Holder with a glassy, frosted look */ }
134+ < div
135+ className = { `
136+ absolute bottom-0 w-full ${ getCandleHolderHeightClass ( ) }
137+ bg-gradient-to-b from-gray-100 to-gray-200 dark:from-stone-600 dark:to-stone-700
138+ rounded-t-md
139+ border border-gray-900 dark:border-gray-800 border-b-0
140+ backdrop-blur-md
141+ transition-transform duration-300
142+ before:absolute before:inset-0 before:bg-white/10 before:opacity-40 before:rounded-b-xl before:rounded-t-md
143+ ` }
144+ >
145+ < div className = "absolute inset-0 overflow-hidden rounded-t-md bg-gradient-to-b from-cyan-300 via-blue-400 to-gray-900" >
92146 < div className = "absolute top-2 left-1/2 transform -translate-x-1/2 text-center" >
93- < div className = " text-sm font-semibold text-gray-500 px-2 py-1 rounded-md " >
147+ < div className = { ` ${ fullscreen ? ' text-3xl' : screenSize === 'xlarge' ? 'text-2xl' : 'text-xl' } font-semibold text-[#030c21] px-2 py-1 rounded-md opacity-70` } >
94148 { String ( Math . floor ( betaPower ) ) . padStart ( 2 , '0' ) }
95149 </ div >
96150 </ div >
@@ -100,20 +154,20 @@ const BrightCandleView: React.FC<BrightCandleViewProps> = ({ fftData = [], betaP
100154 { /* Yellow-Themed Animated Flame */ }
101155 < svg
102156 xmlns = "http://www.w3.org/2000/svg"
103- viewBox = " 0 0 200 300"
104- className = " absolute top-0 left-1/2 transform -translate-x-1/2 w-full h-48 z-10 drop-shadow-xl"
157+ viewBox = { ` 0 0 200 ${ fullscreen ? 200 : 400 } ` } // Increased viewBox height
158+ className = { ` absolute top-0 left-1/2 transform -translate-x-1/2 w-full ${ getFlameHeightClass ( ) } z-10 drop-shadow-xl` }
105159 >
106160 < defs >
107161 { /* Outer Flame Gradient: Rich, Realistic Candle Flame Colors */ }
108162 < linearGradient id = "outerFlameGradient" x1 = "0%" y1 = "0%" x2 = "0%" y2 = "100%" >
109- < stop offset = "0%" stopColor = { `rgba(255,140,0, ${ brightness * 0.6 } )` } />
110- < stop offset = "100%" stopColor = { `rgba(255,69,0, ${ brightness * 0.3 } )` } />
163+ < stop offset = "0%" stopColor = { `rgba(255,140,0, ${ brightness * 1 } )` } />
164+ < stop offset = "100%" stopColor = { `rgba(255,69,0, ${ brightness * 0.6 } )` } />
111165 </ linearGradient >
112166
113167 { /* Inner Flame Gradient: Warm, Luminous Colors */ }
114168 < linearGradient id = "innerFlameGradient" x1 = "0%" y1 = "0%" x2 = "0%" y2 = "100%" >
115- < stop offset = "0%" stopColor = { `rgba(255,165,0, ${ brightness * 0.8 } )` } />
116- < stop offset = "100%" stopColor = { `rgba(255,99,71, ${ brightness * 0.5 } )` } />
169+ < stop offset = "0%" stopColor = { `rgba(255,165,0, ${ brightness * 1.2 } )` } />
170+ < stop offset = "100%" stopColor = { `rgba(255,99,71, ${ brightness * 0.8 } )` } />
117171 </ linearGradient >
118172
119173 { /* Filters for Enhanced Realism */ }
@@ -129,7 +183,6 @@ const BrightCandleView: React.FC<BrightCandleViewProps> = ({ fftData = [], betaP
129183 </ filter >
130184 </ defs >
131185
132-
133186 { /* Outer Flame Layer */ }
134187 < path
135188 d = { generateFlamePath ( ) }
@@ -145,23 +198,10 @@ const BrightCandleView: React.FC<BrightCandleViewProps> = ({ fftData = [], betaP
145198 filter = "url(#innerGlow)"
146199 className = "transition-all duration-300 animate-flicker"
147200 />
148-
149- { /* White Hot Core */ }
150- < ellipse
151- cx = "100"
152- cy = "150"
153- rx = { `${ 12 * brightness } ` }
154- ry = { `${ 24 * brightness } ` }
155- fill = { `rgba(255,255,255, ${ brightness * 0.6 } )` }
156- filter = "url(#innerGlow)"
157- className = "transition-all duration-300"
158- />
159201 </ svg >
160-
161-
162202 </ div >
163203 </ div >
164204 ) ;
165205} ;
166206
167- export default BrightCandleView ;
207+ export default BrightCandleView ;
0 commit comments