Skip to content

Commit

Permalink
fix: clean up delete tooltip (#1693)
Browse files Browse the repository at this point in the history
* fix: remove MUI tooltip for delete; use title (elimiates warning)

* fix: use "delete" in delete tooltip
  • Loading branch information
paulschreiber authored Mar 27, 2024
1 parent a8aabed commit 0efb15f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/localization/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -666,8 +666,8 @@
"upload_link_form.name": "$t(sharedData.upload_name_label)",
"upload_link_form.description": "$t(sharedData.upload_description_label)",
"addSharedDataLink.terraso_api.invalid": "Invalid $t(sharedData.upload_{{field}}_label)",
"link_delete_tooltip": "Remove link “{{name}}”.",
"file_delete_tooltip": "Remove file “{{name}}”.",
"link_delete_tooltip": "Delete link “{{name}}”.",
"file_delete_tooltip": "Delete file “{{name}}”.",
"visualization_unsaved_changes_title": "Leave Map?",
"visualization_unsaved_changes_message": "You have unsaved changes that will be lost if you leave the page.",
"shared_resource_download_no_preview": "No file preview available",
Expand Down
13 changes: 8 additions & 5 deletions src/sharedData/components/SharedDataEntryBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const SharedDataEntryBase = props => {
ShareComponent,
fileSize,
resourceType,
deleteTooltip,
} = props;
const [isEditingName, setIsEditingName] = useState(false);
const [isEditingDescription, setIsEditingDescription] = useState(false);
Expand Down Expand Up @@ -264,9 +263,14 @@ const SharedDataEntryBase = props => {
loading={processing}
variant="text"
buttonProps={{
title: t('sharedData.delete_label', {
name: dataEntry.name,
}),
title: t(
dataEntry.entryType === 'LINK'
? 'sharedData.link_delete_tooltip'
: 'sharedData.file_delete_tooltip',
{
name: dataEntry.name,
}
),
}}
confirmTitle={t('sharedData.delete_confirm_title', {
name: dataEntry.name,
Expand All @@ -284,7 +288,6 @@ const SharedDataEntryBase = props => {
? 'sharedData.delete_link_confirm_button'
: 'sharedData.delete_file_confirm_button'
)}
tooltip={deleteTooltip}
>
<DeleteIcon
sx={{
Expand Down
8 changes: 0 additions & 8 deletions src/sharedData/components/SharedDataEntryLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ const SharedDataEntryLink = props => {
return url.hostname;
}, [dataEntry.url]);

const toolTipKey =
dataEntry.entryType === 'LINK'
? 'sharedData.link_delete_tooltip'
: 'sharedData.file_delete_tooltip';

return (
<SharedDataEntryBase
sharedResource={sharedResource}
Expand All @@ -94,9 +89,6 @@ const SharedDataEntryLink = props => {
)}
DownloadComponent={DownloadComponent}
info={domain}
deleteTooltip={t(toolTipKey, {
name: dataEntry.name,
})}
/>
);
};
Expand Down

0 comments on commit 0efb15f

Please sign in to comment.