Unverified Commit 92f9dca1 authored by Daniel's avatar Daniel Committed by GitHub

Fix navbar and footer state bugs (#112)

* Fix navbar and footer state bugs
parent 805d5b48
......@@ -19,17 +19,9 @@ interface DispatchFromProps {
export type FooterProps = StateFromProps & DispatchFromProps;
interface FooterState {
lastIndexed: number;
}
export class Footer extends React.Component<FooterProps, FooterState> {
export class Footer extends React.Component<FooterProps> {
constructor(props) {
super(props);
this.state = {
lastIndexed: this.props.lastIndexed,
};
}
componentDidMount() {
......@@ -38,12 +30,12 @@ export class Footer extends React.Component<FooterProps, FooterState> {
generateDateTimeString = () => {
// 'moment.local' will utilize the client's local timezone.
return moment.unix(this.state.lastIndexed).local().format('MMMM Do YYYY [at] h:mm:ss a');
}
return moment.unix(this.props.lastIndexed).local().format('MMMM Do YYYY [at] h:mm:ss a');
};
render() {
let content;
if (this.state.lastIndexed !== null) {
if (this.props.lastIndexed !== null) {
content = <div>{`Amundsen was last indexed on ${this.generateDateTimeString()}`}</div>;
}
return (
......
......@@ -24,18 +24,9 @@ interface DispatchFromProps {
export type NavBarProps = StateFromProps & DispatchFromProps;
// State
interface NavBarState {
loggedInUser: LoggedInUser;
}
export class NavBar extends React.Component<NavBarProps, NavBarState> {
export class NavBar extends React.Component<NavBarProps> {
constructor(props) {
super(props);
this.state = {
loggedInUser: this.props.loggedInUser,
};
}
componentDidMount() {
......@@ -69,9 +60,9 @@ export class NavBar extends React.Component<NavBarProps, NavBarState> {
{this.generateNavLinks(AppConfig.navLinks)}
{
// TODO PEOPLE - Add link to user profile
this.state.loggedInUser &&
this.props.loggedInUser &&
<div id="nav-bar-avatar">
<Avatar name={this.state.loggedInUser.display_name} size={32} round={true} />
<Avatar name={this.props.loggedInUser.display_name} size={32} round={true} />
</div>
}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment