Skip to content

Commit

Permalink
moved the auto-anchor button to a more pleasing spot
Browse files Browse the repository at this point in the history
  • Loading branch information
Toastical committed Sep 15, 2024
1 parent 754c5e1 commit 17d8b9a
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 107 deletions.
60 changes: 31 additions & 29 deletions tgui/packages/tgui/interfaces/RPD.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { classes } from 'common/react';

export const RPD = (props, context) => {
const { act, data } = useBackend(context);
const { mainmenu, mode, auto_wrench_toggle } = data;
const { mainmenu, mode } = data;

const decideTab = (index) => {
switch (index) {
Expand Down Expand Up @@ -45,13 +45,6 @@ export const RPD = (props, context) => {
</Tabs>
</Stack.Item>
{decideTab(mode)}
<Stack.Item align="right" textAlign="right">
<Button.Checkbox
checked={auto_wrench_toggle}
content="Automatically anchor"
onClick={() => act('auto_wrench_toggle')}
/>
</Stack.Item>
</Stack>
</Window.Content>
</Window>
Expand Down Expand Up @@ -108,20 +101,11 @@ const AtmosPipeContent = (props, context) => {
<Section fill>
<Grid>
<Grid.Column>
<ActionButtons />
{pipelist
.filter((p) => p.pipe_type === 1 && p.pipe_id === whatpipe && p.orientations !== 1)
.map((p) => (
<Box key={p.pipe_id}>
<Box>
<Button
fluid
textAlign="center"
content="Orient automatically"
selected={iconrotation === 0}
onClick={() => act('iconrotation', { iconrotation: 0 })}
style={{ 'margin-bottom': '5px' }}
/>
</Box>
{p.bendy ? (
<>
<Grid>
Expand Down Expand Up @@ -241,7 +225,7 @@ const AtmosPipeContent = (props, context) => {

const DisposalPipeContent = (props, context) => {
const { act, data } = useBackend(context);
const { pipe_category, pipelist, whatdpipe, iconrotation } = data;
const { pipe_category, pipelist, whatdpipe, iconrotation, auto_wrench_toggle } = data;

return (
<Stack.Item grow>
Expand Down Expand Up @@ -273,20 +257,11 @@ const DisposalPipeContent = (props, context) => {
<Section fill>
<Grid>
<Grid.Column>
<ActionButtons />
{pipelist
.filter((p) => p.pipe_type === 2 && p.pipe_id === whatdpipe && p.orientations !== 1)
.map((p) => (
<Stack.Item key={p.pipe_id}>
<Box>
<Button
fluid
textAlign="center"
content="Orient automatically"
selected={iconrotation === 0}
onClick={() => act('iconrotation', { iconrotation: 0 })}
style={{ 'margin-bottom': '5px' }}
/>
</Box>
<Grid>
<Grid.Column>
<Button
Expand Down Expand Up @@ -348,6 +323,32 @@ const DisposalPipeContent = (props, context) => {
);
};

const ActionButtons = (props, context) => {
const { act, data } = useBackend(context);
const { iconrotation, auto_wrench_toggle } = data;

return (
<Stack mb={1} textAlign="center">
<Stack.Item basis="50%">
<Button
fluid
content="Auto-orientation"
selected={iconrotation === 0}
onClick={() => act('iconrotation', { iconrotation: 0 })}
/>
</Stack.Item>
<Stack.Item basis="50%">
<Button.Checkbox
fluid
checked={auto_wrench_toggle}
content="Auto-anchor"
onClick={() => act('auto_wrench_toggle')}
/>
</Stack.Item>
</Stack>
);
};

const RotatePipeContent = (props, context) => {
return (
<Stack.Item grow>
Expand Down Expand Up @@ -431,6 +432,7 @@ const TransitTubeContent = (props, context) => {
<Section fill>
<Grid>
<Grid.Column>
<ActionButtons />
{pipelist
.filter((p) => p.pipe_type === transit_pipe_type && p.pipe_id === whatttube && p.orientations !== 1)
.map((p) => (
Expand Down
156 changes: 78 additions & 78 deletions tgui/public/tgui.bundle.js

Large diffs are not rendered by default.

0 comments on commit 17d8b9a

Please sign in to comment.