From fe6dd25859aa2854c0d6ab583b893bc87ff11a2a Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 12 Jul 2022 23:17:51 -0400 Subject: [PATCH] Changes --- .vscode/settings.json | 17 +- src/api/navigator/index.ts | 1 - src/assets/styles/index.scss | 2 +- .../widgets/context-menu/ContextMenuView.tsx | 30 ++-- .../FurnitureCustomStackHeightView.tsx | 2 +- .../context-menu/FurnitureContextMenuView.tsx | 166 ++---------------- .../WiredTriggerBotReachedStuffView.tsx | 2 +- src/hooks/rooms/widgets/furniture/index.ts | 1 + .../useFurnitureContextMenuWidget.ts | 152 ++++++++++++++++ .../furniture/useFurnitureStickieWidget.ts | 13 +- src/hooks/rooms/widgets/useInfostandWidget.ts | 5 + 11 files changed, 210 insertions(+), 181 deletions(-) create mode 100644 src/hooks/rooms/widgets/furniture/useFurnitureContextMenuWidget.ts create mode 100644 src/hooks/rooms/widgets/useInfostandWidget.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 0ac4ef4b..87146d22 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,17 +4,24 @@ "typescript.preferences.quoteStyle": "single", "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true, "typescript.format.placeOpenBraceOnNewLineForFunctions": true, + "typescript.format.enable": false, "editor.codeActionsOnSave": { - "source.fixAll": true, - "source.fixAll.sortJSON": false, + "source.fixAll.eslint": true, "source.organizeImports": true }, - "git.ignoreLimitWarning": true, + "git.ignoreLimitWarning": true, "files.eol": "\n", "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "editor.wordWrap": "on", "emmet.showExpandedAbbreviation": "never", - "eslint.validate": [ "javascript", "javascriptreact", "html", "typescriptreact" ], - "eslint.workingDirectories": [ "./src" ] + "eslint.validate": [ + "javascript", + "javascriptreact", + "html", + "typescriptreact" + ], + "eslint.workingDirectories": [ + "./src" + ] } diff --git a/src/api/navigator/index.ts b/src/api/navigator/index.ts index 77b0a417..bceb33e4 100644 --- a/src/api/navigator/index.ts +++ b/src/api/navigator/index.ts @@ -7,7 +7,6 @@ export * from './IRoomModel'; export * from './IRoomModerationSettings'; export * from './NavigatorSearchResultViewDisplayMode'; export * from './RoomInfoData'; -export * from './RoomSettingsData'; export * from './RoomSettingsUtils'; export * from './SearchFilterOptions'; export * from './TryVisitRoom'; diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index c909faf1..7427e6b4 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -7,7 +7,7 @@ @import './utils'; .btn-sm { - min-height: 28px; + min-height: 28px; } textarea { diff --git a/src/components/room/widgets/context-menu/ContextMenuView.tsx b/src/components/room/widgets/context-menu/ContextMenuView.tsx index 344e0f2b..7b3d984a 100644 --- a/src/components/room/widgets/context-menu/ContextMenuView.tsx +++ b/src/components/room/widgets/context-menu/ContextMenuView.tsx @@ -31,11 +31,9 @@ export const ContextMenuView: FC = props => const [ opacity, setOpacity ] = useState(1); const [ isFading, setIsFading ] = useState(false); const [ fadeTime, setFadeTime ] = useState(0); - const [ isFrozen, setIsFrozen ] = useState(false); + const [ isCollapsed, setIsCollapsed ] = useState(COLLAPSED); const elementRef = useRef(); - const [ collapsed, setCollapsed ] = useState(COLLAPSED); - const getOffset = useCallback((bounds: NitroRectangle) => { let height = -(elementRef.current.offsetHeight); @@ -125,14 +123,14 @@ export const ContextMenuView: FC = props => { const newClassNames: string[] = [ 'nitro-context-menu' ]; - if (collapsed) newClassNames.push('menu-hidden'); + if (isCollapsed) newClassNames.push('menu-hidden'); newClassNames.push((pos.x !== null) ? 'visible' : 'invisible'); if(classNames.length) newClassNames.push(...classNames); return newClassNames; - }, [ pos, classNames, collapsed ]); + }, [ pos, classNames, isCollapsed ]); const getStyle = useMemo(() => { @@ -155,20 +153,13 @@ export const ContextMenuView: FC = props => useEffect(() => { - let added = false; - - if(!isFrozen) - { - added = true; - - GetTicker().add(update); - } + GetTicker().add(update); return () => { - if(added) GetTicker().remove(update); + GetTicker().remove(update); } - }, [ isFrozen, update ]); + }, [ update ]); useEffect(() => { @@ -183,10 +174,13 @@ export const ContextMenuView: FC = props => const toggleCollapse = () => { COLLAPSED = !COLLAPSED; - setCollapsed(COLLAPSED) + setIsCollapsed(COLLAPSED); + setOpacity(0); + + console.log(opacity); } - return setIsFrozen(true) } onMouseOut={ event => setIsFrozen(false) } { ...rest }> + return { !(collapsable && COLLAPSED) && children } - { collapsable && toggleCollapse() } collapsed={ collapsed } /> } + { collapsable && toggleCollapse() } collapsed={ isCollapsed } /> } ; } diff --git a/src/components/room/widgets/furniture/FurnitureCustomStackHeightView.tsx b/src/components/room/widgets/furniture/FurnitureCustomStackHeightView.tsx index 38c78a12..bc1d716e 100644 --- a/src/components/room/widgets/furniture/FurnitureCustomStackHeightView.tsx +++ b/src/components/room/widgets/furniture/FurnitureCustomStackHeightView.tsx @@ -24,7 +24,7 @@ export const FurnitureCustomStackHeightView: FC<{}> = props => value={ height } onChange={ event => updateHeight(event) } renderThumb={ (props, state) =>
{ state.valueNow }
} /> - updateHeight(parseFloat(event.target.value)) } /> + updateHeight(parseFloat(event.target.value)) } />