From 2c9eb480a89a9e4aae7e6204fbb61ece52d43a7f Mon Sep 17 00:00:00 2001 From: Rasheem Henry Date: Wed, 7 Aug 2019 22:51:45 -0400 Subject: [PATCH 1/2] capitalize languages --- .../LocalizationMenu/LocalizationMenu.jsx | 8 +++++--- src/utils.ts | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/LocalizationMenu/LocalizationMenu.jsx b/src/components/LocalizationMenu/LocalizationMenu.jsx index d6cc9bb..acbc241 100644 --- a/src/components/LocalizationMenu/LocalizationMenu.jsx +++ b/src/components/LocalizationMenu/LocalizationMenu.jsx @@ -1,7 +1,7 @@ import React from 'react'; import MenuItem from 'material-ui/MenuItem'; import styled from 'styled-components'; -import { SUPPORTED_LANGUAGES } from '../../utils'; +import { formatLanguages } from '../../utils'; const LanguageContainerDiv = styled.div` max-height: 300px; @@ -14,6 +14,8 @@ export default class LocalizationMenu extends React.Component { this.state = { open: false, }; + + this.formatLanguages = formatLanguages(); } handleOnClick = (event) => { @@ -28,8 +30,8 @@ export default class LocalizationMenu extends React.Component { return (
- {Object.entries(SUPPORTED_LANGUAGES).map(([name, lang]) => ( - + {Object.entries(this.formatLanguages).map(([name, lang]) => ( + { + newObj[key.charAt(0).toUpperCase() + key.slice(1)] = value; + } + ); + + console.log('in util'); + console.log(newObj); + return newObj; + } + export const GITHUB_ISSUES_LINK = '//github.com/odota/underlords-web/issues'; export function generateURL(p: string) { From f6b7e8c3d2d653c50f1232f7715ea025d6fd7085 Mon Sep 17 00:00:00 2001 From: Rasheem Henry Date: Wed, 7 Aug 2019 23:12:43 -0400 Subject: [PATCH 2/2] cleans spacing and console.logs --- src/utils.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 18204d5..f7c0e72 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -11,7 +11,6 @@ export function StripHtml(html: string) { return `${process.env.PUBLIC_URL}/images/portraits/${dotaName}_png.png`; } - // TODO capitalize export const SUPPORTED_LANGUAGES = { "português do Brasil": "pt-BR", "български": "bg", @@ -42,17 +41,14 @@ export function StripHtml(html: string) { }; export function formatLanguages(){ - let newObj = {} as any; + let nObj = {} as any; Object.entries(SUPPORTED_LANGUAGES).forEach( ([key, value]) => { - newObj[key.charAt(0).toUpperCase() + key.slice(1)] = value; + nObj[key.charAt(0).toUpperCase() + key.slice(1)] = value; } ); - - console.log('in util'); - console.log(newObj); - return newObj; + return nObj; } export const GITHUB_ISSUES_LINK = '//github.com/odota/underlords-web/issues';