Skip to content

feat(dncl): improve UX when unexpectedly in Japanese (DNCL) mode#702

Merged
takaokouji merged 10 commits into
developfrom
feat/issue-701-dncl-exit-ux
May 22, 2026
Merged

feat(dncl): improve UX when unexpectedly in Japanese (DNCL) mode#702
takaokouji merged 10 commits into
developfrom
feat/issue-701-dncl-exit-ux

Conversation

@takaokouji
Copy link
Copy Markdown

Summary

  • 日本語(DNCL)モードで拡張機能ボタンを押すと alert ではなく confirm ダイアログを表示し、OKを選択するとふりがなモードに戻して拡張機能ライブラリを開く
  • コードタブのブロックエリアに「日本語モード:ブロックが制限されています」バナーを追加し、「Rubyふりがなモードに戻す」ボタンで即座にフル toolbox に復元できるようにする

Changes

Phase 1 — Redux signal

  • reducers/dncl-mode.js: exitDnclModeExternallyRequested フラグを追加(外部からの DNCL 終了要求を Ruby タブに伝えるシグナル)

Phase 2 — Extension button confirm

  • components/extension-button/extension-button.jsx: alertconfirm に変更、OKで onRequestExitDnclMode + onExtensionButtonClick を呼ぶ

Phase 3 — DnclModeNotice banner

  • components/dncl-mode-notice/ (新規): ワークスペース右上に position:absolute で浮くバナー
  • components/gui/gui.jsx: DnclModeNotice を blocksWrapper 内に配置
  • containers/gui.jsx: onRequestExitDnclMode を mapDispatchToProps に追加

Phase 4 — Ruby tab wasDncl skip

  • containers/ruby-tab.jsx: Ruby タブの wasDncl パスで exitDnclModeExternallyRequested=true のとき handleToggleDnclMode() をスキップして DNCL の再有効化を抑止

Phase 5 — Locales

  • locales/en.js / ja.js / ja-Hira.js: confirm ダイアログ文とバナー文を追加

Bug fix — shouldComponentUpdate

  • containers/blocks.jsx: shouldComponentUpdatednclMode が含まれておらず、Redux の dnclMode 変化で toolbox が即時更新されなかった問題を修正

Test plan

  • 単体テスト: test/unit/reducers/dncl-mode-reducer.test.js(10件)
  • 単体テスト: test/unit/components/extension-button-dncl.test.jsx(5件)
  • 単体テスト: test/unit/components/dncl-mode-notice.test.jsx(6件)
  • Playwright 確認:
    • DNCL モードでバナーが右側(ワークスペース)に表示される
    • 「Rubyふりがなモードに戻す」クリック後、タブ切り替えなしでフル toolbox に即時復元
    • 拡張機能ボタンが confirm ダイアログを表示する
  • CI green

🤖 Generated with Claude Code

takaokouji and others added 9 commits May 22, 2026 21:42
Add `exitDnclModeExternallyRequested` state and two new actions
(`requestExternalExitDnclMode` / `clearExternalExitDnclModeRequest`) to
dncl-mode.js so that external components (e.g. ExtensionButton) can
signal ruby-tab to exit DNCL mode without directly calling
`handleToggleDnclMode`.

Closes part of #701.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…callback

Replace window.alert with window.confirm in DNCL mode. When the user
confirms, dispatch onRequestExitDnclMode (Redux signal) and open the
extension library. Cancel leaves the mode unchanged.

Refs #701.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add DnclModeNotice component (blocks tab warning banner with
  "Rubyふりがなモードに戻す" button and confirm dialog)
- Wire onRequestExitDnclMode callback: dispatches setDnclMode(false)
  and requestExternalExitDnclMode to gui container
- Pass onRequestExitDnclMode to ExtensionButton and DnclModeNotice in
  gui.jsx
- Update .prettierignore and smalruby-prettier-files.md for new files

Refs #701.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rapper

Move the notice inside the blocksWrapper Box and use position:absolute so it
floats over the top of the blocks panel without displacing the workspace area.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lly requested

When the user clicks the extension button or the notice banner to exit DNCL
mode, redux sets exitDnclModeExternallyRequested=true. When the Ruby tab
subsequently opens and hits the wasDncl path, it checks this flag and skips
calling handleToggleDnclMode(), leaving the editor in furigana/ruby mode.
The flag is cleared via onClearExitDnclModeRequest after being consumed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace dnclExtensionDisabled alert string with dnclExtensionConfirm
  confirm dialog text in en/ja/ja-Hira locales
- Add gui.dnclModeNotice.message and gui.dnclModeNotice.exitButton
- Right-align notice (flex-end) so message appears in the workspace area
  and is not hidden behind the block toolbox panel

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use right:0 / left:auto so the notice floats only in the workspace area,
not behind the block toolbox panel.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without this, shouldComponentUpdate returned false when only dnclMode
changed, preventing componentDidUpdate from running and the toolbox from
refreshing. Now the blocks toolbox immediately shows the full set of
categories when DNCL mode is exited from the Code tab.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ers.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

- Run prettier on ruby-tab.jsx to fix lint failure
- Add exitDnclModeExternallyRequested to dnclMode mock state in
  ruby-tab-project-changed.test.js to fix TypeError

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@takaokouji takaokouji merged commit 15d9e4f into develop May 22, 2026
9 checks passed
@takaokouji takaokouji deleted the feat/issue-701-dncl-exit-ux branch May 22, 2026 16:07
github-actions Bot pushed a commit that referenced this pull request May 22, 2026
…1-dncl-exit-ux

feat(dncl): improve UX when unexpectedly in Japanese (DNCL) mode
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.

1 participant