* Updating homepage body color * WIP: Fixing scrolls and adding anchors * Removing divider from bottom of the page. * Adding hover background color to app card * Changing edit and launch icons. * Fixing app name paddding in card. * Fixing workspaces overflow * Adding right padding to applications view * Adding share icon to share btn * Fixing Application card styles. * Fixing text decoration in button. * Adding new workspace button * Fixing new workspace and new app styles. * Adding icon sizes. * Fixing Org Name and Org settings menu. * Application menu working * Fixing overlay visibility on app card * Fixing settings page content width. * Fixing workspace icon * Changing app card colors. * Removing debugger * Adding app icon. * Fixing the spaces in application card * Adding storybook-static folder to gitignore. * Adding other storybook files. * Adding menu items for app * Removing cypress selector from text. * Menu width issue fixed * Default app icon color added * Removing hardcoded colors * Removing hardcoded colors. * Light Mode on! * Showing correct icon and color in menu * Update color working properly. * Updating appIcon * Editable text working. * Adding validator * Adding edit permissions to menu * Removing box shadow on app card. * Fixing context menu fill color * Fixing Menu hover issues. * Fixing menu open close hover issues. * Fixing settings pages * Changed Workspace to org. * Fix: State management in EditableText Component (#540) * Error state height is fixed as per design * savingState prop condition fixed * Fixing createnew. * Fixing saving state for application card. * Fixed application card editable text error. * Fixing issue caused during merge. * Fixing tests in create org. * Removing commented code. * Removing unwanted vars. * Fixing delete duplicate tests. * Latest color palette. * Fixing form and table widget. * Removing switcher from header * Removing unused files * Fixing app card context dropdown * Show overlay fix * Adding localStorage support to theme. * Making dark mode the default. Co-authored-by: Rohit Kumawat <rohit.kumawat@primathon.in>
90 lines
2.5 KiB
TypeScript
90 lines
2.5 KiB
TypeScript
import React from "react";
|
|
import { Link, useLocation } from "react-router-dom";
|
|
import { connect } from "react-redux";
|
|
import { getCurrentUser } from "selectors/usersSelectors";
|
|
import styled from "styled-components";
|
|
import StyledHeader from "components/designSystems/appsmith/StyledHeader";
|
|
import AppsmithLogo from "assets/images/appsmith_logo_white.png";
|
|
import CustomizedDropdown from "./CustomizedDropdown";
|
|
import DropdownProps from "./CustomizedDropdown/HeaderDropdownData";
|
|
import { AppState } from "reducers";
|
|
import { User, ANONYMOUS_USERNAME } from "constants/userConstants";
|
|
import { AUTH_LOGIN_URL, APPLICATIONS_URL } from "constants/routes";
|
|
import Button from "components/editorComponents/Button";
|
|
import history from "utils/history";
|
|
import { Colors } from "constants/Colors";
|
|
// import ThemeSwitcher from "./ThemeSwitcher";
|
|
|
|
const StyledPageHeader = styled(StyledHeader)`
|
|
background: ${Colors.BALTIC_SEA};
|
|
height: 48px;
|
|
color: white;
|
|
flex-direction: row;
|
|
position: fixed;
|
|
top: 0;
|
|
z-index: 10;
|
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.05);
|
|
`;
|
|
|
|
const HeaderSection = styled.div`
|
|
display: flex;
|
|
flex: 1;
|
|
align-items: center;
|
|
`;
|
|
|
|
const StyledDropDownContainer = styled.div``;
|
|
|
|
const AppsmithLogoImg = styled.img`
|
|
max-width: 110px;
|
|
`;
|
|
|
|
type PageHeaderProps = {
|
|
user?: User;
|
|
};
|
|
|
|
// const StyledSwitcher = styled(ThemeSwitcher)`
|
|
// flex: 1;
|
|
// `;
|
|
|
|
export const PageHeader = (props: PageHeaderProps) => {
|
|
const { user } = props;
|
|
const location = useLocation();
|
|
const queryParams = new URLSearchParams(location.search);
|
|
let loginUrl = AUTH_LOGIN_URL;
|
|
if (queryParams.has("redirectTo")) {
|
|
loginUrl += `?redirectTo=${queryParams.get("redirectTo")}`;
|
|
}
|
|
|
|
return (
|
|
<StyledPageHeader>
|
|
<HeaderSection>
|
|
<Link to={APPLICATIONS_URL}>
|
|
<AppsmithLogoImg src={AppsmithLogo} alt="Appsmith logo" />
|
|
</Link>
|
|
</HeaderSection>
|
|
{/* <StyledSwitcher /> */}
|
|
{user && (
|
|
<StyledDropDownContainer>
|
|
{user.username === ANONYMOUS_USERNAME ? (
|
|
<Button
|
|
filled
|
|
text="Sign In"
|
|
intent={"primary"}
|
|
size="small"
|
|
onClick={() => history.push(loginUrl)}
|
|
/>
|
|
) : (
|
|
<CustomizedDropdown {...DropdownProps(user, user.username)} />
|
|
)}
|
|
</StyledDropDownContainer>
|
|
)}
|
|
</StyledPageHeader>
|
|
);
|
|
};
|
|
|
|
const mapStateToProps = (state: AppState) => ({
|
|
user: getCurrentUser(state),
|
|
});
|
|
|
|
export default connect(mapStateToProps)(PageHeader);
|