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";
|
2022-08-22 05:09:39 +00:00
|
|
|
import { MenuItem } from "design-system";
|
2022-03-03 10:56:53 +00:00
|
|
|
import {
|
2022-09-28 17:27:40 +00:00
|
|
|
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";
|
2022-06-15 15:37:41 +00:00
|
|
|
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";
|
2022-09-26 14:08:32 +00:00
|
|
|
import {
|
|
|
|
|
DropdownOnSelectActions,
|
|
|
|
|
getOnSelectAction,
|
|
|
|
|
} from "../common/CustomizedDropdown/dropdownHelpers";
|
|
|
|
|
import { getCurrentUser } from "selectors/usersSelectors";
|
2022-12-01 06:30:50 +00:00
|
|
|
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%;
|
2022-10-21 17:35:54 +00:00
|
|
|
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();
|
2022-06-15 15:37:41 +00:00
|
|
|
const onboardingWorkspaces = useSelector(getOnboardingWorkspaces);
|
2022-03-03 10:56:53 +00:00
|
|
|
const isFetchingApplications = useSelector(getIsFetchingApplications);
|
2022-08-27 21:22:53 +00:00
|
|
|
const { appVersion, cloudHosting } = getAppsmithConfigs();
|
2022-03-03 10:56:53 +00:00
|
|
|
const howMuchTimeBefore = howMuchTimeBeforeText(appVersion.releaseDate);
|
2022-09-26 14:08:32 +00:00
|
|
|
const user = useSelector(getCurrentUser);
|
2022-12-01 06:30:50 +00:00
|
|
|
const tenantPermissions = useSelector(getTenantPermissions);
|
2022-03-03 10:56:53 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Wrapper>
|
2022-12-01 06:30:50 +00:00
|
|
|
{showAdminSettings(user) && !isFetchingApplications && (
|
2022-09-26 14:08:32 +00:00
|
|
|
<MenuItem
|
|
|
|
|
className="admin-settings-menu-option"
|
|
|
|
|
icon="setting"
|
|
|
|
|
onSelect={() => {
|
|
|
|
|
getOnSelectAction(DropdownOnSelectActions.REDIRECT, {
|
2022-12-01 06:30:50 +00:00
|
|
|
path: getDefaultAdminSettingsPath({
|
|
|
|
|
isSuperUser: user?.isSuperUser,
|
|
|
|
|
tenantPermissions,
|
|
|
|
|
}),
|
2022-09-26 14:08:32 +00:00
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
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)}
|
|
|
|
|
/>
|
2022-06-15 15:37:41 +00:00
|
|
|
{!!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>
|
2022-08-27 09:40:03 +00:00
|
|
|
<span>
|
|
|
|
|
{createMessage(
|
|
|
|
|
APPSMITH_DISPLAY_VERSION,
|
|
|
|
|
appVersion.edition,
|
|
|
|
|
appVersion.id,
|
2022-08-27 21:22:53 +00:00
|
|
|
cloudHosting,
|
2022-08-27 09:40:03 +00:00
|
|
|
)}
|
|
|
|
|
</span>
|
2022-03-03 10:56:53 +00:00
|
|
|
{howMuchTimeBefore !== "" && (
|
|
|
|
|
<span>Released {howMuchTimeBefore} ago</span>
|
|
|
|
|
)}
|
|
|
|
|
</LeftPaneVersionData>
|
|
|
|
|
</Wrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default LeftPaneBottomSection;
|