Skip to content

Commit

Permalink
Linting cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Rodolfi committed Aug 9, 2024
1 parent 457e099 commit 0f13ad0
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion frontend/src/components/modals/WarnThirdParty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ConfirmModal } from '@decky/ui';
import { FC, useEffect, useState } from 'react';
import { FaExclamationTriangle } from 'react-icons/fa';

import TranslationHelper, { TranslationClass } from '../../utils/TranslationHelper';
import { WarnThirdPartyType } from '../../utils/globalTypes';
import TranslationHelper, { TranslationClass } from '../../utils/TranslationHelper';

interface WarnThirdPartyProps {
seconds?: number;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/settings/pages/developer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Navigation,
TextField,
Toggle,
showModal
showModal,
} from '@decky/ui';
import { useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -16,11 +16,11 @@ import { FaFileArchive, FaLink, FaReact, FaSteamSymbol, FaTerminal } from 'react
import { setShouldConnectToReactDevTools, setShowValveInternal } from '../../../../developer';
import Logger from '../../../../logger';
import { installFromURL } from '../../../../store';
import { WarnThirdPartyType } from '../../../../utils/globalTypes';
import { useSetting } from '../../../../utils/hooks/useSetting';
import { getSetting } from '../../../../utils/settings';
import { FileSelectionType } from '../../../modals/filepicker';
import WarnThirdParty from '../../../modals/WarnThirdParty';
import { WarnThirdPartyType } from '../../../../utils/globalTypes';
import RemoteDebuggingSettings from '../general/RemoteDebugging';

const logger = new Logger('DeveloperIndex');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { FaShapes } from 'react-icons/fa';

import Logger from '../../../../logger';
import { Store } from '../../../../store';
import { WarnThirdPartyType } from '../../../../utils/globalTypes';
import { useSetting } from '../../../../utils/hooks/useSetting';
import WarnThirdParty from '../../../modals/WarnThirdParty';
import { WarnThirdPartyType } from '../../../../utils/globalTypes';

const logger = new Logger('StoreSelect');

Expand Down
42 changes: 24 additions & 18 deletions frontend/src/utils/TranslationHelper.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { FC } from 'react';
import { Translation } from 'react-i18next';

import { WarnThirdPartyType } from './globalTypes';
import Logger from '../logger';
import { InstallType } from '../plugin';
import { WarnThirdPartyType } from './globalTypes';

export enum TranslationClass {
PLUGIN_LOADER = 'PluginLoader',
Expand All @@ -22,7 +22,13 @@ interface TranslationHelperProps {

const logger = new Logger('TranslationHelper');

const TranslationHelper: FC<TranslationHelperProps> = ({ transClass, transText, i18nArgs = null, installType = 0, warnType = WarnThirdPartyType.REPO }) => {
const TranslationHelper: FC<TranslationHelperProps> = ({
transClass,
transText,
i18nArgs = null,
installType = 0,
warnType = WarnThirdPartyType.REPO,
}) => {
return (
<Translation>
{(t, {}) => {
Expand Down Expand Up @@ -50,25 +56,25 @@ const TranslationHelper: FC<TranslationHelperProps> = ({ transClass, transText,
return i18nArgs
? t(TranslationClass.DEVELOPER + '.' + transText, i18nArgs)
: t(TranslationClass.DEVELOPER + '.' + transText);
//Handle different messages in different class cases
case TranslationClass.WARN_THIRD_PARTY:
//Needed only for title and description
if (!transText.startsWith('button')) {
//Handle different messages in different class cases
case TranslationClass.WARN_THIRD_PARTY:
//Needed only for title and description
if (!transText.startsWith('button')) {
switch (warnType) {
case WarnThirdPartyType.REPO:
return i18nArgs
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo', i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo');
case WarnThirdPartyType.ZIP:
return i18nArgs
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip', i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip');
case WarnThirdPartyType.REPO:
return i18nArgs
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo', i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo');
case WarnThirdPartyType.ZIP:
return i18nArgs
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip', i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip');
}
} else {
} else {
return i18nArgs
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText, i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText);
}
? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText, i18nArgs)
: t(TranslationClass.WARN_THIRD_PARTY + '.' + transText);
}
default:
logger.error('We should never fall in the default case!');
return '';
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/utils/globalTypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum WarnThirdPartyType {
REPO = 0,
ZIP = 1,
}
REPO = 0,
ZIP = 1,
}

0 comments on commit 0f13ad0

Please sign in to comment.