2019-12-23 12:16:33 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
import { getCurrentUser } from "selectors/usersSelectors";
|
|
|
|
|
import { getOrgs, getCurrentOrg } from "selectors/organizationSelectors";
|
|
|
|
|
import styled from "styled-components";
|
|
|
|
|
import StyledHeader from "components/designSystems/appsmith/StyledHeader";
|
|
|
|
|
import CustomizedDropdown from "./CustomizedDropdown";
|
2020-06-17 10:19:56 +00:00
|
|
|
import DropdownProps from "./CustomizedDropdown/HeaderDropdownData";
|
2019-12-23 12:16:33 +00:00
|
|
|
import { AppState } from "reducers";
|
|
|
|
|
import { Org } from "constants/orgConstants";
|
|
|
|
|
import { User } from "constants/userConstants";
|
2020-06-17 10:19:56 +00:00
|
|
|
import Logo from "assets/images/appsmith_logo.png";
|
2019-12-23 12:16:33 +00:00
|
|
|
|
|
|
|
|
const StyledPageHeader = styled(StyledHeader)`
|
2020-06-17 10:19:56 +00:00
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
2019-12-23 12:16:33 +00:00
|
|
|
justify-content: space-between;
|
2020-06-17 10:19:56 +00:00
|
|
|
padding: ${props => props.theme.spaces[4]}px
|
|
|
|
|
${props => props.theme.spaces[4]}px;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const StyledDropDownContainer = styled.div``;
|
|
|
|
|
|
|
|
|
|
const LogoContainer = styled.div`
|
|
|
|
|
.logoimg {
|
|
|
|
|
width: 15%;
|
|
|
|
|
}
|
2019-12-23 12:16:33 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
type PageHeaderProps = {
|
|
|
|
|
orgs?: Org[];
|
|
|
|
|
currentOrg?: Org;
|
|
|
|
|
user?: User;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const PageHeader = (props: PageHeaderProps) => {
|
2020-06-17 10:19:56 +00:00
|
|
|
const { user } = props;
|
2019-12-23 12:16:33 +00:00
|
|
|
return (
|
|
|
|
|
<StyledPageHeader>
|
2020-06-17 10:19:56 +00:00
|
|
|
<LogoContainer>
|
|
|
|
|
<a href="/applications">
|
2020-06-17 13:53:01 +00:00
|
|
|
<img className="logoimg" src={Logo} alt="Appsmith Logo" />
|
2020-06-17 10:19:56 +00:00
|
|
|
</a>
|
|
|
|
|
</LogoContainer>
|
|
|
|
|
<StyledDropDownContainer>
|
|
|
|
|
{user && <CustomizedDropdown {...DropdownProps(user, user.username)} />}
|
|
|
|
|
</StyledDropDownContainer>
|
2019-12-23 12:16:33 +00:00
|
|
|
</StyledPageHeader>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state: AppState) => ({
|
|
|
|
|
currentOrg: getCurrentOrg(state),
|
|
|
|
|
user: getCurrentUser(state),
|
|
|
|
|
orgs: getOrgs(state),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, null)(PageHeader);
|