From 079af9709f75458e5f84d25ddd282b66a5aa4907 Mon Sep 17 00:00:00 2001 From: reidlab Date: Sun, 20 Aug 2023 20:03:30 -0700 Subject: [PATCH] switch to pretty-roact-hooks --- package.json | 2 +- .../StarterPlayerScripts/ui/config/config.tsx | 9 +++---- .../StarterPlayerScripts/ui/hotbar/slot.tsx | 9 +++---- yarn.lock | 25 ++++++++++++------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index f637509..707cbd5 100644 --- a/package.json +++ b/package.json @@ -38,11 +38,11 @@ "@rbxts/make": "^1.0.6", "@rbxts/matter": "^0.6.2-ts.6", "@rbxts/plasma": "^0.4.1-ts.1", + "@rbxts/pretty-roact-hooks": "^3.1.1", "@rbxts/reflex": "^4.2.0", "@rbxts/rewire": "^0.3.0", "@rbxts/roact": "^1.4.4-ts.0", "@rbxts/roact-hooked": "^2.6.0", - "@rbxts/roact-hooked-plus": "^1.8.1", "@rbxts/roact-reflex": "^2.1.0", "@rbxts/services": "^1.5.1", "@rbxts/testez": "^0.4.2-ts.0", diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx index f38eb23..ce5fc22 100644 --- a/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx +++ b/src/StarterPlayer/StarterPlayerScripts/ui/config/config.tsx @@ -1,10 +1,10 @@ import Roact from "@rbxts/roact" import { ContextActionService, HttpService } from "@rbxts/services" import { Spring } from "@rbxts/flipper" -import { useGroupMotor } from "@rbxts/roact-hooked-plus" import { useEffect } from "@rbxts/roact-hooked" import Item from "./item" import Surface from "ReplicatedStorage/ui/components/surface" +import { useMotor } from "@rbxts/pretty-roact-hooks" interface ConfigProps extends Roact.JsxInstanceProperties { shown: boolean @@ -13,8 +13,8 @@ interface ConfigProps extends Roact.JsxInstanceProperties { Change?: Roact.JsxInstanceChangeEvents } -const CONFIG_DEFAULT = [new Spring(1.5, { frequency: 6 })] -const CONFIG_ACTIVE = [new Spring(.5, { frequency: 6 })] +const CONFIG_DEFAULT = new Spring(1.5, { frequency: 6 }) +const CONFIG_ACTIVE = new Spring(.5, { frequency: 6 }) function config(props: ConfigProps): Roact.Element { let { shown } = props @@ -22,8 +22,7 @@ function config(props: ConfigProps): Roact.Element { const spreadableProps = { ...props } as Partial delete spreadableProps.shown - const [configPosYMap, setConfigGoal] = useGroupMotor([1.5]) - const configPosY = configPosYMap.map((t) => t[0]) + const [configPosY, setConfigGoal] = useMotor(1.5) useEffect(() => { const guid = HttpService.GenerateGUID(false) diff --git a/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx b/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx index b24dce1..261ba8e 100644 --- a/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx +++ b/src/StarterPlayer/StarterPlayerScripts/ui/hotbar/slot.tsx @@ -5,7 +5,7 @@ import { ContextActionService, HttpService } from "@rbxts/services" import Text from "ReplicatedStorage/ui/components/text" import Surface from "ReplicatedStorage/ui/components/surface" import { Spring } from "@rbxts/flipper" -import { useGroupMotor } from "@rbxts/roact-hooked-plus" +import { useMotor } from "@rbxts/pretty-roact-hooks" interface SlotProps extends Roact.JsxInstanceProperties { index: number @@ -16,8 +16,8 @@ interface SlotProps extends Roact.JsxInstanceProperties { Change?: Roact.JsxInstanceChangeEvents } -const SLOT_DEFAULT = [new Spring(0, { frequency: 6 }), new Spring(6, { frequency: 6 })] -const SLOT_ACTIVE = [new Spring(1, { frequency: 6 }), new Spring(5, { frequency: 6 })] +const SLOT_DEFAULT = new Spring(6, { frequency: 6 }) +const SLOT_ACTIVE = new Spring(5, { frequency: 6 }) function slot(props: SlotProps): Roact.Element { const { index, keycode, tool } = props @@ -27,8 +27,7 @@ function slot(props: SlotProps): Roact.Element { delete spreadableProps.keycode delete spreadableProps.tool - const [slotBorderColorAndSlotRatio, setSlotGoal] = useGroupMotor([0, 6]) - const slotRatio = slotBorderColorAndSlotRatio.map((t) => t[1]) + const [slotRatio, setSlotGoal] = useMotor(0) const { clientState } = useWorldContext() diff --git a/yarn.lock b/yarn.lock index 73f5dcd..5010b83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -131,6 +131,14 @@ resolved "https://registry.yarnpkg.com/@rbxts/plasma/-/plasma-0.4.1-ts.1.tgz#3d8db367c3220e6b6953cdddbf8af9f087165392" integrity sha512-RhLkC3GQW0KeyqjFwvOUbHhsIJOHmXg+BhcKLp0IgUDVgC5GktShi3zmW6GQ319yod+RlUDG1XHjOnP3Omo4bA== +"@rbxts/pretty-roact-hooks@^3.1.1": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@rbxts/pretty-roact-hooks/-/pretty-roact-hooks-3.1.1.tgz#b2729163bfd2c89e1efb91c544d7ddb798054fe0" + integrity sha512-eve1L7GWKZVo6ZLgcmk6c95SDvhTRIjWwR8notAz7g+CQ/jdtOoX+5fVHOQLMYE6HbQ79Bth+LO13WOM4T3WKg== + dependencies: + "@rbxts/services" "^1.5.1" + "@rbxts/set-timeout" "^1.1.2" + "@rbxts/reflex@^4.2.0": version "4.2.0" resolved "https://registry.yarnpkg.com/@rbxts/reflex/-/reflex-4.2.0.tgz#10d064de5e293f1aea429846d4d8739821cb575a" @@ -141,14 +149,6 @@ resolved "https://registry.yarnpkg.com/@rbxts/rewire/-/rewire-0.3.0.tgz#47f0cd651fe405cf418936799d2a4dac6b1bb7ce" integrity sha512-wChhGZ3kEkEsMK9ZuwKpwRsC7OGVZlvxrYMR3beFgCIPXE58JKLziBLkDACmd709XCCEmsMAqv9HMCMhSTD08Q== -"@rbxts/roact-hooked-plus@^1.8.1": - version "1.8.1" - resolved "https://registry.yarnpkg.com/@rbxts/roact-hooked-plus/-/roact-hooked-plus-1.8.1.tgz#e0fa32b74c0f958430ae62f249f1b5b52ce27f3b" - integrity sha512-ipJf6pZcQZlx/0hyisQz2eoRECg38knUgjkEvx2dvAHfs0+IDgera7mcwv6zTMACqalaXu00inc4E5dpOrs54A== - dependencies: - "@rbxts/flipper" "^2.0.1" - "@rbxts/services" "^1.2.0" - "@rbxts/roact-hooked@^2.6.0": version "2.6.0" resolved "https://registry.yarnpkg.com/@rbxts/roact-hooked/-/roact-hooked-2.6.0.tgz#cbe3e244e1d52d879083c62b6662c4d082c6d30b" @@ -164,11 +164,18 @@ resolved "https://registry.yarnpkg.com/@rbxts/roact/-/roact-1.4.4-ts.0.tgz#7f297bec03dbea9473bd2d82b148d3ae6e4f6c00" integrity sha512-gn9mBoGG/Clzgv2kyOvLNVd9dh5t6z+jukC3ITv2HnfPqvf/sMbz/VMaBoiB7t5umuiIe0LjW0ctZrkrS+uTOA== -"@rbxts/services@^1.2.0", "@rbxts/services@^1.5.1": +"@rbxts/services@^1.5.1": version "1.5.1" resolved "https://registry.yarnpkg.com/@rbxts/services/-/services-1.5.1.tgz#4536a87932f28797507ed591f0061277c52ea77f" integrity sha512-SRtfIjga0K4YYSXRpK+eH3kcTq7ZXo9OHOt0jszaOOoEOIJloMGlyuRPqesPHyhveh2AMXAZr3TYbRMSD+u+kQ== +"@rbxts/set-timeout@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@rbxts/set-timeout/-/set-timeout-1.1.2.tgz#2adc9d4b5dcb54ca4332eb7ec8d19793932dbd40" + integrity sha512-P/A0IiH9wuZdSJYr4Us0MDFm61nvIFR0acfKFHLkcOsgvIgELC90Up9ugiSsaMEHRIcIcO5UjE39LuS3xTzQHw== + dependencies: + "@rbxts/services" "^1.5.1" + "@rbxts/testez@^0.4.2-ts.0": version "0.4.2-ts.0" resolved "https://registry.yarnpkg.com/@rbxts/testez/-/testez-0.4.2-ts.0.tgz#4475183d317182ac7099bffee6492ffcb7bcaf0b"