Skip to content

Commit

Permalink
fix(frontend/settings): use category name from settings as title
Browse files Browse the repository at this point in the history
  • Loading branch information
Harjot1Singh committed May 15, 2020
1 parent 2ebc5b5 commit 6cf79e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 1 addition & 5 deletions app/frontend/src/Settings/DynamicOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ import { string, shape, node, bool } from 'prop-types'
import { Typography, Grid } from '@material-ui/core'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'

import { OPTIONS, DEFAULT_OPTIONS, PRIVACY_TYPES, OPTION_GROUPS } from '../lib/options'
import { OPTIONS, DEFAULT_OPTIONS, PRIVACY_TYPES, OPTION_GROUPS, FLAT_OPTION_GROUPS } from '../lib/options'
import controller from '../lib/controller'
import { SettingsContext } from '../lib/contexts'

import SettingComponentFactory, { Button } from './SettingComponents'

const FLAT_OPTION_GROUPS = Object
.values( OPTION_GROUPS )
.reduce( ( groups, section ) => ( { ...groups, ...section } ), {} )

export const slotSizes = {
icon: { xs: 2, sm: 1 },
name: { xs: 5, sm: 5, md: 4, lg: 4 },
Expand Down
5 changes: 3 additions & 2 deletions app/frontend/src/Settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
SETTINGS_OVERLAY_URL,
SETTINGS_ABOUT_URL,
} from '../lib/consts'
import { OPTIONS, OPTION_GROUPS } from '../lib/options'
import { OPTIONS, OPTION_GROUPS, FLAT_OPTION_GROUPS } from '../lib/options'
import SHORTCUTS from '../lib/keyMap'
import { SettingsContext } from '../lib/contexts'

Expand All @@ -53,6 +53,7 @@ import './index.css'
const Settings = () => {
const { pathname } = useLocation()
const group = pathname.split( '/' ).pop()
const { name } = FLAT_OPTION_GROUPS[ group ] || { name: group }

const [ mobileOpen, setMobileOpen ] = useState( false )
const [ device, setDevice ] = useState( 'local' )
Expand Down Expand Up @@ -194,7 +195,7 @@ const Settings = () => {
<FontAwesomeIcon className="menu icon" icon={faBars} />
</IconButton>
</Hidden>
<Typography className="title" align="center" variant="h6">{group}</Typography>
<Typography className="title" align="center" variant="h6">{name}</Typography>
</Toolbar>
</AppBar>
)
Expand Down
4 changes: 4 additions & 0 deletions app/frontend/src/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ export const OPTION_GROUPS = {
},
}

export const FLAT_OPTION_GROUPS = Object
.values( OPTION_GROUPS )
.reduce( ( groups, section ) => ( { ...groups, ...section } ), {} )

// Options with default values
export const DEFAULT_OPTIONS = {
local: {
Expand Down

0 comments on commit 6cf79e3

Please sign in to comment.