Misc frontend fixes

This commit is contained in:
Ash Keel 2021-11-03 15:09:42 +01:00
parent dc633ca913
commit 3577dc7142
No known key found for this signature in database
GPG Key ID: BAD8D93E7314ED3E
7 changed files with 16 additions and 13 deletions

2
frontend/.gitignore vendored
View File

@ -1,3 +1,5 @@
dist dist
node_modules node_modules
.parcel-cache .parcel-cache
.vscode
.idea

View File

@ -59,9 +59,10 @@
"endpoint": "Stulbe Endpoint", "endpoint": "Stulbe Endpoint",
"username": "User name", "username": "User name",
"username-placeholder": "myUserName", "username-placeholder": "myUserName",
"authkey": "Authorization key", "auth-key": "Authorization key",
"authkey-placeholder": "key goes here", "auth-key-placeholder": "key goes here",
"authenticated": "Authenticated as" "authenticated": "Authenticated as",
"auth-success-message": "Connection/Authentication was successful!"
}, },
"webhook": { "webhook": {
"header": "Webhook subscriptions", "header": "Webhook subscriptions",

View File

@ -5,13 +5,10 @@ import prettyTime from 'pretty-ms';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useModule } from '../../../lib/react-utils'; import { useModule } from '../../../lib/react-utils';
import { RootState } from '../../../store'; import { RootState } from '../../../store';
import { import { createRedeem, modules } from '../../../store/api/reducer';
createRedeem,
modules,
} from '../../../store/api/reducer';
import Modal from '../../components/Modal'; import Modal from '../../components/Modal';
import { getInterval } from '../../../lib/time-utils'; import { getInterval } from '../../../lib/time-utils';
import {LoyaltyReward} from "../../../store/api/types"; import { LoyaltyReward } from '../../../store/api/types';
interface RewardItemProps { interface RewardItemProps {
item: LoyaltyReward; item: LoyaltyReward;
@ -92,7 +89,7 @@ function RewardItem({
{t('actions.test')} {t('actions.test')}
</a>{' '} </a>{' '}
<a className="button is-small" onClick={onToggleState}> <a className="button is-small" onClick={onToggleState}>
{item.enabled ? 'Disable' : 'Enable'} {t(item.enabled ? 'actions.disable' : 'actions.enable')}
</a>{' '} </a>{' '}
<a className="button is-small" onClick={onEdit}> <a className="button is-small" onClick={onEdit}>
{t('actions.edit')} {t('actions.edit')}

View File

@ -23,7 +23,7 @@ export default function StulbeConfigPage(
try { try {
const client = new Stulbe(stulbeConfig.endpoint); const client = new Stulbe(stulbeConfig.endpoint);
await client.auth(stulbeConfig.username, stulbeConfig.auth_key); await client.auth(stulbeConfig.username, stulbeConfig.auth_key);
setTestResult('Connection/Authentication were successful!'); setTestResult(t('backend.config.auth-success-message'));
} catch (e) { } catch (e) {
setTestResult(e.message); setTestResult(e.message);
} }
@ -91,12 +91,12 @@ export default function StulbeConfigPage(
</p> </p>
</div> </div>
<div className="field"> <div className="field">
<label className="label">{t('backend.config.authkey')}</label> <label className="label">{t('backend.config.auth-key')}</label>
<p className="control"> <p className="control">
<input <input
className="input" className="input"
type="password" type="password"
placeholder={t('backend.config.authkey-placeholder')} placeholder={t('backend.config.auth-key-placeholder')}
disabled={busy || !active} disabled={busy || !active}
value={stulbeConfig?.auth_key ?? ''} value={stulbeConfig?.auth_key ?? ''}
onChange={(ev) => onChange={(ev) =>

View File

@ -52,6 +52,7 @@ const eventSubTestFn = {
}; };
export default function StulbeWebhooksPage( export default function StulbeWebhooksPage(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: RouteComponentProps<unknown>, props: RouteComponentProps<unknown>,
): React.ReactElement { ): React.ReactElement {
const { t } = useTranslation(); const { t } = useTranslation();

View File

@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
import { useModule } from '../../../lib/react-utils'; import { useModule } from '../../../lib/react-utils';
import { modules } from '../../../store/api/reducer'; import { modules } from '../../../store/api/reducer';
import Modal from '../../components/Modal'; import Modal from '../../components/Modal';
import {TwitchBotCustomCommand} from "../../../store/api/types"; import { TwitchBotCustomCommand } from '../../../store/api/types';
interface CommandItemProps { interface CommandItemProps {
name: string; name: string;
@ -207,6 +207,7 @@ function CommandModal({
} }
export default function TwitchBotCommandsPage( export default function TwitchBotCommandsPage(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: RouteComponentProps<unknown>, props: RouteComponentProps<unknown>,
): React.ReactElement { ): React.ReactElement {
const [commands, setCommands] = useModule(modules.twitchBotCommands); const [commands, setCommands] = useModule(modules.twitchBotCommands);

View File

@ -2,6 +2,7 @@ import { RouteComponentProps } from '@reach/router';
import React from 'react'; import React from 'react';
export default function TwitchBotModulesPage( export default function TwitchBotModulesPage(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
props: RouteComponentProps<unknown>, props: RouteComponentProps<unknown>,
): React.ReactElement { ): React.ReactElement {
return <>WIP!!</>; return <>WIP!!</>;