Skip to content

Commit

Permalink
fix: remove redundant "static" folder with json files
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovladimitrovski committed Sep 4, 2023
1 parent d9f2ee5 commit 42ef8b2
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 2,111 deletions.
1 change: 0 additions & 1 deletion .depcheckrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ignores: [
'\#types',
'\#components',
'\#utils',
'\#static',
# This is used in src/styles, which recognizes absolute paths from the repo root
'src',
# To support e2e-reports
Expand Down
14 changes: 9 additions & 5 deletions src/components/CustomRegisterField/CustomRegisterField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Radio from '#components/Radio/Radio';
import Dropdown from '#components/Dropdown/Dropdown';
import DateField from '#components/DateField/DateField';
import { ConsentFieldVariants, REGISTER_FIELD_VARIANT } from '#src/services/inplayer.account.service';
import countriesCodes from '#static/countries-codes.json';
import usStatesCodes from '#static/us-states-codes.json';

type Props = {
type: ConsentFieldVariants;
Expand All @@ -29,13 +27,19 @@ type Props = {
export type CustomRegisterFieldCommonProps = Props;

export const CustomRegisterField: FC<Props> = ({ type, value = '', ...props }) => {
const { t } = useTranslation(type);
const { t, i18n } = useTranslation(type);

const optionsList = useMemo(() => {
if (!i18n.isInitialized) {
return [];
}

switch (type) {
case REGISTER_FIELD_VARIANT.COUNTRY_SELECT:
case REGISTER_FIELD_VARIANT.US_STATE_SELECT: {
return (type === REGISTER_FIELD_VARIANT.COUNTRY_SELECT ? countriesCodes : usStatesCodes).map((code) => ({
const codes = Object.keys(i18n.getResourceBundle(i18n.language, type));

return codes.map((code) => ({
value: code,
label: t(`${type}:${code}`),
}));
Expand All @@ -48,7 +52,7 @@ export const CustomRegisterField: FC<Props> = ({ type, value = '', ...props }) =
return [];
}
}
}, [t, type, props.options]);
}, [t, type, props.options, i18n]);

switch (type) {
case REGISTER_FIELD_VARIANT.CHECKBOX:
Expand Down
Loading

0 comments on commit 42ef8b2

Please sign in to comment.