PromucFlow_constructor/app/client/src/pages/UserProfile/index.tsx

80 lines
2.0 KiB
TypeScript
Raw Normal View History

2021-10-20 07:38:17 +00:00
import React, { useState } from "react";
import PageWrapper from "pages/common/PageWrapper";
import styled from "styled-components";
chore: migrate toast (#17208) * Refactor toast to be passed the dispatch hook externally * Add comments explaining dilemma * use store.dispatch instead of a hook * use alpha version * Change imports * Refactor DebugButton out * update release * fix issue with incorrectly merged package.lock * fix syntax of alpha version * bump ds vesion * copy lock from release * update lock to have alpha * make changes * delete Toast * DS package version updated * import change from release * use new alpha version * update ds version * update ds version * chore: migrate editable text and friends (#17285) * Delete empty components * use alpha for ds * Deleted EditableTextSubComponent, import changes * Delete EditableText, import changes * use ds alpha 10 * Delete EditableTextWrapper.tsx * update ds to use next minor version * use new alpha * fix issue with merge Co-authored-by: Albin <albin@appsmith.com> * chore: migrate file picker v2 (#17308) * use alpha ds * Delete FilePickerV2, import changes * Delete FilePicker, change imports * update alpha version * chore: move copy url form into setting components (#17322) * move CopyUrlForm to src/pages/settings/formgroup * update ds version to use next minor release * feat: Migrate table component to design system (#17329) * feat: Migrate table component to design system * removed commented code in ads index file * fix: table no data hover effect removed Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com> * feat: Banner message component migrated to design system (#17327) * feat: Banner image component migrated to design system * Version update for design system package * design system version updated Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com> * feat: Tabs component migrated to design system (#17321) * feat: Tabs component migrated to design system * design system package version updated * Update app/client/src/components/editorComponents/form/FormDialogComponent.tsx * Update app/client/src/pages/Editor/PropertyPane/PropertyPaneTab.tsx * Tab component expand issue fix Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com> Co-authored-by: Albin <albin@appsmith.com> Co-authored-by: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com>
2022-10-13 20:13:44 +00:00
import { TabComponent, TabProp, Text, TextType } from "design-system";
import { Icon } from "@blueprintjs/core";
import General from "./General";
import { Colors } from "constants/Colors";
import GitConfig from "./GitConfig";
2021-10-20 07:38:17 +00:00
import { useLocation } from "react-router";
import { GIT_PROFILE_ROUTE } from "constants/routes";
import { useSelector } from "react-redux";
import { selectFeatureFlags } from "selectors/usersSelectors";
const ProfileWrapper = styled.div`
width: ${(props) => props.theme.pageContentWidth}px;
margin: 0 auto;
`;
2021-10-20 07:38:17 +00:00
const LinkToApplications = styled.div`
margin-top: 30px;
margin-bottom: 35px;
display: inline-block;
width: auto;
&:hover {
text-decoration: none;
}
svg {
cursor: pointer;
}
`;
function UserProfile() {
2021-10-20 07:38:17 +00:00
const location = useLocation();
const featureFlags = useSelector(selectFeatureFlags);
2021-10-20 07:38:17 +00:00
let initialTabIndex = 0;
const tabs: TabProp[] = [
{
key: "general",
title: "General",
panelComponent: <General />,
icon: "general",
},
];
if (featureFlags.GIT) {
tabs.push({
key: "gitConfig",
title: "Git user config",
panelComponent: <GitConfig />,
icon: "git-branch",
});
2021-10-20 07:38:17 +00:00
if (location.pathname === GIT_PROFILE_ROUTE) {
initialTabIndex = 1;
}
}
2021-10-20 07:38:17 +00:00
const [selectedTabIndex, setSelectedTabIndex] = useState(initialTabIndex);
return (
<PageWrapper displayName={"Profile"}>
<ProfileWrapper>
2021-10-20 07:38:17 +00:00
<LinkToApplications className="t--back" onClick={() => history.back()}>
<Icon color={Colors.SILVER_CHALICE} icon="chevron-left" />
<Text type={TextType.H1}>Profile</Text>
</LinkToApplications>
2021-10-20 07:38:17 +00:00
<TabComponent
onSelect={setSelectedTabIndex}
selectedIndex={selectedTabIndex}
tabs={tabs}
/>
</ProfileWrapper>
</PageWrapper>
);
}
export default UserProfile;