Skip to content

Conversation

tsnearly
Copy link

@tsnearly tsnearly commented Oct 7, 2025

Fixes #92 - why calculator does not work?
Fixes #98 - Calculator is not working

Change Summary

This pull request significantly enhances the functionality and usability of the Calculator.svelte component. It introduces a complete implementation of calculator logic, including digit and operator handling, keyboard support, and improved UI feedback through button hover effects. The changes make the calculator fully interactive, supporting basic arithmetic operations, percent, sign toggle, decimal input, and backspace, along with visual improvements.

Calculator Functionality Implementation:

  • Added state management variables (displayValue, firstOperand, operator, waitingForSecondOperand) and functions to handle digit input, operator logic (including percent and sign toggle), calculation execution, reset, and backspace actions. The calculator now supports chained operations, decimal input, and correct display updates.
  • Connected calculator buttons to their respective handlers using on:click, enabling full interactivity for number, operator, decimal, and clear actions.
  • Limited display output to 8 characters for better UI consistency.

Keyboard Support:

  • Added keyboard event handling for backspace, allowing users to delete digits using the keyboard.

UI/UX Improvements:

  • Introduced hover effects for .top-row-button, .number-button, and .operation-button classes to provide visual feedback when users interact with calculator buttons.

Copy link

changeset-bot bot commented Oct 7, 2025

⚠️ No Changeset found

Latest commit: 4c5d2e2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Oct 7, 2025

@tsnearly is attempting to deploy a commit to the Purus Projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calculator is not working why calculator does not work?
1 participant