mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
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>
|
|
);
|
|
};
|