mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-31 09:00:25 +01:00
No player-facing changes. Ports several PRs from tgstation, including: https://github.com/tgstation/tgstation/pull/66862 https://github.com/tgstation/tgstation/pull/80189 https://github.com/tgstation/tgstation/pull/90317 https://github.com/tgstation/tgstation/pull/91379 In addition, removes IntelliCode from the recommended extensions. This is deprecated, and we prefer not to force the replacement onto contributors. Contributors may individually choose to use this instead.
100 lines
2.5 KiB
JavaScript
100 lines
2.5 KiB
JavaScript
/**
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
import { useDispatch, useSelector } from 'common/redux';
|
|
import {
|
|
Button,
|
|
Collapsible,
|
|
Divider,
|
|
Input,
|
|
Section,
|
|
Stack,
|
|
} from 'tgui/components';
|
|
import { removeChatPage, toggleAcceptedType, updateChatPage } from './actions';
|
|
import { MESSAGE_TYPES } from './constants';
|
|
import { selectCurrentChatPage } from './selectors';
|
|
|
|
export const ChatPageSettings = (props, context) => {
|
|
const page = useSelector(context, selectCurrentChatPage);
|
|
const dispatch = useDispatch(context);
|
|
return (
|
|
<Section>
|
|
<Stack align="center">
|
|
<Stack.Item grow={1}>
|
|
<Input
|
|
fluid
|
|
value={page.name}
|
|
onChange={(e, value) =>
|
|
dispatch(
|
|
updateChatPage({
|
|
pageId: page.id,
|
|
name: value,
|
|
}),
|
|
)
|
|
}
|
|
/>
|
|
</Stack.Item>
|
|
<Stack.Item>
|
|
<Button
|
|
icon="times"
|
|
color="red"
|
|
onClick={() =>
|
|
dispatch(
|
|
removeChatPage({
|
|
pageId: page.id,
|
|
}),
|
|
)
|
|
}
|
|
>
|
|
Remove
|
|
</Button>
|
|
</Stack.Item>
|
|
</Stack>
|
|
<Divider />
|
|
<Section title="Messages to display" level={2}>
|
|
{MESSAGE_TYPES.filter(
|
|
(typeDef) => !typeDef.important && !typeDef.admin,
|
|
).map((typeDef) => (
|
|
<Button.Checkbox
|
|
key={typeDef.type}
|
|
checked={page.acceptedTypes[typeDef.type]}
|
|
onClick={() =>
|
|
dispatch(
|
|
toggleAcceptedType({
|
|
pageId: page.id,
|
|
type: typeDef.type,
|
|
}),
|
|
)
|
|
}
|
|
>
|
|
{typeDef.name}
|
|
</Button.Checkbox>
|
|
))}
|
|
<Collapsible mt={1} color="transparent" title="Admin stuff">
|
|
{MESSAGE_TYPES.filter(
|
|
(typeDef) => !typeDef.important && typeDef.admin,
|
|
).map((typeDef) => (
|
|
<Button.Checkbox
|
|
key={typeDef.type}
|
|
checked={page.acceptedTypes[typeDef.type]}
|
|
onClick={() =>
|
|
dispatch(
|
|
toggleAcceptedType({
|
|
pageId: page.id,
|
|
type: typeDef.type,
|
|
}),
|
|
)
|
|
}
|
|
>
|
|
{typeDef.name}
|
|
</Button.Checkbox>
|
|
))}
|
|
</Collapsible>
|
|
</Section>
|
|
</Section>
|
|
);
|
|
};
|