Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Makes TGchat General settings better #2892

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 66 additions & 41 deletions tgui/packages/tgui-panel/settings/SettingsPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
*/

import { toFixed } from 'common/math';
import { capitalize } from 'common/string';
import { useLocalState } from 'tgui/backend';
import { useDispatch, useSelector } from 'tgui/backend';
import {
Box,
Button,
Collapsible,
ColorBox,
Divider,
Dropdown,
Input,
LabeledList,
NumberInput,
Expand Down Expand Up @@ -84,57 +85,81 @@ export const SettingsGeneral = (props) => {
<Section>
<LabeledList>
<LabeledList.Item label="Theme">
<Dropdown
selected={theme}
options={THEMES}
onSelected={(value) =>
dispatch(
updateSettings({
theme: value,
}),
)
}
/>
{THEMES.map((THEME) => (
<Button
key={THEME}
content={capitalize(THEME)}
selected={theme === THEME}
color="transparent"
onClick={() =>
dispatch(
updateSettings({
theme: THEME,
}),
)
}
/>
))}
</LabeledList.Item>
<LabeledList.Item label="Font style">
<Stack inline align="baseline">
<Stack.Item>
{(!freeFont && (
<Dropdown
selected={fontFamily}
options={FONTS}
onSelected={(value) =>
dispatch(
updateSettings({
fontFamily: value,
}),
)
}
/>
)) || (
<Stack.Item>
{(!freeFont && (
<Collapsible
title={fontFamily}
width={'100%'}
buttons={
<Button
content="Custom font"
icon={freeFont ? 'lock-open' : 'lock'}
color={freeFont ? 'good' : 'bad'}
onClick={() => {
setFreeFont(!freeFont);
}}
/>
}
>
{FONTS.map((FONT) => (
<Button
key={FONT}
content={FONT}
fontFamily={FONT}
selected={fontFamily === FONT}
color="transparent"
onClick={() =>
dispatch(
updateSettings({
fontFamily: FONT,
}),
)
}
/>
))}
</Collapsible>
)) || (
<Stack>
<Input
width={'100%'}
value={fontFamily}
onChange={(e, value) =>
onChange={(value) =>
dispatch(
updateSettings({
fontFamily: value,
}),
)
}
/>
)}
</Stack.Item>
<Stack.Item>
<Button
content="Custom font"
icon={freeFont ? 'lock-open' : 'lock'}
color={freeFont ? 'good' : 'bad'}
onClick={() => {
setFreeFont(!freeFont);
}}
/>
</Stack.Item>
</Stack>
<Button
ml={0.5}
content="Custom font"
icon={freeFont ? 'lock-open' : 'lock'}
color={freeFont ? 'good' : 'bad'}
onClick={() => {
setFreeFont(!freeFont);
}}
/>
</Stack>
)}
</Stack.Item>
</LabeledList.Item>
<LabeledList.Item label="Font size">
<NumberInput
Expand Down
Loading