Skip to content

Commit

Permalink
[MIRROR] Cuts copypaste from Antag Info UIs [MDB IGNORE] (Skyrat-SS13…
Browse files Browse the repository at this point in the history
…#22523)

* Cuts copypaste from Antag Info UIs

* Merge conflict

---------

Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Giz <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
4 people authored Jul 18, 2023
1 parent 4e4db21 commit 61278a1
Show file tree
Hide file tree
Showing 13 changed files with 130 additions and 430 deletions.
13 changes: 2 additions & 11 deletions tgui/packages/tgui/interfaces/AntagInfoBlob.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BooleanLike } from 'common/react';
import { useBackend } from '../backend';
import { Box, Collapsible, Divider, LabeledList, Section, Stack } from '../components';
import { Objective } from './common/Objectives';

import { Window } from '../layouts';

Expand All @@ -9,16 +9,7 @@ type Data = {
description: string;
effects: string;
name: string;
objectives: Objectives[];
};

type Objectives = {
count: number;
name: string;
explanation: string;
complete: BooleanLike;
was_uncompleted: BooleanLike;
reward: number;
objectives: Objective[];
};

const BLOB_COLOR = '#556b2f';
Expand Down
54 changes: 15 additions & 39 deletions tgui/packages/tgui/interfaces/AntagInfoBrainwashed.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
import { useBackend } from '../backend';
import { Icon, Section, Stack } from '../components';
import { BooleanLike } from 'common/react';
import { Box, Icon, Section, Stack } from '../components';
import { Window } from '../layouts';
import { ObjectivePrintout, Objective } from './common/Objectives';

type Objective = {
count: number;
name: string;
explanation: string;
complete: BooleanLike;
was_uncompleted: BooleanLike;
reward: number;
};

