1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +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',
});
const NoneText = styled('div', {
color: '$gray9',
fontSize: '1.2em',
textAlign: 'center',
fontStyle: 'italic',
paddingTop: '1rem',
});
interface CommandItemProps {
name: string;
item: TwitchBotCustomCommand;
@ -358,25 +366,33 @@ export default function TwitchBotCommandsPage(): React.ReactElement {
/>
</FlexRow>
<CommandList>
{Object.keys(commands ?? {})
?.filter((cmd) => cmd.toLowerCase().includes(filterLC))
.sort()
.map((cmd) => (
<CommandItem
key={cmd}
name={cmd}
item={commands[cmd]}
onToggle={() => toggleCommand(cmd)}
onEdit={() =>
setActiveDialog({
kind: 'edit',
name: cmd,
item: commands[cmd],
})
}
onDelete={() => deleteCommand(cmd)}
/>
))}
{commands ? (
Object.keys(commands ?? {})
?.filter(
(cmd) =>
cmd.toLowerCase().includes(filterLC) ||
commands[cmd].description.toLowerCase().includes(filterLC),
)
.sort()
.map((cmd) => (
<CommandItem
key={cmd}
name={cmd}
item={commands[cmd]}
onToggle={() => toggleCommand(cmd)}
onEdit={() =>
setActiveDialog({
kind: 'edit',
name: cmd,
item: commands[cmd],
})
}
onDelete={() => deleteCommand(cmd)}
/>
))
) : (
<NoneText>{t('pages.botcommands.no-commands')}</NoneText>
)}
</CommandList>
<Dialog

View file

@ -89,6 +89,13 @@ const TimerText = styled('div', {
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 {
const mins = Math.floor(secs / 60);
@ -384,25 +391,29 @@ export default function TwitchBotTimersPage(): React.ReactElement {
/>
</FlexRow>
<TimerList>
{Object.keys(timerConfig?.timers ?? {})
?.filter((cmd) => cmd.toLowerCase().includes(filterLC))
.sort()
.map((cmd) => (
<TimerItem
key={cmd}
name={cmd}
item={timerConfig.timers[cmd]}
onToggle={() => toggleTimer(cmd)}
onEdit={() =>
setActiveDialog({
kind: 'edit',
name: cmd,
item: timerConfig.timers[cmd],
})
}
onDelete={() => deleteTimer(cmd)}
/>
))}
{!timerConfig?.timers ? (
Object.keys(timerConfig?.timers ?? {})
?.filter((cmd) => cmd.toLowerCase().includes(filterLC))
.sort()
.map((cmd) => (
<TimerItem
key={cmd}
name={cmd}
item={timerConfig.timers[cmd]}
onToggle={() => toggleTimer(cmd)}
onEdit={() =>
setActiveDialog({
kind: 'edit',
name: cmd,
item: timerConfig.timers[cmd],
})
}
onDelete={() => deleteTimer(cmd)}
/>
))
) : (
<NoneText>{t('pages.bottimers.no-timers')}</NoneText>
)}
</TimerList>
<Dialog