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

Adds tooltips to changelog icons #5713

Merged
merged 2 commits into from
Feb 19, 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
84 changes: 41 additions & 43 deletions tgui/packages/tgui/interfaces/Changelog.jsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import { classes } from 'common/react';
import { useBackend } from '../backend';
import { Component, Fragment } from 'react';
import { Box, Button, Dropdown, Icon, Section, Stack, Table } from '../components';
import { Box, Button, Dropdown, Icon, Section, Stack, Table, Tooltip } from '../components';
import { Window } from '../layouts';
import { resolveAsset } from '../assets';
import dateformat from 'dateformat';
import yaml from 'js-yaml';

const icons = {
bugfix: { icon: 'bug', color: 'green' },
fix: { icon: 'bug', color: 'green' },
wip: { icon: 'hammer', color: 'orange' },
qol: { icon: 'hand-holding-heart', color: 'green' },
soundadd: { icon: 'tg-sound-plus', color: 'green' },
sounddel: { icon: 'tg-sound-minus', color: 'red' },
add: { icon: 'check-circle', color: 'green' },
expansion: { icon: 'check-circle', color: 'green' },
rscadd: { icon: 'check-circle', color: 'green' },
rscdel: { icon: 'times-circle', color: 'red' },
imageadd: { icon: 'tg-image-plus', color: 'green' },
imagedel: { icon: 'tg-image-minus', color: 'red' },
spellcheck: { icon: 'spell-check', color: 'green' },
experiment: { icon: 'radiation', color: 'yellow' },
balance: { icon: 'balance-scale-right', color: 'yellow' },
code_imp: { icon: 'code', color: 'green' },
refactor: { icon: 'tools', color: 'green' },
config: { icon: 'cogs', color: 'purple' },
admin: { icon: 'user-shield', color: 'purple' },
server: { icon: 'server', color: 'purple' },
tgs: { icon: 'toolbox', color: 'purple' },
tweak: { icon: 'wrench', color: 'green' },
ui: { icon: 'desktop', color: 'blue' },
mapadd: { icon: 'earth-africa', color: 'yellow' },
maptweak: { icon: 'map-location-dot', color: 'green' },
unknown: { icon: 'info-circle', color: 'label' },
const changeTypes = {
bugfix: { icon: 'bug', color: 'green', desc: 'Fix' },
fix: { icon: 'bug', color: 'green', desc: 'Fix' },
wip: { icon: 'hammer', color: 'orange', desc: 'WIP' },
qol: { icon: 'hand-holding-heart', color: 'green', desc: 'QOL' },
soundadd: { icon: 'tg-sound-plus', color: 'green', desc: 'Sound add' },
sounddel: { icon: 'tg-sound-minus', color: 'red', desc: 'Sound del' },
add: { icon: 'check-circle', color: 'green', desc: 'Addition' },
expansion: { icon: 'check-circle', color: 'green', desc: 'Addition' },
rscadd: { icon: 'check-circle', color: 'green', desc: 'Addition' },
rscdel: { icon: 'times-circle', color: 'red', desc: 'Removal' },
imageadd: { icon: 'tg-image-plus', color: 'green', desc: 'Sprite add' },
imagedel: { icon: 'tg-image-minus', color: 'red', desc: 'Sprite del' },
spellcheck: { icon: 'spell-check', color: 'green', desc: 'Spellcheck' },
experiment: { icon: 'radiation', color: 'yellow', desc: 'Experiment' },
balance: { icon: 'balance-scale-right', color: 'yellow', desc: 'Balance' },
code_imp: { icon: 'code', color: 'green', desc: 'Code improvement' },
refactor: { icon: 'tools', color: 'green', desc: 'Code refactor' },
config: { icon: 'cogs', color: 'purple', desc: 'Config' },
admin: { icon: 'user-shield', color: 'purple', desc: 'Admin' },
server: { icon: 'server', color: 'purple', desc: 'Server' },
tgs: { icon: 'toolbox', color: 'purple', desc: 'Server (TGS)' },
tweak: { icon: 'wrench', color: 'green', desc: 'Tweak' },
ui: { icon: 'desktop', color: 'blue', desc: 'UI' },
mapadd: { icon: 'earth-africa', color: 'yellow', desc: 'Map add' },
maptweak: { icon: 'map-location-dot', color: 'green', desc: 'Map tweak' },
unknown: { icon: 'info-circle', color: 'label', desc: 'Unknown' },
};

export class Changelog extends Component {
Expand Down Expand Up @@ -273,29 +273,27 @@ export class Changelog extends Component {
<Box ml={3}>
<Table>
{changes.map((change) => {
const changeType = Object.keys(change)[0];
const changeKey = Object.keys(change)[0];
const changeType =
changeTypes[changeKey] || changeTypes['unknown'];
harryob marked this conversation as resolved.
Show resolved Hide resolved
return (
<Table.Row key={changeType + change[changeType]}>
<Table.Row key={changeKey + change[changeKey]}>
<Table.Cell
className={classes([
'Changelog__Cell',
'Changelog__Cell--Icon',
])}>
<Icon
color={
icons[changeType]
? icons[changeType].color
: icons['unknown'].color
}
name={
icons[changeType]
? icons[changeType].icon
: icons['unknown'].icon
}
/>
<Tooltip
position="right"
content={changeType.desc}>
<Icon
color={changeType.color}
name={changeType.icon}
/>
</Tooltip>
</Table.Cell>
<Table.Cell className="Changelog__Cell">
{change[changeType]}
{change[changeKey]}
</Table.Cell>
</Table.Row>
);
Expand Down
Loading