type Info = {
type Data = {
objectives: Objective[];
};

export const AntagInfoBrainwashed = () => {
export const AntagInfoBrainwashed = (porps, context) => {
const { data } = useBackend<Data>(context);

return (
<Window width={400} height={400} theme="abductor">
<Window.Content backgroundColor="#722e7d">
Expand All @@ -40,7 +33,15 @@ export const AntagInfoBrainwashed = () => {
It is focusing on a single purpose...
</Stack.Item>
<Stack.Item mt={3.5} grow>
<ObjectivePrintout />
<ObjectivePrintout
fill
objectives={data.objectives}
objectiveFollowup={
<Box bold textColor="red">
This Directive must be followed.
</Box>
}
/>
</Stack.Item>
<Stack.Item fontSize="20px" textColor="#61e4b9">
Follow the directives at any cost!
Expand All @@ -54,28 +55,3 @@ export const AntagInfoBrainwashed = () => {
</Window>
);
};

const ObjectivePrintout = (props, context) => {
const { data } = useBackend<Info>(context);
const { objectives } = data;
return (
<Stack fill vertical>
<Stack.Item bold textColor="#61e4b9">
Your current objectives:
</Stack.Item>
<Stack.Item textAlign="left">
{(!objectives && 'None!') ||
objectives.map((objective) => (
<>
<Stack.Item key={objective.count}>
{objective.count}. {objective.explanation}
</Stack.Item>
<Stack.Item bold textColor="red">
This Directive must be followed.
</Stack.Item>
</>
))}
</Stack.Item>
</Stack>
);
};
33 changes: 3 additions & 30 deletions tgui/packages/tgui/interfaces/AntagInfoBrother.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { useBackend } from '../backend';
import { Section, Stack } from '../components';
import { BooleanLike } from 'common/react';
import { Window } from '../layouts';

type Objective = {
count: number;
name: string;
explanation: string;
complete: BooleanLike;
was_uncompleted: BooleanLike;
reward: number;
};
import { ObjectivePrintout, Objective } from './common/Objectives';

type Info = {
antag_name: string;
Expand All @@ -20,7 +11,7 @@ type Info = {

export const AntagInfoBrother = (props, context) => {
const { data } = useBackend<Info>(context);
const { antag_name, brothers } = data;
const { antag_name, brothers, objectives } = data;
return (
<Window width={620} height={250}>
<Window.Content>
Expand All @@ -30,29 +21,11 @@ export const AntagInfoBrother = (props, context) => {
You are the {antag_name} of {brothers}!
</Stack.Item>
<Stack.Item>
<ObjectivePrintout />
<ObjectivePrintout objectives={objectives} />
</Stack.Item>
</Stack>
</Section>
</Window.Content>
</Window>
);
};

const ObjectivePrintout = (props, context) => {
const { data } = useBackend<Info>(context);
const { objectives } = data;
return (
<Stack vertical>
<Stack.Item bold>Your objectives:</Stack.Item>
<Stack.Item>
{(!objectives && 'None!') ||
objectives.map((objective) => (
<Stack.Item key={objective.count}>
#{objective.count}: {objective.explanation}
</Stack.Item>
))}
</Stack.Item>
</Stack>
);
};
27 changes: 2 additions & 25 deletions tgui/packages/tgui/interfaces/AntagInfoChangeling.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { multiline } from 'common/string';
import { useBackend, useSharedState } from '../backend';
import { Button, Dimmer, Dropdown, Section, Stack, NoticeBox } from '../components';
import { Window } from '../layouts';
import { ObjectivePrintout, Objective } from './common/Objectives';

const hivestyle = {
fontWeight: 'bold',
Expand Down Expand Up @@ -38,12 +39,6 @@ const fallenstyle = {
fontWeight: 'bold',
};

type Objective = {
count: number;
name: string;
explanation: string;
};

type Memory = {
name: string;
story: string;
Expand Down Expand Up @@ -90,24 +85,6 @@ export const AntagInfoChangeling = (props, context) => {
);
};

const ObjectivePrintout = (props, context) => {
const { data } = useBackend<Info>(context);
const { objectives } = data;
return (
<Stack vertical>
<Stack.Item bold>Your current objectives:</Stack.Item>
<Stack.Item>
{(!objectives && 'None!') ||
objectives.map((objective) => (
<Stack.Item key={objective.count}>
#{objective.count}: {objective.explanation}
</Stack.Item>
))}
</Stack.Item>
</Stack>
);
};

const HivemindSection = (props, context) => {
const { act, data } = useBackend<Info>(context);
const { true_name } = data;
Expand Down Expand Up @@ -150,7 +127,7 @@ const IntroductionSection = (props, context) => {
<span style={hivestyle}> {hive_name}</span>.
</Stack.Item>
<Stack.Item>
<ObjectivePrintout />
<ObjectivePrintout objectives={objectives} />
</Stack.Item>
</Stack>
</Section>
Expand Down
36 changes: 6 additions & 30 deletions tgui/packages/tgui/interfaces/AntagInfoDemon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useBackend } from '../backend';
import { Box, Section, Stack } from '../components';
import { BooleanLike } from 'common/react';
import { Window } from '../layouts';
import { ObjectivePrintout, Objective } from './common/Objectives';

const jauntstyle = {
color: 'lightblue',
Expand All @@ -11,15 +12,6 @@ const injurestyle = {
color: 'yellow',
};

type Objective = {
count: number;
name: string;
explanation: string;
complete: BooleanLike;
was_uncompleted: BooleanLike;
reward: number;
};

type Info = {
fluff: string;
explain_attack: BooleanLike;
Expand Down Expand Up @@ -48,7 +40,11 @@ export const AntagInfoDemon = (props, context) => {
{fluff}
</Stack.Item>
<Stack.Item>
<ObjectivePrintout />
<ObjectivePrintout
titleMessage="It is in your nature to accomplish these goals:"
objectiveTextSize="20px"
objectives={objectives}
/>
</Stack.Item>
</Stack>
</Section>
Expand Down Expand Up @@ -88,26 +84,6 @@ export const AntagInfoDemon = (props, context) => {
);
};

const ObjectivePrintout = (props, context) => {
const { data } = useBackend<Info>(context);
const { objectives } = data;
return (
<Stack vertical>
<Stack.Item bold>
It is in your nature to accomplish these goals:
</Stack.Item>
<Stack.Item>
{(!objectives && 'None!') ||
objectives.map((objective) => (
<Stack.Item fontSize="20px" key={objective.count}>
#{objective.count}: {objective.explanation}
</Stack.Item>
))}
</Stack.Item>
</Stack>
);
};

const DemonRunes = (props, context) => {
return (
<Section height="102%" mt="-6px" fill>
Expand Down
115 changes: 0 additions & 115 deletions tgui/packages/tgui/interfaces/AntagInfoGangmember.tsx

This file was deleted.

Loading

0 comments on commit 61278a1

Please sign in to comment.