From 5d769ea173fc1035788914519d4eead5e6290d7f Mon Sep 17 00:00:00 2001 From: Matt Hillsdon Date: Sat, 21 Nov 2026 09:22:37 +0000 Subject: [PATCH] Say a hex replaces the project's files where it does The add files tooltip promised a new project. Without the projects database, and in iframe controller mode, a hex replaces the open project's files instead. --- lang/ui.en.json | 4 ++++ src/project/AddFilesButton.tsx | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lang/ui.en.json b/lang/ui.en.json index a6d8538de..018809bb0 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -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" diff --git a/src/project/AddFilesButton.tsx b/src/project/AddFilesButton.tsx index 700656970..f6da49da4 100644 --- a/src/project/AddFilesButton.tsx +++ b/src/project/AddFilesButton.tsx @@ -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 ( { multiple icon={} tooltip={intl.formatMessage({ - id: "add-files-hover", + id: projectsDatabaseActive + ? "add-files-hover" + : "add-files-hover-replace", })} /> );