Merge pull request #13250 from influxdata/feat/orgname-on-homepage

feat(ui): Add org name to home page title
pull/13254/head
Iris Scholten 2019-04-08 17:14:56 -07:00 committed by GitHub
commit ccbf11fffc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -9,6 +9,7 @@ import {generateRandomGreeting} from 'src/me/constants'
interface Props {
userName: string
orgName: string
}
export default class UserPageHeader extends PureComponent<Props> {
@ -22,11 +23,11 @@ export default class UserPageHeader extends PureComponent<Props> {
}
private get title(): JSX.Element {
const {userName} = this.props
const {userName, orgName} = this.props
const {text, language} = generateRandomGreeting()
const title = `${text}, ${userName}!`
const title = `${text}, ${userName}! Welcome to ${orgName}!`
const altText = `That's how you say hello in ${language}`
return <Page.Title title={title} altText={altText} />

View File

@ -1,6 +1,7 @@
// Libraries
import React, {PureComponent} from 'react'
import {connect} from 'react-redux'
import {get} from 'lodash'
// Components
import {
@ -26,16 +27,17 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
interface StateProps {
me: AppState['me']
orgName: string
}
@ErrorHandling
export class MePage extends PureComponent<StateProps> {
public render() {
const {me} = this.props
const {me, orgName} = this.props
return (
<Page className="user-page" titleTag="My Account">
<Header userName={me.name} />
<Header userName={me.name} orgName={orgName} />
<Page.Contents fullWidth={false} scrollable={true}>
<div className="col-xs-12">
<Grid>
@ -69,9 +71,12 @@ export class MePage extends PureComponent<StateProps> {
}
const mstp = (state: AppState): StateProps => {
const {me} = state
const {
me,
orgs: {org},
} = state
return {me}
return {me, orgName: get(org, 'name', '')}
}
export default connect<StateProps>(