-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: add state loading component #2117
base: next
Are you sure you want to change the base?
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const BottomLeftContainer = ({ children }: { children: React.ReactNode }) => { | ||
return <div className="absolute bottom-0 left-0">{children}</div>; | ||
}; | ||
|
||
export default BottomLeftContainer; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,10 @@ const BottomRightContainer = lazy(() => | |
const LeftMiddleContainer = lazy(() => import("../containers/LeftMiddleContainer")); | ||
const RightMiddleContainer = lazy(() => import("../containers/RightMiddleContainer")); | ||
const TopLeftContainer = lazy(() => import("../containers/TopLeftContainer")); | ||
const BottomLeftContainer = lazy(() => import("../containers/BottomLeftContainer")); | ||
const BottomLeftNavigation = lazy(() => | ||
import("../modules/navigation/BottomLeftNavigation").then((module) => ({ default: module.BottomLeftNavigation })), | ||
); | ||
const Tooltip = lazy(() => import("../elements/Tooltip").then((module) => ({ default: module.Tooltip }))); | ||
const BattleView = lazy(() => | ||
import("../modules/military/battle-view/BattleView").then((module) => ({ default: module.BattleView })), | ||
|
@@ -147,6 +151,10 @@ export const World = () => { | |
<TopLeftContainer> | ||
<TopLeftNavigation /> | ||
</TopLeftContainer> | ||
|
||
<BottomLeftContainer> | ||
<BottomLeftNavigation /> | ||
</BottomLeftContainer> | ||
Comment on lines
+154
to
+157
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Mobile handling is appropriate, but layout needs adjustment The BottomLeftNavigation component already has appropriate mobile handling through its conditional rendering based on
Recommendations:
🔗 Analysis chainVerify mobile device handling and layout positioning The new bottom-left components are added without mobile-specific handling, unlike other containers in the layout (e.g., BottomRightContainer). Please verify:
Let's check for any mobile-specific handling in the new components: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for mobile-specific handling in the new components
# Check BottomLeftContainer for mobile handling
echo "Checking BottomLeftContainer for mobile handling..."
rg -A 5 "IS_MOBILE" $(fd -t f "BottomLeftContainer.tsx$")
# Check BottomLeftNavigation for mobile handling
echo "Checking BottomLeftNavigation for mobile handling..."
rg -A 5 "IS_MOBILE" $(fd -t f "BottomLeftNavigation.tsx$")
# Check for potential layout conflicts
echo "Checking for other components with 'bottom-left' positioning..."
rg -i "bottom.?left" $(fd -t f -e tsx -e css)
Length of output: 766 Script: #!/bin/bash
# Let's check for mobile-specific styling and layout handling
# Check BottomLeftContainer styling and mobile handling
echo "Checking BottomLeftContainer styling..."
fd -t f "BottomLeftContainer" -x cat {}
# Check BottomLeftNavigation styling and mobile handling
echo "Checking BottomLeftNavigation styling..."
fd -t f "BottomLeftNavigation.tsx$" -x cat {}
# Check for any mobile-specific utilities or constants
echo "Checking for mobile utilities usage..."
rg "IS_MOBILE|isMobile|mobile" client/src/ui/layouts/World.tsx
# Check for any z-index or positioning conflicts
echo "Checking for positioning styles..."
rg "position:|z-index:|bottom:|left:" client/src/ui/layouts/World.tsx
Length of output: 1454 |
||
</div> | ||
|
||
<Redirect to="/" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import useUIStore from "@/hooks/store/useUIStore"; | ||
|
||
export const BottomLeftNavigation = () => { | ||
const eventsLoadingState = useUIStore((state) => state.eventsLoadingState); | ||
|
||
return eventsLoadingState ? ( | ||
<div className="flex flex-row mb-4 ml-4 items-center bg-hex bg-black/50 rounded-lg p-2"> | ||
<img src="/images/eternum-logo_animated.png" className="invert w-10 h-10" /> | ||
<div className="text-xs text-white/90 ml-2 animate-pulse">Game state is loading...</div> | ||
</div> | ||
) : null; | ||
Comment on lines
+6
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve accessibility and performance Several improvements can be made to enhance the component:
return eventsLoadingState ? (
<div className="flex flex-row mb-4 ml-4 items-center bg-hex bg-black/50 rounded-lg p-2">
- <img src="/images/eternum-logo_animated.png" className="invert w-10 h-10" />
- <div className="text-xs text-white/90 ml-2 animate-pulse">Game state is loading...</div>
+ <img
+ src="/images/eternum-logo_animated.png"
+ alt="Loading indicator"
+ className="invert w-10 h-10"
+ loading="lazy"
+ />
+ <div className="text-xs text-white ml-2 animate-pulse" role="status">
+ {t('loading.gameState')}
+ </div>
</div>
) : null;
|
||
}; |
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.
Improve event sync error handling and loading state management
Several concerns with the current implementation:
false
parameter is unclear and should be documentedConsider implementing this more robust approach:
📝 Committable suggestion