-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SRO preliminary buildTC and UI (#2536)
* preliminary buildTC and UI * refactor LightConeEditor * update compact build display, add tc lightcone editor * show current buildtc in teammate display, fix db bug * buildTC main level/stat/rarity editor * relic set/substat editors * pipe buildtc stats to calculator provider * refactor * refactor * fix build row flashing
- Loading branch information
Showing
37 changed files
with
1,825 additions
and
890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use client' | ||
import { useEffect, useRef, useState } from 'react' | ||
|
||
export function useRefOverflow() { | ||
const ref = useRef<HTMLElement>() | ||
|
||
const [isOverflowX, setIsOverflowX] = useState(false) | ||
const [isOverflowY, setIsOverflowY] = useState(false) | ||
|
||
useEffect(() => { | ||
const handleResize = () => { | ||
const ele = ref.current | ||
setIsOverflowX(ele ? isOverflowedX(ele) : false) | ||
setIsOverflowY(ele ? isOverflowedY(ele) : false) | ||
} | ||
handleResize() // Check on mount and whenever the window resizes | ||
window.addEventListener('resize', handleResize) | ||
return () => { | ||
window.removeEventListener('resize', handleResize) | ||
} | ||
}, []) // Safe to keep empty as we only want mount/unmount behavior | ||
return { isOverflowX, isOverflowY, ref } | ||
} | ||
function isOverflowedX(ref: HTMLElement) { | ||
return ref.scrollWidth > ref.clientWidth | ||
} | ||
|
||
function isOverflowedY(ref: HTMLElement) { | ||
return ref.scrollHeight > ref.clientHeight | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { useDataManagerBase } from '@genshin-optimizer/common/database-ui' | ||
import { useDatabaseContext } from '../context' | ||
export function useBuildTc(buildTcId: string | undefined) { | ||
const { database } = useDatabaseContext() | ||
return useDataManagerBase(database.buildTcs, buildTcId ?? '') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.