Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lang/ui.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
"defaultMessage": "Add Python or other files to your project. A hex file opens as a new project.",
"description": "Hover text for the add files button"
},
"add-files-hover-replace": {
"defaultMessage": "Add Python or other files to your project. A hex file replaces all project files.",
"description": "Hover text for the add files button when the browser cannot keep more than one project, so opening a hex file replaces the open project"
},
"added-change": {
"defaultMessage": "Added file {changeName}",
"description": "Change made to file"
Expand Down
9 changes: 7 additions & 2 deletions src/project/AddFilesButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import { RiFileAddLine } from "react-icons/ri";
import { useIntl } from "react-intl";
import { CollapsibleButtonComposableProps } from "../common/CollapsibleButton";
import FileInputButton from "../common/FileInputButton";
import { useProjectsDatabaseActive } from "../fs/storage-status";
import { useProjectActions } from "./project-hooks";

interface AddFilesButtonProps extends CollapsibleButtonComposableProps {}

/**
* Adds files to the open project from the Files tab. A hex file becomes a
* new project instead.
* new project instead, or replaces the open one where there is no projects
* database to keep both.
*/
const AddFilesButton = (props: AddFilesButtonProps) => {
const actions = useProjectActions();
const intl = useIntl();
const projectsDatabaseActive = useProjectsDatabaseActive();
return (
<FileInputButton
{...props}
Expand All @@ -29,7 +32,9 @@ const AddFilesButton = (props: AddFilesButtonProps) => {
multiple
icon={<RiFileAddLine />}
tooltip={intl.formatMessage({
id: "add-files-hover",
id: projectsDatabaseActive
? "add-files-hover"
: "add-files-hover-replace",
})}
/>
);
Expand Down
Loading