mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
feat(wired-ui): expand advanced wired editors
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { WiredActionDefinition } from '@nitrots/nitro-renderer';
|
||||
import { CSSProperties, FC, PropsWithChildren, ReactNode, useEffect } from 'react';
|
||||
import { WiredFurniType } from '../../../../api';
|
||||
import { useWired } from '../../../../hooks';
|
||||
import { WiredBaseView } from '../WiredBaseView';
|
||||
|
||||
export interface WiredExtraBaseViewProps
|
||||
{
|
||||
hasSpecialInput: boolean;
|
||||
requiresFurni: number;
|
||||
save: () => void;
|
||||
validate?: () => boolean;
|
||||
cardStyle?: CSSProperties;
|
||||
footer?: ReactNode;
|
||||
}
|
||||
|
||||
export const WiredExtraBaseView: FC<PropsWithChildren<WiredExtraBaseViewProps>> = props =>
|
||||
{
|
||||
const { requiresFurni = WiredFurniType.STUFF_SELECTION_OPTION_NONE, save = null, validate = null, hasSpecialInput = false, children = null, cardStyle = undefined, footer = null } = props;
|
||||
const { trigger = null, setActionDelay = null } = useWired();
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
setActionDelay((trigger as WiredActionDefinition)?.delayInPulses ?? 0);
|
||||
}, [ trigger, setActionDelay ]);
|
||||
|
||||
return (
|
||||
<WiredBaseView hasSpecialInput={ hasSpecialInput } requiresFurni={ requiresFurni } save={ save } validate={ validate } wiredType="extra" cardStyle={ cardStyle } footer={ footer }>
|
||||
{ children }
|
||||
</WiredBaseView>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user