Skip to content

fix(calculator): show all four number bases and add copy actions - #1128

Merged
Xoshbin merged 1 commit into
mainfrom
fix/calculator-base-conversion-formats
Nov 25, 2026
Merged

Xoshbin merged 1 commit into
mainfrom
fix/calculator-base-conversion-formats

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Explicit base conversions (e.g. 0b101 in hex) previously reused
all_bases_detail(), which omitted decimal and duplicated the target
base in the expression subtitle.

  • Replace all_bases_detail with other_bases_detail in extras.rs so
    the subtitle always shows the other three bases among dec/bin/oct/hex.
  • Attach baseFormats to base results in CalculatorExtension and
    expose calculator:copy-base-{dec,bin,oct,hex} actions in ⌘K,
    matching the existing colorFormats pattern.
  • Add selection_actions.copy_base_as_desc across all 5 locale files
    and unit tests covering both Rust evaluation and rowActions.

What changed

  • Before (issue / current behavior):
  • After (fix / new behavior):

Affected areas

  • Launcher UI / UX (visuals, interactions, keyboard shortcuts, settings)
  • SDK / Extensions (asyar-sdk, extension runtime, IPC contracts, manifest)
  • Rust Backend / Platform (Tauri commands, search, storage, OS integration)
  • Docs / Tooling / Other (docs, CI, build scripts, locales)

Manual smoke test & Validation

  • I manually smoke-tested this in the running app (pnpm dev) and visually verified the fix/feature works.

AI usage

  • AI tools helped produce this change.
  • I ran the asyar-contribution skill (.agents/skills/asyar-contribution/SKILL.md), followed it, and reviewed every generated line.

Boundaries

  • Zero-hardcoded-strings i18n policy respected (if UI strings were added/changed).
  • Third-party extension compatibility preserved (no breaking changes to published extension contracts without deprecation/boundary adapter).
  • Hot paths remain fast and unblocked (window reveal, keystroke search, and 120 FPS UI responsiveness).
  • pnpm check:ci (or the relevant inner-loop checks) passes locally.

Summary by CodeRabbit

  • New Features
    • Number-base conversion results now show equivalent values in decimal, binary, octal, and hexadecimal formats.
    • Copy actions are available for each recognized format, making it easier to copy a result in the desired base.
    • Decimal values retain thousands separators; non-decimal values use lowercase prefixes and uppercase hexadecimal digits.

Explicit base conversions (e.g. `0b101 in hex`) previously reused
`all_bases_detail()`, which omitted decimal and duplicated the target
base in the expression subtitle.

- Replace `all_bases_detail` with `other_bases_detail` in `extras.rs` so
  the subtitle always shows the other three bases among dec/bin/oct/hex.
- Attach `baseFormats` to base results in `CalculatorExtension` and
  expose `calculator:copy-base-{dec,bin,oct,hex}` actions in `⌘K`,
  matching the existing `colorFormats` pattern.
- Add `selection_actions.copy_base_as_desc` across all 5 locale files
  and unit tests covering both Rust evaluation and `rowActions`.
@github-actions github-actions Bot added the bug Something isn't working label Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Base conversion results now share formatting logic and list the other three bases. Calculator search results expose copy actions for recognized decimal, binary, octal, and hexadecimal values. Tests cover conversion details, available actions, and clipboard output.

Changes

Calculator base formats

Layer / File(s) Summary
Base conversion output
asyar-launcher/src-tauri/crates/asyar-calculator/src/extras.rs
Shared formatting helpers handle decimal, binary, octal, and hexadecimal values. Result details list the three bases other than the selected base. Tests cover conversions to all four bases.
Base-format copy actions
asyar-launcher/src/built-in-features/calculator/index.ts, asyar-launcher/src/built-in-features/calculator/index.test.ts, asyar-launcher/src/locales/*.json
Calculator results collect recognized base formats in a fixed order and provide copy actions for those values. Tests check the action IDs and clipboard output. Locale files add the action description.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • Xoshbin/asyar#943: Added the rowActions hook and colorFormats payload that this change extends for base-format copy actions.

Suggested labels: bug, enhancement

Suggested reviewers: bennocrafter

Merge Risk: Minimal · up to c6ab8

This change fixes the base-conversion subtitles and adds copy actions for decimal, binary, octal and hexadecimal results. No concrete merge-blocking risk was found, and the change is low-risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the calculator feature and both changes in the PR: showing all four number bases and adding copy actions for them. The raw summary confirms base-conversion detail strings and calculato…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the calculator feature and both changes in the PR: showing all four number bases and adding copy actions for them. The raw summary confirms base-conversion detail strings and calculator:copy-base actions in the changeset, so the title matches the main change. It uses the conventional fix(scope) form and is concise.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a38d0d7 and c6ab883.

Files selected for processing: 8

  • asyar-launcher/src-tauri/crates/asyar-calculator/src/extras.rs
  • asyar-launcher/src/built-in-features/calculator/index.test.ts
  • asyar-launcher/src/built-in-features/calculator/index.ts
  • asyar-launcher/src/locales/en.json
  • asyar-launcher/src/locales/fr.json
  • asyar-launcher/src/locales/pt-BR.json
  • asyar-launcher/src/locales/zh-CN.json
  • asyar-launcher/src/locales/zh-Hant.json

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

@Xoshbin
Xoshbin merged commit 545970f into main Nov 25, 2026
14 checks passed
@Xoshbin
Xoshbin deleted the fix/calculator-base-conversion-formats branch November 25, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant