Skip to content
This repository was archived by the owner on Apr 10, 2026. It is now read-only.

feat(hotkey): added option to trigger using hotkeys#103

Merged
xiduzo merged 1 commit into
mainfrom
feature/hotkey
Dec 9, 2025
Merged

feat(hotkey): added option to trigger using hotkeys#103
xiduzo merged 1 commit into
mainfrom
feature/hotkey

Conversation

@xiduzo

@xiduzo xiduzo commented Dec 9, 2025

Copy link
Copy Markdown
Owner

This pull request introduces a new "Hotkey" node to the Microflow Studio application, allowing users to trigger flows based on keyboard shortcuts. The implementation includes both frontend and backend support for hotkey detection, configuration, and event emission. Additionally, there are minor improvements to logging and documentation.

Hotkey Node Feature:

Backend/Runtime Support:

Other Improvements:

Copilot AI review requested due to automatic review settings December 9, 2025 08:30
@vercel

vercel Bot commented Dec 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
microflow Ready Ready Preview Comment Dec 9, 2025 8:31am

@xiduzo xiduzo merged commit 7b6ba9d into main Dec 9, 2025
11 of 12 checks passed
@xiduzo xiduzo deleted the feature/hotkey branch December 9, 2025 08:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new Hotkey node feature that allows users to trigger microflows using keyboard shortcuts. The implementation adds frontend components for hotkey detection and configuration, backend runtime support for handling hotkey events, and includes documentation updates for StandardFirmata installation.

  • Added a complete Hotkey node with UI dialog for configuring keyboard shortcuts
  • Implemented runtime class for hotkey event handling with pressed/released events
  • Improved documentation with clearer StandardFirmata installation instructions

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/electron-app/src/render/components/react-flow/nodes/Hotkey.tsx New React component for hotkey node with keyboard detection dialog and visual feedback
packages/runtime/src/hotkey/hotkey.ts Runtime class handling external value updates and emitting pressed/released events
packages/runtime/src/hotkey/hotkey.types.ts Zod schemas defining hotkey node data structure and value types
packages/runtime/index.ts Added export for new hotkey module
apps/electron-app/src/common/nodes.ts Registered Hotkey node in the node type system
apps/electron-app/package.json Added hotkeys-js dependency for keyboard shortcut handling
yarn.lock Lock file update for hotkeys-js package
apps/electron-app/src/main/ipc.ts Improved logging message clarity for external value IPC
apps/nextjs-app/app/docs/microflow-studio/page.md Updated documentation with clearer StandardFirmata installation steps
packages/flasher/StandardFirmata/StandardFirmata.bu Removed backup file (cleanup)
Comments suppressed due to low confidence (1)

apps/electron-app/src/render/components/react-flow/nodes/Hotkey.tsx:7

  • Unused imports Fragment, useCallback, useMemo, useRef.
import { useEffect, useState, useCallback, useRef, useMemo, Fragment } from 'react';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const [key, setKey] = useState<string | undefined>(props.initialKey);

useEffect(() => {
if (!open) return;

Copilot AI Dec 9, 2025

Copy link

Choose a reason for hiding this comment

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

Bug: The variable open is referenced on line 119 but it's not defined in the component scope. This should be props.open to correctly check if the dialog is open. This will cause the effect to never run, meaning the keydown event listener will never be attached.

Copilot uses AI. Check for mistakes.
return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, [open]);

Copilot AI Dec 9, 2025

Copy link

Choose a reason for hiding this comment

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

Bug: Missing dependency in the useEffect dependency array. The effect depends on props.open to properly set up/tear down the event listener when the dialog opens/closes. Add props.open to the dependency array on line 135.

Copilot uses AI. Check for mistakes.
"abcjs": "6.4.4",
"electron-log": "5.3.3",
"firmata": "https://github.com/xiduzo/firmata.js.git",
"hotkeys-js": "^4.0.0-beta.7",

Copilot AI Dec 9, 2025

Copy link

Choose a reason for hiding this comment

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

Using a beta version of a package (hotkeys-js@^4.0.0-beta.7) in production code can introduce instability and potential breaking changes. Consider using a stable release version instead, or document why the beta version is necessary and monitor for a stable release.

Suggested change
"hotkeys-js": "^4.0.0-beta.7",
"hotkeys-js": "3.12.0",

Copilot uses AI. Check for mistakes.
4. Open the Arduino IDE and connect your microcontroller to your computer
5. Go to `Tools > Port` and select the port where your microcontroller is connected (you should see it listed)
6. Go to `Tools > Board` and select the board you are using (like "Arduino Uno")
7. Opens the downloaded `StandardFirmata`.

Copilot AI Dec 9, 2025

Copy link

Choose a reason for hiding this comment

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

Grammatical error: "Opens" should be "Open" to match the imperative form used in other steps of the instructions.

Suggested change
7. Opens the downloaded `StandardFirmata`.
7. Open the downloaded `StandardFirmata`.

Copilot uses AI. Check for mistakes.
import { BaseNode, NodeContainer, useNodeControls, useNodeData, useNodeId } from './Node';
import { useNodeValue } from '../../../stores/node-data';
import { IconWithValue } from '../IconWithValue';
import { useEffect, useState, useCallback, useRef, useMemo, Fragment } from 'react';

Copilot AI Dec 9, 2025

Copy link

Choose a reason for hiding this comment

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

Unused imports: Several React hooks and components are imported but never used in this file. The following imports are not used:

  • useCallback, useRef, useMemo, Fragment from 'react'

These should be removed to keep the code clean and reduce bundle size.

Suggested change
import { useEffect, useState, useCallback, useRef, useMemo, Fragment } from 'react';
import { useEffect, useState } from 'react';

Copilot uses AI. Check for mistakes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants