-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/window wrapper #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||||||||||||
| import useWindowStore from "#store/window"; | ||||||||||||||||
| import { useGSAP } from "@gsap/react"; | ||||||||||||||||
| import { useLayoutEffect, useRef } from "react" | ||||||||||||||||
| import { useLayoutEffect, useRef, useState, useEffect } from "react" | ||||||||||||||||
| import gsap from "gsap"; | ||||||||||||||||
| import { Draggable } from "gsap/Draggable"; | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -20,9 +20,11 @@ import { Draggable } from "gsap/Draggable"; | |||||||||||||||
| */ | ||||||||||||||||
| const WindowWrapper = (Component, windowKey) => { | ||||||||||||||||
| const Wrapped = (props) => { | ||||||||||||||||
| const { focusWindow, windows } = useWindowStore(); | ||||||||||||||||
| const { isOpen, zIndex } = windows[windowKey]; | ||||||||||||||||
| const { focusWindow, windows, maximizeWindow, setWindowPosition } = useWindowStore(); | ||||||||||||||||
| const { isOpen, zIndex, isMinimized, isMaximized, savedPosition } = windows[windowKey]; | ||||||||||||||||
| const ref = useRef(null); | ||||||||||||||||
| const [shouldHighlightNav, setShouldHighlightNav] = useState(false); | ||||||||||||||||
| const draggableInstanceRef = useRef(null); | ||||||||||||||||
|
|
||||||||||||||||
| useGSAP(() => { | ||||||||||||||||
| const el = ref.current; | ||||||||||||||||
|
|
@@ -40,21 +42,103 @@ const WindowWrapper = (Component, windowKey) => { | |||||||||||||||
| const el = ref.current; | ||||||||||||||||
| if (!el) return; | ||||||||||||||||
|
|
||||||||||||||||
| const [instance] = Draggable.create(el, { onPress: () => focusWindow(windowKey) }); | ||||||||||||||||
| const [instance] = Draggable.create(el, { | ||||||||||||||||
| trigger: el.querySelector("#window-header"), | ||||||||||||||||
|
Comment on lines
+45
to
+46
|
||||||||||||||||
| const [instance] = Draggable.create(el, { | |
| trigger: el.querySelector("#window-header"), | |
| const headerEl = el.querySelector("#window-header"); | |
| if (!headerEl) return; | |
| const [instance] = Draggable.create(el, { | |
| trigger: headerEl, |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -37,7 +37,9 @@ body { | |||||
| } | ||||||
|
|
||||||
| nav { | ||||||
| @apply flex justify-between items-center bg-white/50 backdrop-blur-3xl p-2 px-5 select-none; | ||||||
| @apply flex justify-between items-center bg-white/50 backdrop-blur-3xl p-2 px-5 select-none relative z-40; | ||||||
|
||||||
| @apply flex justify-between items-center bg-white/50 backdrop-blur-3xl p-2 px-5 select-none relative z-40; | |
| @apply flex justify-between items-center bg-white/50 backdrop-blur-3xl p-2 px-5 select-none relative z-[9999]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indicator dot is shown when isOpen is true, but it should also consider the isMinimized state. According to typical window management UX patterns, the indicator should remain visible for minimized windows. However, verify if this matches the intended behavior - if minimized windows should not show the indicator, then the condition should be
isOpen && !isMinimized.