1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-20 02:00:49 +00:00

Some stylish tweaks

This commit is contained in:
Ash Keel 2022-01-20 12:22:42 +01:00
parent b8b7f2347e
commit dfeb2fbf65
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 65 additions and 38 deletions

View file

@ -96,6 +96,14 @@ const ACLIndicator = styled('span', {
marginRight: '0.5rem', marginRight: '0.5rem',
}); });
const NoneText = styled('div', {
color: '$gray9',
fontSize: '1.2em',
textAlign: 'center',
fontStyle: 'italic',
paddingTop: '1rem',
});
interface CommandItemProps { interface CommandItemProps {
name: string; name: string;
item: TwitchBotCustomCommand; item: TwitchBotCustomCommand;
@ -358,8 +366,13 @@ export default function TwitchBotCommandsPage(): React.ReactElement {
/> />
</FlexRow> </FlexRow>
<CommandList> <CommandList>
{Object.keys(commands ?? {}) {commands ? (
?.filter((cmd) => cmd.toLowerCase().includes(filterLC)) Object.keys(commands ?? {})
?.filter(
(cmd) =>
cmd.toLowerCase().includes(filterLC) ||
commands[cmd].description.toLowerCase().includes(filterLC),
)
.sort() .sort()
.map((cmd) => ( .map((cmd) => (
<CommandItem <CommandItem
@ -376,7 +389,10 @@ export default function TwitchBotCommandsPage(): React.ReactElement {
} }
onDelete={() => deleteCommand(cmd)} onDelete={() => deleteCommand(cmd)}
/> />
))} ))
) : (
<NoneText>{t('pages.botcommands.no-commands')}</NoneText>
)}
</CommandList> </CommandList>
<Dialog <Dialog

View file

@ -89,6 +89,13 @@ const TimerText = styled('div', {
marginBottom: '-0.5rem', marginBottom: '-0.5rem',
}, },
}); });
const NoneText = styled('div', {
color: '$gray9',
fontSize: '1.2em',
textAlign: 'center',
fontStyle: 'italic',
paddingTop: '1rem',
});
function humanTime(t: TFunction<'translation'>, secs: number): string { function humanTime(t: TFunction<'translation'>, secs: number): string {
const mins = Math.floor(secs / 60); const mins = Math.floor(secs / 60);
@ -384,7 +391,8 @@ export default function TwitchBotTimersPage(): React.ReactElement {
/> />
</FlexRow> </FlexRow>
<TimerList> <TimerList>
{Object.keys(timerConfig?.timers ?? {}) {!timerConfig?.timers ? (
Object.keys(timerConfig?.timers ?? {})
?.filter((cmd) => cmd.toLowerCase().includes(filterLC)) ?.filter((cmd) => cmd.toLowerCase().includes(filterLC))
.sort() .sort()
.map((cmd) => ( .map((cmd) => (
@ -402,7 +410,10 @@ export default function TwitchBotTimersPage(): React.ReactElement {
} }
onDelete={() => deleteTimer(cmd)} onDelete={() => deleteTimer(cmd)}
/> />
))} ))
) : (
<NoneText>{t('pages.bottimers.no-timers')}</NoneText>
)}
</TimerList> </TimerList>
<Dialog <Dialog