## Description Updating the settings icon throughout the product to use the below icon: https://www.figma.com/design/8L9BXMzNTKboGWlHpdXyYP/Appsmith-IDE?node-id=33-3546&t=qpptzxhkWatrFIn1-4 Fixes [#37248](https://github.com/appsmithorg/appsmith/issues/37248) ## Automation /ok-to-test tags="@tag.Sanity" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11796204902> > Commit: 0e57343a6c2b7543f37e37940f8447be10ccd9e9 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11796204902&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity` > Spec: > <hr>Tue, 12 Nov 2024 12:12:33 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated icons for various settings-related components from "settings-2-line" to "settings-v3" to enhance visual representation. - **Bug Fixes** - Improved handling of frame ancestor settings in the AdminSettings configuration, ensuring better management of stored values. - **Documentation** - No changes to the documentation were made in this release. - **Chores** - Updated multiple components to reflect the new icon, maintaining overall functionality without introducing new logic. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
186 lines
6.0 KiB
TypeScript
186 lines
6.0 KiB
TypeScript
import { getAppsmithConfigs } from "ee/configs";
|
|
import {
|
|
ADMIN_SETTINGS,
|
|
APPSMITH_DISPLAY_VERSION,
|
|
CHAT_WITH_US,
|
|
DOCUMENTATION,
|
|
HELP,
|
|
WHATS_NEW,
|
|
createMessage,
|
|
} from "ee/constants/messages";
|
|
import { FEATURE_FLAG } from "ee/entities/FeatureFlag";
|
|
import { getCurrentApplicationIdForCreateNewApp } from "ee/selectors/applicationSelectors";
|
|
import { getTenantPermissions } from "ee/selectors/tenantSelectors";
|
|
import {
|
|
getAdminSettingsPath,
|
|
getShowAdminSettings,
|
|
} from "ee/utils/BusinessFeatures/adminSettingsHelpers";
|
|
import { isAirgapped } from "ee/utils/airgapHelpers";
|
|
import { ShowUpgradeMenuItem } from "ee/utils/licenseHelpers";
|
|
import type { User } from "constants/userConstants";
|
|
import {
|
|
Button,
|
|
Menu,
|
|
MenuContent,
|
|
MenuItem,
|
|
MenuSeparator,
|
|
MenuTrigger,
|
|
Tooltip,
|
|
} from "@appsmith/ads";
|
|
import React, { useState } from "react";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useRouteMatch } from "react-router";
|
|
import { howMuchTimeBeforeText } from "utils/helpers";
|
|
import { useFeatureFlag } from "utils/hooks/useFeatureFlag";
|
|
import {
|
|
DropdownOnSelectActions,
|
|
getOnSelectAction,
|
|
} from "../CustomizedDropdown/dropdownHelpers";
|
|
import { IntercomConsent } from "pages/Editor/HelpButton";
|
|
import { DOCS_BASE_URL } from "constants/ThirdPartyConstants";
|
|
import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
|
|
import styled from "styled-components";
|
|
const { cloudHosting, intercomAppID } = getAppsmithConfigs();
|
|
|
|
export const VersionData = styled.div`
|
|
display: flex;
|
|
flex-direction: column;
|
|
color: var(--ads-v2-color-fg-muted);
|
|
font-size: 8px;
|
|
position: relative;
|
|
padding: 6px 12px 12px;
|
|
gap: 4px;
|
|
`;
|
|
|
|
const HomepageHeaderAction = ({
|
|
setIsProductUpdatesModalOpen,
|
|
user,
|
|
}: {
|
|
user: User;
|
|
setIsProductUpdatesModalOpen: (val: boolean) => void;
|
|
}) => {
|
|
const dispatch = useDispatch();
|
|
const isFeatureEnabled = useFeatureFlag(FEATURE_FLAG.license_gac_enabled);
|
|
const tenantPermissions = useSelector(getTenantPermissions);
|
|
const isCreateNewAppFlow = useSelector(
|
|
getCurrentApplicationIdForCreateNewApp,
|
|
);
|
|
const isHomePage = useRouteMatch("/applications")?.isExact;
|
|
const isAirgappedInstance = isAirgapped();
|
|
const { appVersion } = getAppsmithConfigs();
|
|
const howMuchTimeBefore = howMuchTimeBeforeText(appVersion.releaseDate);
|
|
const [showIntercomConsent, setShowIntercomConsent] = useState(false);
|
|
|
|
if (!isHomePage || !!isCreateNewAppFlow) return null;
|
|
|
|
return (
|
|
<div className="flex items-center">
|
|
<ShowUpgradeMenuItem />
|
|
{getShowAdminSettings(isFeatureEnabled, user) && (
|
|
<Tooltip content={createMessage(ADMIN_SETTINGS)} placement="bottom">
|
|
<Button
|
|
className="admin-settings-menu-option"
|
|
isIconButton
|
|
kind="tertiary"
|
|
onClick={() => {
|
|
getOnSelectAction(DropdownOnSelectActions.REDIRECT, {
|
|
path: getAdminSettingsPath(
|
|
isFeatureEnabled,
|
|
user?.isSuperUser,
|
|
tenantPermissions,
|
|
),
|
|
});
|
|
}}
|
|
size="md"
|
|
startIcon="settings-v3"
|
|
/>
|
|
</Tooltip>
|
|
)}
|
|
{!isAirgappedInstance && (
|
|
<Menu
|
|
onOpenChange={(open) => {
|
|
if (open) {
|
|
setShowIntercomConsent(false);
|
|
dispatch({
|
|
type: ReduxActionTypes.FETCH_RELEASES,
|
|
});
|
|
}
|
|
}}
|
|
>
|
|
<Tooltip content={createMessage(HELP)} placement="bottom">
|
|
<MenuTrigger>
|
|
<Button
|
|
className="t--help-menu-option"
|
|
isIconButton
|
|
kind="tertiary"
|
|
onClick={() => {}}
|
|
size="md"
|
|
startIcon="question-line"
|
|
/>
|
|
</MenuTrigger>
|
|
</Tooltip>
|
|
<MenuContent align="end" width="172px">
|
|
{showIntercomConsent ? (
|
|
<IntercomConsent showIntercomConsent={setShowIntercomConsent} />
|
|
) : (
|
|
<>
|
|
<MenuItem
|
|
className="t--documentation-button"
|
|
onClick={() => {
|
|
window.open(DOCS_BASE_URL, "_blank");
|
|
}}
|
|
startIcon="book-line"
|
|
>
|
|
{createMessage(DOCUMENTATION)}
|
|
</MenuItem>
|
|
{intercomAppID && window.Intercom && !isAirgapped() && (
|
|
<MenuItem
|
|
onSelect={(e) => {
|
|
if (user?.isIntercomConsentGiven || cloudHosting) {
|
|
window.Intercom("show");
|
|
} else {
|
|
e?.preventDefault();
|
|
setShowIntercomConsent(true);
|
|
}
|
|
}}
|
|
startIcon="chat-help"
|
|
>
|
|
{createMessage(CHAT_WITH_US)}
|
|
</MenuItem>
|
|
)}
|
|
<MenuSeparator className="mb-1" />
|
|
<MenuItem
|
|
className="t--product-updates-btn"
|
|
data-testid="t--product-updates-btn"
|
|
onClick={() => {
|
|
setIsProductUpdatesModalOpen(true);
|
|
}}
|
|
startIcon="gift-line"
|
|
>
|
|
{createMessage(WHATS_NEW)}
|
|
</MenuItem>
|
|
<VersionData>
|
|
<div>
|
|
{createMessage(
|
|
APPSMITH_DISPLAY_VERSION,
|
|
appVersion.edition,
|
|
appVersion.id.endsWith("-SNAPSHOT")
|
|
? appVersion.sha.substring(0, 8)
|
|
: appVersion.id,
|
|
)}
|
|
</div>
|
|
{howMuchTimeBefore !== "" && (
|
|
<div>Released {howMuchTimeBefore} ago</div>
|
|
)}
|
|
</VersionData>
|
|
</>
|
|
)}
|
|
</MenuContent>
|
|
</Menu>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default HomepageHeaderAction;
|