diff --git a/app/client/src/pages/AppViewer/Navigation/components/BackToAppsButton.tsx b/app/client/src/pages/AppViewer/Navigation/components/BackToAppsButton.tsx index 67b09e4357..5148b7ca53 100644 --- a/app/client/src/pages/AppViewer/Navigation/components/BackToAppsButton.tsx +++ b/app/client/src/pages/AppViewer/Navigation/components/BackToAppsButton.tsx @@ -14,6 +14,8 @@ import { getCurrentUser } from "selectors/usersSelectors"; import type { User } from "constants/userConstants"; import { ANONYMOUS_USERNAME } from "constants/userConstants"; import { Icon, Tooltip } from "@appsmith/ads"; +import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors"; +import { APPLICATIONS_URL } from "constants/routes"; interface BackToAppsButtonProps { currentApplicationDetails?: ApplicationPayload; @@ -44,11 +46,20 @@ const BackToAppsButton = (props: BackToAppsButtonProps) => { ); const history = useHistory(); const currentUser: User | undefined = useSelector(getCurrentUser); + const currentWorkspaceId = useSelector(getCurrentWorkspaceId); if (currentUser?.username === ANONYMOUS_USERNAME) { return null; } + const handleNavigation = () => { + const applicationsUrl = currentWorkspaceId + ? `${APPLICATIONS_URL}?workspaceId=${currentWorkspaceId}` + : APPLICATIONS_URL; + + history.push(applicationsUrl); + }; + return ( { insideSidebar={insideSidebar} isMinimal={isMinimal} navColorStyle={navColorStyle} - onClick={() => { - history.push("/applications"); - }} + onClick={handleNavigation} primaryColor={primaryColor} text={insideSidebar && !isMinimal && createMessage(ALL_APPS)} /> diff --git a/app/client/src/pages/Editor/AppsmithLink.tsx b/app/client/src/pages/Editor/AppsmithLink.tsx index 216cf98506..95ebd5bc19 100644 --- a/app/client/src/pages/Editor/AppsmithLink.tsx +++ b/app/client/src/pages/Editor/AppsmithLink.tsx @@ -7,6 +7,7 @@ import AppsmithLogo from "assets/images/appsmith_logo_square.png"; import history from "utils/history"; import { useSelector } from "react-redux"; import { getOrganizationConfig } from "ee/selectors/organizationSelectors"; +import { getCurrentWorkspaceId } from "ee/selectors/selectedWorkspaceSelectors"; export const StyledLink = styled((props) => { // we are removing non input related props before passing them in the components @@ -27,18 +28,23 @@ export const StyledLink = styled((props) => { export const AppsmithLink = () => { const organizationConfig = useSelector(getOrganizationConfig); + const currentWorkspaceId = useSelector(getCurrentWorkspaceId); const handleOnClick = useCallback( (e: React.MouseEvent) => { e.stopPropagation(); + const applicationsUrl = currentWorkspaceId + ? `${APPLICATIONS_URL}?workspaceId=${currentWorkspaceId}` + : APPLICATIONS_URL; + if (e.ctrlKey || e.metaKey) { - window.open(APPLICATIONS_URL, "_blank"); + window.open(applicationsUrl, "_blank"); } else { - history.push(APPLICATIONS_URL); + history.push(applicationsUrl); } }, - [], + [currentWorkspaceId], ); return (