]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16958 Multiple links have the same programmatic link text but different destina...
authorMathieu Suen <mathieu.suen@sonarsource.com>
Mon, 10 Oct 2022 11:43:22 +0000 (13:43 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 12 Oct 2022 20:03:43 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/code/components/ComponentPin.tsx
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 77b92aa4405918e1f8dafc065c9197dd02ec5364..848f1c39496e1bd25c63924a8d3057d09f4e77a0 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
+import theme from '../../../app/theme';
+import { ButtonPlain } from '../../../components/controls/buttons';
 import PinIcon from '../../../components/icons/PinIcon';
 import { WorkspaceContextShape } from '../../../components/workspace/context';
-import { translate } from '../../../helpers/l10n';
+import { translateWithParameters } from '../../../helpers/l10n';
 import { BranchLike } from '../../../types/branch-like';
 import { ComponentMeasure } from '../../../types/types';
 
@@ -31,9 +33,7 @@ interface Props {
 }
 
 export default class ComponentPin extends React.PureComponent<Props> {
-  handleClick = (event: React.SyntheticEvent<HTMLAnchorElement>) => {
-    event.preventDefault();
-    event.currentTarget.blur();
+  handleClick = () => {
     this.props.openComponent({
       branchLike: this.props.branchLike,
       key: this.props.component.key,
@@ -43,14 +43,15 @@ export default class ComponentPin extends React.PureComponent<Props> {
   };
 
   render() {
+    const { name } = this.props.component;
     return (
-      <a
+      <ButtonPlain
         className="link-no-underline"
-        href="#"
+        preventDefault={true}
         onClick={this.handleClick}
-        title={translate('component_viewer.open_in_workspace')}>
-        <PinIcon />
-      </a>
+        title={translateWithParameters('component_viewer.open_in_workspace_X', name)}>
+        <PinIcon fill={theme.colors.primary} />
+      </ButtonPlain>
     );
   }
 }
index 1d654070d38ba005adea3a3722380053c6abb077..10b53c4f0a8569415d2caf220c4735a50f1b07cc 100644 (file)
@@ -2872,6 +2872,7 @@ component_viewer.show_raw_source=Show Raw Source
 component_viewer.more_actions=More Actions
 component_viewer.new_window=Open in New Window
 component_viewer.open_in_workspace=Pin This File
+component_viewer.open_in_workspace_X=Pin {0} File
 component_viewer.copy_permalink=Click to copy permalink to clipboard
 component_viewer.covered_lines=Covered Lines
 component_viewer.show_details=Show Measures