Skip to content

Commit

Permalink
Removes missing context from Skyrat UI files, and labels the Skyrat U…
Browse files Browse the repository at this point in the history
…I files.(#1042)

* Removes the rest of context from skyrat uis

* Adds a comment labeling skyrat ui files

* Adds remaining labels to skyrat tsx files

Fixes some skyrat edits that were not skyrat edits

* Missed these two

Co-authored-by: Bloop <[email protected]>
  • Loading branch information
Steals-The-PRs and vinylspiders authored Dec 9, 2023
1 parent a711ecf commit fa32acd
Show file tree
Hide file tree
Showing 44 changed files with 160 additions and 218 deletions.
25 changes: 11 additions & 14 deletions tgui/packages/tgui/interfaces/AmmoWorkbench.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// THIS IS A SKYRAT UI FILE
import { toTitleCase } from 'common/string';
import { useBackend, useSharedState, useLocalState } from '../backend';
import { Box, Button, NumberInput, NoticeBox, ProgressBar, Section, Flex, Stack, RoundGauge, Tabs, Table, Tooltip } from '../components';
import { Window } from '../layouts';

export const AmmoWorkbench = (props, context) => {
const [tab, setTab] = useSharedState(context, 'tab', 1);
export const AmmoWorkbench = (props) => {
const [tab, setTab] = useSharedState('tab', 1);
return (
<Window
width={600}
Expand All @@ -31,8 +32,8 @@ export const AmmoWorkbench = (props, context) => {
);
};

export const AmmunitionsTab = (props, context) => {
const { act, data } = useBackend(context);
export const AmmunitionsTab = (props) => {
const { act, data } = useBackend();
const {
mag_loaded,
system_busy,
Expand Down Expand Up @@ -141,8 +142,8 @@ export const AmmunitionsTab = (props, context) => {
);
};

export const MaterialsTab = (props, context) => {
const { act, data } = useBackend(context);
export const MaterialsTab = (props) => {
const { act, data } = useBackend();
const { materials = [] } = data;
return (
<Section title="Materials">
Expand All @@ -164,8 +165,8 @@ export const MaterialsTab = (props, context) => {
);
};

export const DatadiskTab = (props, context) => {
const { act, data } = useBackend(context);
export const DatadiskTab = (props) => {
const { act, data } = useBackend();
const {
loaded_datadisks = [],
datadisk_loaded,
Expand Down Expand Up @@ -222,14 +223,10 @@ export const DatadiskTab = (props, context) => {
);
};

const MaterialRow = (props, context) => {
const MaterialRow = (props) => {
const { material, onRelease } = props;

const [amount, setAmount] = useLocalState(
context,
'amount' + material.name,
1
);
const [amount, setAmount] = useLocalState('amount' + material.name, 1);

const amountAvailable = Math.floor(material.amount);
return (
Expand Down
5 changes: 1 addition & 4 deletions tgui/packages/tgui/interfaces/AntagInfoAssaultops.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// THIS IS A SKYRAT UI FILE
import { useBackend, useLocalState } from '../backend';
import { LabeledList, Stack, Button, Section, ProgressBar, Box, Tabs, Divider } from '../components';
import { BooleanLike } from 'common/react';
import { Window } from '../layouts';
// SKYRAT EDIT BEGIN
import { Rules } from './AntagInfoRules';
// SKYRAT EDIT END

type Objectives = {
count: number;
Expand Down Expand Up @@ -120,11 +119,9 @@ export const AntagInfoAssaultops = (props) => {
{tab === 1 && <TargetPrintout />}
{tab === 2 && <KeyPrintout />}
</Stack.Item>
{/* SKYRAT EDIT ADDITION START */}
<Stack.Item>
<Rules />
</Stack.Item>
{/* SKYRAT EDIT ADDITION END */}
</Stack>
</Window.Content>
</Window>
Expand Down
6 changes: 1 addition & 5 deletions tgui/packages/tgui/interfaces/AntagInfoClock.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Icon, Section, Stack } from '../components';
import { Window } from '../layouts';
// SKYRAT EDIT BEGIN
import { Rules } from './AntagInfoRules';
// SKYRAT EDIT END

type Info = {
antag_name: string;
};

// SKYRAT EDIT change height from 250 to 350
export const AntagInfoClock = (props) => {
const { data } = useBackend<Info>();
const { antag_name } = data;
Expand All @@ -23,11 +21,9 @@ export const AntagInfoClock = (props) => {
{' You are the ' + antag_name + '! '}
<Icon name={'cog'} rotation={35} spin />
</Stack.Item>
{/* SKYRAT EDIT ADDITION START */}
<Stack.Item>
<Rules />
</Stack.Item>
{/* SKYRAT EDIT ADDITION END */}
<Stack.Item>
<ObjectivePrintout />
</Stack.Item>
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/AntagInfoOpfor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { Section, Stack, Button } from '../components';
import { Window } from '../layouts';
import { useBackend } from '../backend';
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/AntagInfoRules.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Stack } from '../components';
import { Objective } from './common/Objectives';
Expand Down
9 changes: 5 additions & 4 deletions tgui/packages/tgui/interfaces/ArmamentStation.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// THIS IS A SKYRAT UI FILE
import { useBackend, useLocalState } from '../backend';
import { Section, Stack, Box, Divider, Button, NoticeBox } from '../components';
import { Window } from '../layouts';

export const ArmamentStation = (props, context) => {
const [category, setCategory] = useLocalState(context, 'category', '');
const [weapon, setArmament] = useLocalState(context, 'weapon');
const { act, data } = useBackend(context);
export const ArmamentStation = (props) => {
const [category, setCategory] = useLocalState('category', '');
const [weapon, setArmament] = useLocalState('weapon');
const { act, data } = useBackend();
const { armaments_list = [], card_inserted, card_points, card_name } = data;
return (
<Window theme="armament" title="Armament Station" width={1000} height={600}>
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/BluespaceArtillery.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { BooleanLike } from 'common/react';
import { useBackend } from '../backend';
import { Box, Button, LabeledList, NoticeBox, Section } from '../components';
Expand Down
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/BorerChem.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// THIS IS A SKYRAT UI FILE
import { toFixed } from 'common/math';
import { useBackend } from '../backend';
import { Box, Button, LabeledList, ProgressBar, Section } from '../components';
import { Window } from '../layouts';

export const BorerChem = (props, context) => {
const { act, data } = useBackend(context);
export const BorerChem = (props) => {
const { act, data } = useBackend();
const borerTransferAmounts = data.borerTransferAmounts || [];
return (
<Window width={565} height={400} title="Injector" theme="wizard">
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/BorerEvolution.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Section, Stack, Button, BlockQuote } from '../components';
import { Window } from '../layouts';
Expand Down
9 changes: 5 additions & 4 deletions tgui/packages/tgui/interfaces/CargoImportConsole.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// THIS IS A SKYRAT UI FILE
import { useBackend, useLocalState } from '../backend';
import { Section, Stack, Box, Divider, Button } from '../components';
import { Window } from '../layouts';

export const CargoImportConsole = (props, context) => {
const [category, setCategory] = useLocalState(context, 'category', '');
const [weapon, setArmament] = useLocalState(context, 'weapon');
const { act, data } = useBackend(context);
export const CargoImportConsole = (props) => {
const [category, setCategory] = useLocalState('category', '');
const [weapon, setArmament] = useLocalState('weapon');
const { act, data } = useBackend();
const {
armaments_list = [],
budget_points,
Expand Down
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/ChemPress.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Box, Button, Input, LabeledList, NumberInput, Section } from '../components';
import { Window } from '../layouts';

export const ChemPress = (props, context) => {
const { act, data } = useBackend(context);
export const ChemPress = (props) => {
const { act, data } = useBackend();
const {
current_volume,
product_name,
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/ClockworkResearch.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Box, Button, Section, Stack, Divider, Flex } from '../components';
import { Window } from '../layouts';
Expand Down
24 changes: 10 additions & 14 deletions tgui/packages/tgui/interfaces/ClockworkSlab.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { Fragment } from 'inferno';
import { useBackend, useLocalState } from '../backend';
import { Icon, Box, Button, Section, Table, Divider, Grid, ProgressBar, Collapsible } from '../components';
Expand All @@ -20,9 +21,8 @@ const convertPower = (power_in) => {
return Math.round((value + Number.EPSILON) * 100) / 100 + units[power];
};

export const ClockworkSlab = (props, context) => {
export const ClockworkSlab = (props) => {
const [selectedTab, setSelectedTab] = useLocalState(
context,
'selectedTab',
'Servitude'
);
Expand Down Expand Up @@ -64,7 +64,7 @@ export const ClockworkSlab = (props, context) => {
);
};

const ClockworkHelp = (props, context) => {
const ClockworkHelp = (props) => {
return (
<Fragment>
<Collapsible title="Where To Start" color="average" open={1}>
Expand Down Expand Up @@ -199,8 +199,8 @@ const ClockworkHelp = (props, context) => {
);
};

const ClockworkSpellList = (props, context) => {
const { act, data } = useBackend(context);
const ClockworkSpellList = (props) => {
const { act, data } = useBackend();
const { selectedTab } = props;
const { scriptures = [] } = data;
return (
Expand Down Expand Up @@ -260,8 +260,8 @@ const ClockworkSpellList = (props, context) => {
);
};

const ClockworkOverview = (props, context) => {
const { data } = useBackend(context);
const ClockworkOverview = (props) => {
const { data } = useBackend();
const { power, cogs, vitality, max_power, max_vitality } = data;
return (
<Box>
Expand Down Expand Up @@ -294,7 +294,7 @@ const ClockworkOverview = (props, context) => {
);
};

const ClockworkOverviewStat = (props, context) => {
const ClockworkOverviewStat = (props) => {
const { title, iconName, amount, maxAmount, unit, overrideText } = props;
return (
<Box height="22px" fontSize="16px">
Expand All @@ -321,12 +321,8 @@ const ClockworkOverviewStat = (props, context) => {
);
};

const ClockworkButtonSelection = (props, context) => {
const [selectedTab, setSelectedTab] = useLocalState(
context,
'selectedTab',
{}
);
const ClockworkButtonSelection = (props) => {
const [selectedTab, setSelectedTab] = useLocalState('selectedTab', {});
const tabs = ['Servitude', 'Preservation', 'Structures'];
return (
<Table>
Expand Down
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/CommandReportConsole.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Button, NoticeBox, Input, Section, Stack, TextArea } from '../components';
import { Window } from '../layouts';

export const CommandReportConsole = (props, context) => {
const { act, data } = useBackend(context);
export const CommandReportConsole = (props) => {
const { act, data } = useBackend();
const {
command_report_content,
command_report_title,
Expand Down
9 changes: 5 additions & 4 deletions tgui/packages/tgui/interfaces/CrewConsoleSkyrat.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { sortBy } from 'common/collections';
import { useBackend } from '../backend';
import { Box, Button, Section, Table, Icon } from '../components';
Expand Down Expand Up @@ -84,8 +85,8 @@ export const CrewConsoleSkyrat = () => {
);
};

const CrewTable = (props, context) => {
const { act, data } = useBackend(context);
const CrewTable = (props) => {
const { act, data } = useBackend();
const sensors = sortBy((s) => s.ijob)(data.sensors ?? []);
return (
<Table cellpadding="3">
Expand All @@ -110,8 +111,8 @@ const CrewTable = (props, context) => {
);
};

const CrewTableEntry = (props, context) => {
const { act, data } = useBackend(context);
const CrewTableEntry = (props) => {
const { act, data } = useBackend();
const { link_allowed } = data;
const { sensor_data } = props;
const {
Expand Down
9 changes: 5 additions & 4 deletions tgui/packages/tgui/interfaces/CrewConsoleSkyratBlueshield.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// THIS IS A SKYRAT UI FILE
import { sortBy } from 'common/collections';
import { useBackend } from '../backend';
import { Box, Button, Section, Table, Icon } from '../components';
Expand Down Expand Up @@ -79,8 +80,8 @@ export const CrewConsoleSkyratBlueshield = () => {
);
};

const CrewTable = (props, context) => {
const { act, data } = useBackend(context);
const CrewTable = (props) => {
const { act, data } = useBackend();
const sensors = sortBy((s) => s.ijob)(data.sensors ?? []);
return (
<Table cellpadding="3">
Expand All @@ -105,8 +106,8 @@ const CrewTable = (props, context) => {
);
};

const CrewTableEntry = (props, context) => {
const { act, data } = useBackend(context);
const CrewTableEntry = (props) => {
const { act, data } = useBackend();
const { link_allowed } = data;
const { sensor_data } = props;
const {
Expand Down
13 changes: 7 additions & 6 deletions tgui/packages/tgui/interfaces/CryopodConsole.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Button, LabeledList, NoticeBox, Section, Stack } from '../components';
import { Window } from '../layouts';

export const CryopodConsole = (props, context) => {
const { data } = useBackend(context);
export const CryopodConsole = (props) => {
const { data } = useBackend();
const { account_name } = data;

const welcomeTitle = `Hello, ${account_name || '[REDACTED]'}!`;
Expand All @@ -30,8 +31,8 @@ export const CryopodConsole = (props, context) => {
);
};

const CrewList = (props, context) => {
const { data } = useBackend(context);
const CrewList = (props) => {
const { data } = useBackend();
const { frozen_crew } = data;

return (
Expand All @@ -49,8 +50,8 @@ const CrewList = (props, context) => {
);
};

const ItemList = (props, context) => {
const { act, data } = useBackend(context);
const ItemList = (props) => {
const { act, data } = useBackend();
const { item_ref_list, item_ref_name, item_retrieval_allowed } = data;
if (!item_retrieval_allowed) {
return <NoticeBox>You are not authorized for item management.</NoticeBox>;
Expand Down
3 changes: 2 additions & 1 deletion tgui/packages/tgui/interfaces/DelamProcedure.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// THIS IS A SKYRAT UI FILE
import { Section, BlockQuote, Box, NoticeBox } from '../components';
import { Window } from '../layouts';

export const DelamProcedure = (context) => {
export const DelamProcedure = () => {
return (
<Window
title="Safety Moth - Delamination Emergency Procedure"
Expand Down
5 changes: 3 additions & 2 deletions tgui/packages/tgui/interfaces/EventPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// THIS IS A SKYRAT UI FILE
import { useBackend } from '../backend';
import { Section, Button, NoticeBox, LabeledList, Stack } from '../components';
import { toFixed } from 'common/math';
import { Window } from '../layouts';

export const EventPanel = (props, context) => {
const { act, data } = useBackend(context);
export const EventPanel = (props) => {
const { act, data } = useBackend();
const {
event_list = [],
end_time,
Expand Down
Loading

0 comments on commit fa32acd

Please sign in to comment.