PromucFlow_constructor/app/client/src/pages/Home/LeftPaneBottomSection.tsx

137 lines
4.2 KiB
TypeScript
Raw Normal View History

2022-03-03 10:56:53 +00:00
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import styled from "styled-components";
import { Classes as BlueprintClasses } from "@blueprintjs/core";
feat: Migrate design system components import to design-system repo - I (#15562) * Icon component deleted and changed the imports in refrence places * design system package version changed * import changes * Delete TextInput.tsx * Change imports * Change single named import * Update package * Update package * Delete ScrollIndicator.tsx * Change imports * Icon import completed * Event type added * Changed Button component imports * import change button * Button onclick type fix * Label with Tooltip import changes * Changed breadcrumbs import * EmojiPicker and Emoji Reaction import changes * AppIcon import change * import bug fix * Menu Item import chnages * Icon selector imports changed * Delete LabelWithTooltip.tsx * Change imports across the app * Update package version * Update version number for design-system * Delete Checkbox.tsx * Remove the exports * Add lock file for ds package update * Change imports * default import -> named * Update release version * Make arg type explicit * Updated design-system to latest release * Missing file mysteriously comes back and is updated accordingly * changes design-system package version * Add types to arguments in the onChange for text input * onBlur type fix * Search component in property pane * WDS button changes reverted * package version bumped * conflict fix * Remove Dropdown, change imports * Category import fix * fix: table icon size import * Bump version of design system package * Yarn lock Co-authored-by: Tanvi Bhakta <tanvibhakta@gmail.com>
2022-08-22 05:09:39 +00:00
import { MenuItem } from "design-system";
2022-03-03 10:56:53 +00:00
import {
ADMIN_SETTINGS,
APPSMITH_DISPLAY_VERSION,
2022-03-03 10:56:53 +00:00
createMessage,
DOCUMENTATION,
WELCOME_TOUR,
} from "@appsmith/constants/messages";
import { getIsFetchingApplications } from "selectors/applicationSelectors";
import { getOnboardingWorkspaces } from "selectors/onboardingSelectors";
2022-03-03 10:56:53 +00:00
import { getAppsmithConfigs } from "@appsmith/configs";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { howMuchTimeBeforeText } from "utils/helpers";
import { onboardingCreateApplication } from "actions/onboardingActions";
import ProductUpdatesModal from "pages/Applications/ProductUpdatesModal";
import { Colors } from "constants/Colors";
import {
DropdownOnSelectActions,
getOnSelectAction,
} from "../common/CustomizedDropdown/dropdownHelpers";
import { getCurrentUser } from "selectors/usersSelectors";
import {
getDefaultAdminSettingsPath,
showAdminSettings,
} from "@appsmith/utils/adminSettingsHelpers";
import { getTenantPermissions } from "@appsmith/selectors/tenantSelectors";
2022-03-03 10:56:53 +00:00
const Wrapper = styled.div`
padding-bottom: ${(props) => props.theme.spaces[3]}px;
background-color: ${Colors.WHITE};
width: 100%;
margin-top: auto;
2022-03-03 10:56:53 +00:00
& .ads-dialog-trigger {
margin-top: ${(props) => props.theme.spaces[1]}px;
}
& .ads-dialog-trigger > div {
position: initial;
width: 92%;
padding: ${(props) =>
`${props.theme.spaces[0]}px ${props.theme.spaces[6]}px`};
}
`;
const LeftPaneVersionData = styled.div`
display: flex;
justify-content: space-between;
color: ${Colors.MIRAGE_2};
font-size: 8px;
width: 92%;
margin-top: ${(props) => props.theme.spaces[3]}px;
`;
function LeftPaneBottomSection() {
const dispatch = useDispatch();
const onboardingWorkspaces = useSelector(getOnboardingWorkspaces);
2022-03-03 10:56:53 +00:00
const isFetchingApplications = useSelector(getIsFetchingApplications);
const { appVersion, cloudHosting } = getAppsmithConfigs();
2022-03-03 10:56:53 +00:00
const howMuchTimeBefore = howMuchTimeBeforeText(appVersion.releaseDate);
const user = useSelector(getCurrentUser);
const tenantPermissions = useSelector(getTenantPermissions);
2022-03-03 10:56:53 +00:00
return (
<Wrapper>
{showAdminSettings(user) && !isFetchingApplications && (
<MenuItem
className="admin-settings-menu-option"
icon="setting"
onSelect={() => {
getOnSelectAction(DropdownOnSelectActions.REDIRECT, {
path: getDefaultAdminSettingsPath({
isSuperUser: user?.isSuperUser,
tenantPermissions,
}),
});
}}
text={createMessage(ADMIN_SETTINGS)}
/>
)}
2022-03-03 10:56:53 +00:00
<MenuItem
className={isFetchingApplications ? BlueprintClasses.SKELETON : ""}
icon="discord"
onSelect={() => {
window.open("https://discord.gg/rBTTVJp", "_blank");
}}
text={"Join our Discord"}
/>
<MenuItem
containerClassName={
isFetchingApplications ? BlueprintClasses.SKELETON : ""
}
icon="book"
onSelect={() => {
window.open("https://docs.appsmith.com/", "_blank");
}}
text={createMessage(DOCUMENTATION)}
/>
{!!onboardingWorkspaces.length && (
2022-03-03 10:56:53 +00:00
<MenuItem
containerClassName={
isFetchingApplications
? BlueprintClasses.SKELETON
: "t--welcome-tour"
}
icon="guide"
onSelect={() => {
AnalyticsUtil.logEvent("WELCOME_TOUR_CLICK");
dispatch(onboardingCreateApplication());
}}
text={createMessage(WELCOME_TOUR)}
/>
)}
<ProductUpdatesModal />
<LeftPaneVersionData>
<span>
{createMessage(
APPSMITH_DISPLAY_VERSION,
appVersion.edition,
appVersion.id,
cloudHosting,
)}
</span>
2022-03-03 10:56:53 +00:00
{howMuchTimeBefore !== "" && (
<span>Released {howMuchTimeBefore} ago</span>
)}
</LeftPaneVersionData>
</Wrapper>
);
}
export default LeftPaneBottomSection;