Skip to content

Commit

Permalink
chore: Remove href from local nav elements
Browse files Browse the repository at this point in the history
  • Loading branch information
hetunandu committed Jan 27, 2025
1 parent 4c2484e commit daf90eb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
23 changes: 5 additions & 18 deletions app/client/src/pages/Applications/ApplicationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,6 @@ export function ApplicationCard(props: ApplicationCardProps) {

const launchApp = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();

if (e.ctrlKey || e.metaKey) {
window.open(viewModeURL, "_blank");

Expand All @@ -505,9 +502,6 @@ export function ApplicationCard(props: ApplicationCardProps) {

const editApp = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
e.stopPropagation();

if (e.ctrlKey || e.metaKey) {
window.open(editModeURL, "_blank");

Expand All @@ -521,16 +515,11 @@ export function ApplicationCard(props: ApplicationCardProps) {
[dispatch, editModeURL, setURLParams],
);

const launchMobileApp = useCallback(
(e) => {
e.preventDefault();
e.stopPropagation();
setURLParams();
history.push(viewModeURL);
dispatch(getCurrentUser());
},
[setURLParams, viewModeURL, dispatch],
);
const launchMobileApp = useCallback(() => {
setURLParams();
history.push(viewModeURL);
dispatch(getCurrentUser());
}, [setURLParams, viewModeURL, dispatch]);

return (
<Card
Expand All @@ -555,7 +544,6 @@ export function ApplicationCard(props: ApplicationCardProps) {
{hasEditPermission && !isMenuOpen && (
<Button
className="t--application-edit-link"
href={editModeURL}
onClick={editApp}
renderAs="a"
size="md"
Expand All @@ -567,7 +555,6 @@ export function ApplicationCard(props: ApplicationCardProps) {
{!isMenuOpen && (
<Button
className="t--application-view-link"
href={viewModeURL}
kind="secondary"
onClick={launchApp}
renderAs="a"
Expand Down
10 changes: 8 additions & 2 deletions app/client/src/pages/Editor/AppsmithLink.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from "react";
import React, { useCallback } from "react";
import { Link, Tooltip } from "@appsmith/ads";
import styled from "styled-components";
import { LOGO_TOOLTIP, createMessage } from "ee/constants/messages";
import { APPLICATIONS_URL } from "constants/routes";
import AppsmithLogo from "assets/images/appsmith_logo_square.png";
import history from "utils/history";

export const StyledLink = styled((props) => {
// we are removing non input related props before passing them in the components
Expand All @@ -14,6 +15,7 @@ export const StyledLink = styled((props) => {
min-width: 24px;
width: 24px;
display: inline-block;
img {
min-width: 24px;
width: 24px;
Expand All @@ -22,9 +24,13 @@ export const StyledLink = styled((props) => {
`;

export const AppsmithLink = () => {
const handleOnClick = useCallback(() => {
history.push(APPLICATIONS_URL);
}, []);

return (
<Tooltip content={createMessage(LOGO_TOOLTIP)} placement="bottomLeft">
<StyledLink target="_self" to={APPLICATIONS_URL}>
<StyledLink onClick={handleOnClick}>
<img
alt="Appsmith logo"
className="t--appsmith-logo"
Expand Down

0 comments on commit daf90eb

Please sign in to comment.