Reubencf commited on
Commit
7767652
·
1 Parent(s): 2a1df12

Fix Window component TypeScript error - simplify bounds prop

Browse files
app/components/Desktop.tsx CHANGED
@@ -41,7 +41,7 @@ import {
41
  } from '@phosphor-icons/react'
42
 
43
  export function Desktop() {
44
- const [fileManagerOpen, setFileManagerOpen] = useState(true)
45
  const [calendarOpen, setCalendarOpen] = useState(false)
46
  const [clockOpen, setClockOpen] = useState(false)
47
 
@@ -84,6 +84,7 @@ export function Desktop() {
84
  const [powerState, setPowerState] = useState<'active' | 'sleep' | 'restart' | 'shutdown'>('active')
85
 
86
  const openFileManager = (path: string) => {
 
87
  setCurrentPath(path)
88
  setFileManagerOpen(true)
89
  setFileManagerMinimized(false)
@@ -91,15 +92,18 @@ export function Desktop() {
91
 
92
  const closeFileManager = () => {
93
  setFileManagerOpen(false)
 
94
  }
95
 
96
  const openCalendar = () => {
 
97
  setCalendarOpen(true)
98
  setCalendarMinimized(false)
99
  }
100
 
101
  const closeCalendar = () => {
102
  setCalendarOpen(false)
 
103
  }
104
 
105
  const openClock = () => {
@@ -109,17 +113,20 @@ export function Desktop() {
109
 
110
  const closeClock = () => {
111
  setClockOpen(false)
 
112
  }
113
 
114
 
115
 
116
  const openGeminiChat = () => {
 
117
  setGeminiChatOpen(true)
118
  setGeminiChatMinimized(false)
119
  }
120
 
121
  const closeGeminiChat = () => {
122
  setGeminiChatOpen(false)
 
123
  }
124
 
125
 
@@ -131,6 +138,7 @@ export function Desktop() {
131
 
132
  const closeSessionManager = () => {
133
  setSessionManagerOpen(false)
 
134
  }
135
 
136
  const openFlutterRunner = (appFile: any) => {
@@ -141,6 +149,7 @@ export function Desktop() {
141
 
142
  const closeFlutterRunner = () => {
143
  setFlutterRunnerOpen(false)
 
144
  setActiveFlutterApp(null)
145
  }
146
 
@@ -151,6 +160,7 @@ export function Desktop() {
151
 
152
  const closeResearchBrowser = () => {
153
  setResearchBrowserOpen(false)
 
154
  }
155
 
156
  const openFlutterCodeEditor = () => {
@@ -160,6 +170,7 @@ export function Desktop() {
160
 
161
  const closeFlutterCodeEditor = () => {
162
  setFlutterCodeEditorOpen(false)
 
163
  }
164
 
165
  const openLaTeXEditor = () => {
@@ -169,6 +180,7 @@ export function Desktop() {
169
 
170
  const closeLaTeXEditor = () => {
171
  setLaTeXEditorOpen(false)
 
172
  }
173
 
174
  const handleOpenApp = (appId: string) => {
@@ -503,6 +515,20 @@ export function Desktop() {
503
  })
504
  }
505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
  return (
507
  <div className="relative h-screen w-screen overflow-hidden flex touch-auto" onContextMenu={handleDesktopRightClick}>
508
  <div
@@ -539,7 +565,6 @@ export function Desktop() {
539
  onOpenFileManager={openFileManager}
540
  onOpenCalendar={openCalendar}
541
  onOpenClock={openClock}
542
-
543
  onOpenGeminiChat={openGeminiChat}
544
  openApps={{
545
  files: fileManagerOpen,
@@ -550,7 +575,7 @@ export function Desktop() {
550
  minimizedApps={minimizedApps}
551
  />
552
 
553
- <div className="flex-1 z-10 relative">
554
  {/* Desktop Icons - Positioned in a grid layout - Hidden on mobile (use dock instead) */}
555
  <div className="absolute top-16 left-6 grid grid-flow-col grid-rows-[repeat(auto-fill,100px)] gap-x-4 gap-y-2 h-[calc(100vh-140px)] w-full pointer-events-none hidden lg:grid">
556
  <div className="pointer-events-auto w-24 h-24">
@@ -648,20 +673,29 @@ export function Desktop() {
648
  </div>
649
 
650
  <AnimatePresence>
651
- {fileManagerOpen && (
652
  <motion.div
653
  key="file-manager"
654
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
655
  animate={{
656
- scale: fileManagerMinimized ? 0.1 : 1,
657
- opacity: fileManagerMinimized ? 0 : 1,
658
- y: fileManagerMinimized ? 400 : 0,
659
- x: fileManagerMinimized ? '-40%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
660
  }}
661
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
662
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
663
- className="absolute inset-0"
664
- style={{ pointerEvents: fileManagerMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
665
  >
666
  <FileManager
667
  currentPath={currentPath}
@@ -675,39 +709,57 @@ export function Desktop() {
675
  </motion.div>
676
  )}
677
 
678
- {calendarOpen && (
679
  <motion.div
680
  key="calendar"
681
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
682
  animate={{
683
- scale: calendarMinimized ? 0.1 : 1,
684
- opacity: calendarMinimized ? 0 : 1,
685
- y: calendarMinimized ? 400 : 0,
686
- x: calendarMinimized ? '20%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
687
  }}
688
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
689
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
690
- className="absolute inset-0"
691
- style={{ pointerEvents: calendarMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
692
  >
693
  <Calendar onClose={closeCalendar} onMinimize={() => setCalendarMinimized(true)} />
694
  </motion.div>
695
  )}
696
 
697
- {clockOpen && (
698
  <motion.div
699
  key="clock"
700
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
701
  animate={{
702
- scale: clockMinimized ? 0.1 : 1,
703
- opacity: clockMinimized ? 0 : 1,
704
- y: clockMinimized ? 400 : 0,
705
- x: clockMinimized ? '10%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
706
  }}
707
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
708
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
709
- className="absolute inset-0"
710
- style={{ pointerEvents: clockMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
711
  >
712
  <Clock onClose={closeClock} onMinimize={() => setClockMinimized(true)} />
713
  </motion.div>
@@ -717,20 +769,29 @@ export function Desktop() {
717
 
718
 
719
 
720
- {sessionManagerOpen && sessionInitialized && (
721
  <motion.div
722
  key="session-manager"
723
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
724
  animate={{
725
- scale: sessionManagerMinimized ? 0.1 : 1,
726
- opacity: sessionManagerMinimized ? 0 : 1,
727
- y: sessionManagerMinimized ? 400 : 0,
728
- x: sessionManagerMinimized ? '40%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
729
  }}
730
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
731
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
732
- className="absolute inset-0"
733
- style={{ pointerEvents: sessionManagerMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
734
  >
735
  <SessionManagerWindow
736
  onClose={closeSessionManager}
@@ -741,20 +802,29 @@ export function Desktop() {
741
  </motion.div>
742
  )}
743
 
744
- {flutterRunnerOpen && activeFlutterApp && (
745
  <motion.div
746
  key="flutter-runner"
747
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
748
  animate={{
749
- scale: flutterRunnerMinimized ? 0.1 : 1,
750
- opacity: flutterRunnerMinimized ? 0 : 1,
751
- y: flutterRunnerMinimized ? 400 : 0,
752
- x: flutterRunnerMinimized ? '50%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  }}
754
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
755
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
756
- className="absolute inset-0"
757
- style={{ pointerEvents: flutterRunnerMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
758
  >
759
  <FlutterRunner
760
  initialCode={activeFlutterApp?.dartCode}
@@ -768,20 +838,29 @@ export function Desktop() {
768
  </motion.div>
769
  )}
770
 
771
- {researchBrowserOpen && (
772
  <motion.div
773
  key="research-browser"
774
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
775
  animate={{
776
- scale: researchBrowserMinimized ? 0.1 : 1,
777
- opacity: researchBrowserMinimized ? 0 : 1,
778
- y: researchBrowserMinimized ? 400 : 0,
779
- x: researchBrowserMinimized ? '-30%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  }}
781
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
782
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
783
- className="absolute inset-0"
784
- style={{ pointerEvents: researchBrowserMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
785
  >
786
  <ResearchBrowser
787
  onClose={closeResearchBrowser}
@@ -790,57 +869,84 @@ export function Desktop() {
790
  </motion.div>
791
  )}
792
 
793
- {flutterCodeEditorOpen && (
794
  <motion.div
795
  key="flutter-code-editor"
796
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
797
  animate={{
798
- scale: flutterCodeEditorMinimized ? 0.1 : 1,
799
- opacity: flutterCodeEditorMinimized ? 0 : 1,
800
- y: flutterCodeEditorMinimized ? 400 : 0,
801
- x: flutterCodeEditorMinimized ? '50%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
802
  }}
803
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
804
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
805
- className="absolute inset-0"
806
- style={{ pointerEvents: flutterCodeEditorMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
807
  >
808
  <FlutterCodeEditor onClose={closeFlutterCodeEditor} onMinimize={() => setFlutterCodeEditorMinimized(true)} />
809
  </motion.div>
810
  )}
811
 
812
- {latexEditorOpen && (
813
  <motion.div
814
  key="latex-editor"
815
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
816
  animate={{
817
- scale: latexEditorMinimized ? 0.1 : 1,
818
- opacity: latexEditorMinimized ? 0 : 1,
819
- y: latexEditorMinimized ? 400 : 0,
820
- x: latexEditorMinimized ? '60%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
821
  }}
822
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
823
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
824
- className="absolute inset-0"
825
- style={{ pointerEvents: latexEditorMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
826
  >
827
  <LaTeXEditor onClose={closeLaTeXEditor} sessionId={userSession} onMinimize={() => setLaTeXEditorMinimized(true)} />
828
  </motion.div>
829
  )}
830
- {geminiChatOpen && (
831
  <motion.div
832
  key="gemini"
833
- initial={{ scale: 0.8, opacity: 0, y: 100 }}
834
  animate={{
835
- scale: geminiChatMinimized ? 0.1 : 1,
836
- opacity: geminiChatMinimized ? 0 : 1,
837
- y: geminiChatMinimized ? 400 : 0,
838
- x: geminiChatMinimized ? '0%' : 0
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  }}
840
- exit={{ scale: 0.8, opacity: 0, y: 100 }}
841
- transition={{ duration: 0.4, ease: [0.32, 0.72, 0, 1] }}
842
- className="absolute inset-0"
843
- style={{ pointerEvents: geminiChatMinimized ? 'none' : 'auto', transformOrigin: 'bottom center' }}
844
  >
845
  <GeminiChat onClose={closeGeminiChat} onMinimize={() => setGeminiChatMinimized(true)} />
846
  </motion.div>
 
41
  } from '@phosphor-icons/react'
42
 
43
  export function Desktop() {
44
+ const [fileManagerOpen, setFileManagerOpen] = useState(false)
45
  const [calendarOpen, setCalendarOpen] = useState(false)
46
  const [clockOpen, setClockOpen] = useState(false)
47
 
 
84
  const [powerState, setPowerState] = useState<'active' | 'sleep' | 'restart' | 'shutdown'>('active')
85
 
86
  const openFileManager = (path: string) => {
87
+ console.log('Opening File Manager with path:', path)
88
  setCurrentPath(path)
89
  setFileManagerOpen(true)
90
  setFileManagerMinimized(false)
 
92
 
93
  const closeFileManager = () => {
94
  setFileManagerOpen(false)
95
+ setFileManagerMinimized(false)
96
  }
97
 
98
  const openCalendar = () => {
99
+ console.log('Opening Calendar')
100
  setCalendarOpen(true)
101
  setCalendarMinimized(false)
102
  }
103
 
104
  const closeCalendar = () => {
105
  setCalendarOpen(false)
106
+ setCalendarMinimized(false)
107
  }
108
 
109
  const openClock = () => {
 
113
 
114
  const closeClock = () => {
115
  setClockOpen(false)
116
+ setClockMinimized(false)
117
  }
118
 
119
 
120
 
121
  const openGeminiChat = () => {
122
+ console.log('Opening Gemini Chat')
123
  setGeminiChatOpen(true)
124
  setGeminiChatMinimized(false)
125
  }
126
 
127
  const closeGeminiChat = () => {
128
  setGeminiChatOpen(false)
129
+ setGeminiChatMinimized(false)
130
  }
131
 
132
 
 
138
 
139
  const closeSessionManager = () => {
140
  setSessionManagerOpen(false)
141
+ setSessionManagerMinimized(false)
142
  }
143
 
144
  const openFlutterRunner = (appFile: any) => {
 
149
 
150
  const closeFlutterRunner = () => {
151
  setFlutterRunnerOpen(false)
152
+ setFlutterRunnerMinimized(false)
153
  setActiveFlutterApp(null)
154
  }
155
 
 
160
 
161
  const closeResearchBrowser = () => {
162
  setResearchBrowserOpen(false)
163
+ setResearchBrowserMinimized(false)
164
  }
165
 
166
  const openFlutterCodeEditor = () => {
 
170
 
171
  const closeFlutterCodeEditor = () => {
172
  setFlutterCodeEditorOpen(false)
173
+ setFlutterCodeEditorMinimized(false)
174
  }
175
 
176
  const openLaTeXEditor = () => {
 
180
 
181
  const closeLaTeXEditor = () => {
182
  setLaTeXEditorOpen(false)
183
+ setLaTeXEditorMinimized(false)
184
  }
185
 
186
  const handleOpenApp = (appId: string) => {
 
515
  })
516
  }
517
 
518
+ // Debug info
519
+ useEffect(() => {
520
+ console.log('App States:', {
521
+ fileManagerOpen,
522
+ calendarOpen,
523
+ clockOpen,
524
+ geminiChatOpen,
525
+ fileManagerMinimized,
526
+ calendarMinimized,
527
+ clockMinimized,
528
+ geminiChatMinimized
529
+ })
530
+ }, [fileManagerOpen, calendarOpen, clockOpen, geminiChatOpen, fileManagerMinimized, calendarMinimized, clockMinimized, geminiChatMinimized])
531
+
532
  return (
533
  <div className="relative h-screen w-screen overflow-hidden flex touch-auto" onContextMenu={handleDesktopRightClick}>
534
  <div
 
565
  onOpenFileManager={openFileManager}
566
  onOpenCalendar={openCalendar}
567
  onOpenClock={openClock}
 
568
  onOpenGeminiChat={openGeminiChat}
569
  openApps={{
570
  files: fileManagerOpen,
 
575
  minimizedApps={minimizedApps}
576
  />
577
 
578
+ <div className="flex-1 z-10 relative pointer-events-auto">
579
  {/* Desktop Icons - Positioned in a grid layout - Hidden on mobile (use dock instead) */}
580
  <div className="absolute top-16 left-6 grid grid-flow-col grid-rows-[repeat(auto-fill,100px)] gap-x-4 gap-y-2 h-[calc(100vh-140px)] w-full pointer-events-none hidden lg:grid">
581
  <div className="pointer-events-auto w-24 h-24">
 
673
  </div>
674
 
675
  <AnimatePresence>
676
+ {fileManagerOpen && !fileManagerMinimized && (
677
  <motion.div
678
  key="file-manager"
679
+ initial={{ scale: 0.9, opacity: 0 }}
680
  animate={{
681
+ scale: 1,
682
+ opacity: 1,
683
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
684
+ }}
685
+ exit={{
686
+ scale: 0.2,
687
+ opacity: 0,
688
+ y: "80vh",
689
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
690
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
691
+ }}
692
+ transition={{ duration: 0.3, ease: "easeOut" }}
693
+ className="absolute"
694
+ style={{
695
+ transformOrigin: 'bottom center',
696
+ pointerEvents: 'auto',
697
+ zIndex: 1000
698
  }}
 
 
 
 
699
  >
700
  <FileManager
701
  currentPath={currentPath}
 
709
  </motion.div>
710
  )}
711
 
712
+ {calendarOpen && !calendarMinimized && (
713
  <motion.div
714
  key="calendar"
715
+ initial={{ scale: 0.9, opacity: 0 }}
716
  animate={{
717
+ scale: 1,
718
+ opacity: 1,
719
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
720
+ }}
721
+ exit={{
722
+ scale: 0.2,
723
+ opacity: 0,
724
+ y: "80vh",
725
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
726
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
727
+ }}
728
+ transition={{ duration: 0.3, ease: "easeOut" }}
729
+ className="absolute"
730
+ style={{
731
+ transformOrigin: 'bottom center',
732
+ pointerEvents: 'auto',
733
+ zIndex: 1000
734
  }}
 
 
 
 
735
  >
736
  <Calendar onClose={closeCalendar} onMinimize={() => setCalendarMinimized(true)} />
737
  </motion.div>
738
  )}
739
 
740
+ {clockOpen && !clockMinimized && (
741
  <motion.div
742
  key="clock"
743
+ initial={{ scale: 0.9, opacity: 0 }}
744
  animate={{
745
+ scale: 1,
746
+ opacity: 1,
747
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
748
+ }}
749
+ exit={{
750
+ scale: 0.2,
751
+ opacity: 0,
752
+ y: "80vh",
753
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
754
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
755
+ }}
756
+ transition={{ duration: 0.3, ease: "easeOut" }}
757
+ className="absolute"
758
+ style={{
759
+ transformOrigin: 'bottom center',
760
+ pointerEvents: 'auto',
761
+ zIndex: 1000
762
  }}
 
 
 
 
763
  >
764
  <Clock onClose={closeClock} onMinimize={() => setClockMinimized(true)} />
765
  </motion.div>
 
769
 
770
 
771
 
772
+ {sessionManagerOpen && sessionInitialized && !sessionManagerMinimized && (
773
  <motion.div
774
  key="session-manager"
775
+ initial={{ scale: 0.9, opacity: 0 }}
776
  animate={{
777
+ scale: 1,
778
+ opacity: 1,
779
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
780
+ }}
781
+ exit={{
782
+ scale: 0.2,
783
+ opacity: 0,
784
+ y: "80vh",
785
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
786
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
787
+ }}
788
+ transition={{ duration: 0.3, ease: "easeOut" }}
789
+ className="absolute"
790
+ style={{
791
+ transformOrigin: 'bottom center',
792
+ pointerEvents: 'auto',
793
+ zIndex: 1000
794
  }}
 
 
 
 
795
  >
796
  <SessionManagerWindow
797
  onClose={closeSessionManager}
 
802
  </motion.div>
803
  )}
804
 
805
+ {flutterRunnerOpen && activeFlutterApp && !flutterRunnerMinimized && (
806
  <motion.div
807
  key="flutter-runner"
808
+ initial={{ scale: 0.9, opacity: 0 }}
809
  animate={{
810
+ scale: 1,
811
+ opacity: 1,
812
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
813
+ }}
814
+ exit={{
815
+ scale: 0.2,
816
+ opacity: 0,
817
+ y: "80vh",
818
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
819
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
820
+ }}
821
+ transition={{ duration: 0.3, ease: "easeOut" }}
822
+ className="absolute"
823
+ style={{
824
+ transformOrigin: 'bottom center',
825
+ pointerEvents: 'auto',
826
+ zIndex: 1000
827
  }}
 
 
 
 
828
  >
829
  <FlutterRunner
830
  initialCode={activeFlutterApp?.dartCode}
 
838
  </motion.div>
839
  )}
840
 
841
+ {researchBrowserOpen && !researchBrowserMinimized && (
842
  <motion.div
843
  key="research-browser"
844
+ initial={{ scale: 0.9, opacity: 0 }}
845
  animate={{
846
+ scale: 1,
847
+ opacity: 1,
848
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
849
+ }}
850
+ exit={{
851
+ scale: 0.2,
852
+ opacity: 0,
853
+ y: "80vh",
854
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
855
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
856
+ }}
857
+ transition={{ duration: 0.3, ease: "easeOut" }}
858
+ className="absolute"
859
+ style={{
860
+ transformOrigin: 'bottom center',
861
+ pointerEvents: 'auto',
862
+ zIndex: 1000
863
  }}
 
 
 
 
864
  >
865
  <ResearchBrowser
866
  onClose={closeResearchBrowser}
 
869
  </motion.div>
870
  )}
871
 
872
+ {flutterCodeEditorOpen && !flutterCodeEditorMinimized && (
873
  <motion.div
874
  key="flutter-code-editor"
875
+ initial={{ scale: 0.9, opacity: 0 }}
876
  animate={{
877
+ scale: 1,
878
+ opacity: 1,
879
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
880
+ }}
881
+ exit={{
882
+ scale: 0.2,
883
+ opacity: 0,
884
+ y: "80vh",
885
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
886
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
887
+ }}
888
+ transition={{ duration: 0.3, ease: "easeOut" }}
889
+ className="absolute"
890
+ style={{
891
+ transformOrigin: 'bottom center',
892
+ pointerEvents: 'auto',
893
+ zIndex: 1000
894
  }}
 
 
 
 
895
  >
896
  <FlutterCodeEditor onClose={closeFlutterCodeEditor} onMinimize={() => setFlutterCodeEditorMinimized(true)} />
897
  </motion.div>
898
  )}
899
 
900
+ {latexEditorOpen && !latexEditorMinimized && (
901
  <motion.div
902
  key="latex-editor"
903
+ initial={{ scale: 0.9, opacity: 0 }}
904
  animate={{
905
+ scale: 1,
906
+ opacity: 1,
907
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
908
+ }}
909
+ exit={{
910
+ scale: 0.2,
911
+ opacity: 0,
912
+ y: "80vh",
913
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
914
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
915
+ }}
916
+ transition={{ duration: 0.3, ease: "easeOut" }}
917
+ className="absolute"
918
+ style={{
919
+ transformOrigin: 'bottom center',
920
+ pointerEvents: 'auto',
921
+ zIndex: 1000
922
  }}
 
 
 
 
923
  >
924
  <LaTeXEditor onClose={closeLaTeXEditor} sessionId={userSession} onMinimize={() => setLaTeXEditorMinimized(true)} />
925
  </motion.div>
926
  )}
927
+ {geminiChatOpen && !geminiChatMinimized && (
928
  <motion.div
929
  key="gemini"
930
+ initial={{ scale: 0.9, opacity: 0 }}
931
  animate={{
932
+ scale: 1,
933
+ opacity: 1,
934
+ clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)",
935
+ }}
936
+ exit={{
937
+ scale: 0.2,
938
+ opacity: 0,
939
+ y: "80vh",
940
+ clipPath: "polygon(45% 100%, 55% 100%, 60% 0%, 40% 0%)",
941
+ transition: { duration: 0.6, ease: [0.4, 0, 0.2, 1] }
942
+ }}
943
+ transition={{ duration: 0.3, ease: "easeOut" }}
944
+ className="absolute"
945
+ style={{
946
+ transformOrigin: 'bottom center',
947
+ pointerEvents: 'auto',
948
+ zIndex: 1000
949
  }}
 
 
 
 
950
  >
951
  <GeminiChat onClose={closeGeminiChat} onMinimize={() => setGeminiChatMinimized(true)} />
952
  </motion.div>
app/components/Dock.tsx CHANGED
@@ -48,6 +48,13 @@ const DockItem: React.FC<DockItemProps> = ({ icon, label, onClick, isActive = fa
48
  const [isHovered, setIsHovered] = useState(false)
49
  const ref = React.useRef<HTMLDivElement>(null)
50
 
 
 
 
 
 
 
 
51
  return (
52
  <div className="dock-item group" ref={ref}>
53
  <motion.button
@@ -55,7 +62,7 @@ const DockItem: React.FC<DockItemProps> = ({ icon, label, onClick, isActive = fa
55
  whileTap={{ scale: 0.95 }}
56
  onMouseEnter={() => setIsHovered(true)}
57
  onMouseLeave={() => setIsHovered(false)}
58
- onClick={onClick}
59
  className={`app-icon w-10 h-10 md:w-12 md:h-12 rounded-xl shadow-lg flex items-center justify-center cursor-pointer border transition-all ${className}`}
60
  title={label}
61
  >
 
48
  const [isHovered, setIsHovered] = useState(false)
49
  const ref = React.useRef<HTMLDivElement>(null)
50
 
51
+ const handleClick = () => {
52
+ console.log('Dock item clicked:', label)
53
+ if (onClick) {
54
+ onClick()
55
+ }
56
+ }
57
+
58
  return (
59
  <div className="dock-item group" ref={ref}>
60
  <motion.button
 
62
  whileTap={{ scale: 0.95 }}
63
  onMouseEnter={() => setIsHovered(true)}
64
  onMouseLeave={() => setIsHovered(false)}
65
+ onClick={handleClick}
66
  className={`app-icon w-10 h-10 md:w-12 md:h-12 rounded-xl shadow-lg flex items-center justify-center cursor-pointer border transition-all ${className}`}
67
  title={label}
68
  >
app/components/Window.tsx CHANGED
@@ -44,6 +44,7 @@ const Window: React.FC<WindowProps> = ({
44
  const [currentSize, setCurrentSize] = React.useState({ width, height });
45
  const [isMobile, setIsMobile] = React.useState(false);
46
  const [isDraggingOrResizing, setIsDraggingOrResizing] = React.useState(false);
 
47
 
48
  // Detect mobile device
49
  useEffect(() => {
@@ -98,17 +99,24 @@ const Window: React.FC<WindowProps> = ({
98
  if (onMaximize) onMaximize();
99
  };
100
 
 
 
 
 
 
 
101
  // Calculate Rnd props based on state
102
  const rndProps = isMaximized ? {
103
- position: { x: 0, y: 32 }, // 32px for TopBar offset
104
- size: { width: '100%', height: 'calc(100vh - 32px)' },
 
105
  disableDragging: true,
106
  enableResizing: false
107
  } : {
108
  position: currentPosition,
109
  size: currentSize,
110
  disableDragging: false,
111
- enableResizing: true
112
  };
113
 
114
  return (
@@ -120,12 +128,19 @@ const Window: React.FC<WindowProps> = ({
120
  dragHandleClassName="window-drag-handle"
121
  enableResizing={!isMaximized && resizable}
122
  disableDragging={isMaximized}
123
- onDragStart={() => setIsDraggingOrResizing(true)}
 
 
 
 
124
  onDragStop={(e, d) => {
125
  setIsDraggingOrResizing(false);
126
  if (!isMaximized) setCurrentPosition({ x: d.x, y: d.y });
127
  }}
128
- onResizeStart={() => setIsDraggingOrResizing(true)}
 
 
 
129
  onResizeStop={(e, direction, ref, delta, position) => {
130
  setIsDraggingOrResizing(false);
131
  if (!isMaximized) {
@@ -136,8 +151,8 @@ const Window: React.FC<WindowProps> = ({
136
  setCurrentPosition(position);
137
  }
138
  }}
139
- className={`pointer-events-auto ${!isDraggingOrResizing ? 'transition-all duration-300 ease-in-out' : ''}`}
140
- style={{ zIndex: 50 }}
141
  >
142
  <div
143
  className={`h-full macos-window flex flex-col ${className} ${windowClass}`}
 
44
  const [currentSize, setCurrentSize] = React.useState({ width, height });
45
  const [isMobile, setIsMobile] = React.useState(false);
46
  const [isDraggingOrResizing, setIsDraggingOrResizing] = React.useState(false);
47
+ const [zIndex, setZIndex] = React.useState(1000);
48
 
49
  // Detect mobile device
50
  useEffect(() => {
 
99
  if (onMaximize) onMaximize();
100
  };
101
 
102
+ // Global z-index counter
103
+ const bringToFront = () => {
104
+ // Increment z-index when window is clicked or dragged
105
+ setZIndex(Date.now());
106
+ };
107
+
108
  // Calculate Rnd props based on state
109
  const rndProps = isMaximized ? {
110
+ position: { x: 0, y: 40 }, // 40px for TopBar offset
111
+ size: { width: typeof window !== 'undefined' ? window.innerWidth : '100vw',
112
+ height: typeof window !== 'undefined' ? window.innerHeight - 40 : 'calc(100vh - 40px)' },
113
  disableDragging: true,
114
  enableResizing: false
115
  } : {
116
  position: currentPosition,
117
  size: currentSize,
118
  disableDragging: false,
119
+ enableResizing: resizable
120
  };
121
 
122
  return (
 
128
  dragHandleClassName="window-drag-handle"
129
  enableResizing={!isMaximized && resizable}
130
  disableDragging={isMaximized}
131
+ onMouseDown={bringToFront}
132
+ onDragStart={() => {
133
+ setIsDraggingOrResizing(true);
134
+ bringToFront();
135
+ }}
136
  onDragStop={(e, d) => {
137
  setIsDraggingOrResizing(false);
138
  if (!isMaximized) setCurrentPosition({ x: d.x, y: d.y });
139
  }}
140
+ onResizeStart={() => {
141
+ setIsDraggingOrResizing(true);
142
+ bringToFront();
143
+ }}
144
  onResizeStop={(e, direction, ref, delta, position) => {
145
  setIsDraggingOrResizing(false);
146
  if (!isMaximized) {
 
151
  setCurrentPosition(position);
152
  }
153
  }}
154
+ className="absolute"
155
+ style={{ zIndex }}
156
  >
157
  <div
158
  className={`h-full macos-window flex flex-col ${className} ${windowClass}`}
next.config.mjs CHANGED
@@ -10,6 +10,7 @@ const nextConfig = {
10
  output: 'standalone',
11
 
12
  // Configure for Hugging Face Spaces deployment
 
13
  experimental: {
14
  outputFileTracingRoot: undefined,
15
  },
 
10
  output: 'standalone',
11
 
12
  // Configure for Hugging Face Spaces deployment
13
+
14
  experimental: {
15
  outputFileTracingRoot: undefined,
16
  },
postcss.config.mjs CHANGED
@@ -4,4 +4,5 @@ const config = {
4
  },
5
  };
6
 
 
7
  export default config;
 
4
  },
5
  };
6
 
7
+
8
  export default config;
tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "compilerOptions": {
 
3
  "target": "ES2017",
4
  "lib": ["dom", "dom.iterable", "esnext"],
5
  "allowJs": true,
 
1
  {
2
  "compilerOptions": {
3
+
4
  "target": "ES2017",
5
  "lib": ["dom", "dom.iterable", "esnext"],
6
  "allowJs": true,