File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed
Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11import inspect from "@rbxts/inspect"
22import Roact , { memo , useMemo } from "@rbxts/roact"
3- import { useRootProducer } from "store"
3+ import { useRootProducer , useRootSelector } from "store"
44import { Action } from "store/game"
55
66interface Props {
@@ -12,6 +12,8 @@ interface Props {
1212export const ActionSelection = memo ( ( props : Props ) => {
1313 const store = useRootProducer ( )
1414
15+ const showArgs = useRootSelector ( state => state . widget . showArgs )
16+
1517 const inspectedArgs = useMemo ( ( ) => inspect ( props . action . args ) , [ props . action ] )
1618
1719 const formattedTimestamp = DateTime . fromUnixTimestampMillis ( props . action . timestamp ) . FormatLocalTime (
@@ -67,6 +69,7 @@ export const ActionSelection = memo((props: Props) => {
6769 TextSize = { 16 }
6870 TextWrapped
6971 TextXAlignment = { Enum . TextXAlignment . Left }
72+ Visible = { showArgs }
7073 key = "args"
7174 />
7275 ) }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export function App() {
1717 const actions = useRootSelector ( state => state . game . actions )
1818 const selectedIndex = useRootSelector ( state => state . widget . selectedIndex )
1919 const autoSelectLatest = useRootSelector ( state => state . widget . autoSelectLatest )
20+ const showArgs = useRootSelector ( state => state . widget . showArgs )
2021
2122 const selectedAction = selectedIndex !== undefined ? actions [ selectedIndex ] : undefined
2223
@@ -55,6 +56,11 @@ export function App() {
5556 />
5657 < RowText order = { 4 } text = { `Selection Mode: ${ autoSelectLatest ? "Auto" : "Manual" } ` } />
5758
59+ < RowText order = { 3 } text = "•" />
60+
61+ < RowButton key = "showargs" onClick = { ( ) => store . changeShowArgs ( ! showArgs ) } order = { 5 } text = "Toggle" />
62+ < RowText order = { 6 } text = { `Show Args: ${ showArgs ? "Yes" : "No" } ` } />
63+
5864 < uilistlayout
5965 FillDirection = { Enum . FillDirection . Horizontal }
6066 HorizontalAlignment = { Enum . HorizontalAlignment . Left }
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ export interface Widget {
66 open : boolean
77 selectedIndex ?: number
88 autoSelectLatest : boolean
9+ showArgs : boolean
910}
1011
1112const initialState : Widget = {
1213 open : false ,
13- autoSelectLatest : true
14+ autoSelectLatest : true ,
15+ showArgs : true
1416}
1517
1618export const widget = createProducer ( initialState , {
@@ -26,5 +28,9 @@ export const widget = createProducer(initialState, {
2628 changeAutoSelectMode : ( state , mode : boolean ) => ( {
2729 ...state ,
2830 autoSelectLatest : mode
31+ } ) ,
32+ changeShowArgs : ( state , show : boolean ) => ( {
33+ ...state ,
34+ showArgs : show
2935 } )
3036} )
You can’t perform that action at this time.
0 commit comments