Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mullenpaul committed May 25, 2024
1 parent b50de9e commit 5ee37af
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions tgui/packages/tgui/interfaces/DropshipFlightControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ const StopLaunchAnnouncementAlarm = () => {
onClick={() => {
act('stop_playing_launch_announcement_alarm');
act('button-push');
}}>
}}
>
Stop Alarm
</Button>
);
Expand All @@ -351,7 +352,8 @@ const PlayLaunchAnnouncementAlarm = () => {
onClick={() => {
act('play_launch_announcement_alarm');
act('button-push');
}}>
}}
>
Start Alarm
</Button>
);
Expand All @@ -373,7 +375,12 @@ const LaunchAnnouncementAlarm = () => {
);
};

const DropshipButton = (props: { readonly shipId: string, readonly shipName: string, readonly disable: boolean, readonly onClick: () => void }) => {
const DropshipButton = (props: {
readonly shipId: string;
readonly shipName: string;
readonly disable: boolean;
readonly onClick: () => void;
}) => {
const { act, data } = useBackend<DropshipNavigationProps>();
const match = props.shipId === data.shuttle_id;

Expand All @@ -384,7 +391,8 @@ const DropshipButton = (props: { readonly shipId: string, readonly shipName: str
act('change_shuttle', { new_shuttle: props.shipId });
act('button-push');
props.onClick();
}}>
}}
>
{match && '['}
{props.shipName}
{match && ']'}
Expand All @@ -394,10 +402,12 @@ const DropshipButton = (props: { readonly shipId: string, readonly shipName: str

const DropshipSelector = () => {
const { data } = useBackend<DropshipNavigationProps>();
const [refreshTimeout, setRefreshTimeout] = useState<NodeJS.Timeout | undefined>(undefined);
const [refreshTimeout, setRefreshTimeout] = useState<
NodeJS.Timeout | undefined
>(undefined);

useEffect(() => {
if(refreshTimeout) {
if (refreshTimeout) {
return () => clearTimeout(refreshTimeout);
}
return () => {};
Expand All @@ -415,9 +425,13 @@ const DropshipSelector = () => {
shipName={x.name}
disable={refreshTimeout !== undefined}
onClick={() => {
const freeze = setTimeout(() => setRefreshTimeout(undefined), 2000);
const freeze = setTimeout(
() => setRefreshTimeout(undefined),
2000,
);
setRefreshTimeout(freeze);
}} />
}}
/>
))}
</Stack>
</Section>
Expand Down Expand Up @@ -452,8 +466,8 @@ const DropshipDisabledScreen = () => {
const { data } = useBackend<DropshipNavigationProps>();
return (
<>
{data.alternative_shuttles.length > 0 && <DropshipSelector />}
<DisabledScreen />
{data.alternative_shuttles.length > 0 && <DropshipSelector />}
<DisabledScreen />
</>
);
};
Expand Down

0 comments on commit 5ee37af

Please sign in to comment.