Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/components/UploadButton/UploadButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ const UploadButton = (props) => {
const fileInputRef = useRef(null);

const onClickUpload = () => {
if (window.plausible) {
window.plausible("Upload project");
}
fileInputRef.current?.click();
};

const onFileSelected = (event) => {
const file = event.target.files?.[0];
if (!file || project.project_type !== "code_editor_scratch") return;

if (window.plausible) {
window.plausible("Upload project - file selected");
}
Comment on lines 19 to +32
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New analytics side effects (Plausible events on click and on file selection) are not covered by existing UploadButton tests. Please extend UploadButton.test.js to assert window.plausible is called with the expected event names for both interactions (and reset the mock between tests).

Copilot uses AI. Check for mistakes.

postMessageToScratchIframe({ type: "scratch-gui-upload", file });

// Reset so the same file can be selected again (change will fire next time).
Expand Down
Loading