diff --git a/docs/extension-smalrubot-s1/README.md b/docs/extension-smalrubot-s1/README.md
index 644a8de4416..1c7bdffc1dd 100644
--- a/docs/extension-smalrubot-s1/README.md
+++ b/docs/extension-smalrubot-s1/README.md
@@ -1,11 +1,11 @@
-# 拡張機能: アーテックロボ(ArtecRobo)/旧 スモウルボットS1
+# 拡張機能: アーテックロボ(Studuino)/旧 スモウルボットS1
> **🆕 Smalruby 独自** — upstream に存在しない、Smalruby のために新規追加された拡張機能
- **Smalruby ランタイム対応**: ❌(smalruby3 gem は未対応。WebSerial API 経由でハードウェアと通信するためブラウザ専用)
- **デフォルト表示**: ✅(拡張機能ライブラリにデフォルトで表示される)
-> **いまの状態とこれから**: この拡張機能は、**同じ拡張機能のまま「アーテックロボ(ArtecRobo)」の名前に変えた**(前の名前は「スモウルボットS1」)。
+> **いまの状態とこれから**: この拡張機能は、**同じ拡張機能のまま「アーテックロボ(Studuino)」の名前に変えた**(前の名前は「スモウルボットS1」。2027-11-30 までは前の名前のカードも残す。下の「移行期間(前の名前のカード)」)。
> ブロックの表示は一般的な名前にし、実機が無くても動かせる **練習用の基板**(VM の中のしくみと、ステージの横のパネル)を入れた。
> このページは、いまの挙動と、リニューアルで決まった方針の両方を書く。
> 見分けがつくように、まだ実装していないことには **🚧 これから** と付ける(印の無いことは、いまの挙動)。
@@ -33,7 +33,7 @@
## 名前の変更と互換の方針
-**同じ拡張機能のまま、表示の名前だけを「アーテックロボ(ArtecRobo)」にした**。前の作品(sb3・Ruby)はそのまま開けて、そのまま動く。
+**同じ拡張機能のまま、表示の名前だけを「アーテックロボ(Studuino)」にした**。前の作品(sb3・Ruby)はそのまま開けて、そのまま動く。
### キットと基板の呼び分け
@@ -41,7 +41,8 @@
| 呼び名 | 使うところ |
|---|---|
-| **アーテックロボ**(英語は ArtecRobo) | 拡張機能の名前(ライブラリのカード・ブロックのカテゴリ・メニューバー・接続モーダルの見出し)、Ruby タブのふりがな、紹介ページの見出し |
+| **アーテックロボ(Studuino)**(英語は ArtecRobo (Studuino)、ひらがなの表示は「アーテックロボ (Studuino)」) | 拡張機能の名前(ライブラリのカード・ブロックのカテゴリ・メニューバー・接続モーダルの見出し)、紹介ページ。名前の後ろに基板の名前を添えて、「Studuino で授業ができる」と先生に伝わるようにする |
+| **アーテックロボ** | Ruby タブのふりがな(`studuino` の上に出る名前。短いままにする) |
| **Studuino**(スタディーノ) | 基板のこと: 接続の手順の文・ファームウェアのモーダル・練習用の基板のパネル・カードの説明文(「アーテックロボの Studuino 基板」) |
Ruby の書き方は `studuino.` のまま(下の「Ruby の書き方」)。スモウルビーのふりがなは読みではなく意味を書くので、`studuino` の上には「アーテックロボ」と出る。
@@ -50,7 +51,7 @@ Ruby の書き方は `studuino.` のまま(下の「Ruby の書き方」)。
| 対象 | 前 | いま |
|---|---|---|
-| 拡張機能の名前(ライブラリ・カテゴリ・メニューバー・接続モーダルの見出し) | スモウルボットS1 | **アーテックロボ(ArtecRobo)**(カテゴリとメニューバーは「アーテックロボ」、英語は「ArtecRobo」) |
+| 拡張機能の名前(ライブラリ・カテゴリ・メニューバー・接続モーダルの見出し) | スモウルボットS1 | **アーテックロボ(Studuino)**(カテゴリ・メニューバーも同じ。ひらがなの表示は「アーテックロボ (Studuino)」、英語は「ArtecRobo (Studuino)」) |
| 基板を指す文(接続モーダルの文・ファームウェアのモーダル・練習用の基板のパネル) | スモウルボットS1 | **Studuino**(ひらがなの表示の文の中は「スタディーノ」) |
| ライブラリの絵(カード・接続モーダル・カテゴリの絵) | スモウルボットS1 のロボットの写真 | **自分たちで用意した基板の絵**(アーテック社の写真・ロゴは使わない。下の「ライブラリの絵と商標の表記」) |
| ライブラリのカードの説明 | スモウルボットS1を制御する。 | アーテック社の表記に合わせた紹介と、登録商標の一文(下の「ライブラリの絵と商標の表記」) |
@@ -66,6 +67,20 @@ Ruby の書き方は `studuino.` のまま(下の「Ruby の書き方」)。

+### 移行期間(前の名前のカード)
+
+前の名前の資料(授業の手引き・プリント)が「スモウルボットS1 を選ぶ」と書いているので、**1 年の移行期間**を置く。
+
+- 拡張機能ライブラリには、**アーテックロボ(Studuino)** のカードのすぐ後ろに、前の名前・前の絵(スモウルボットS1 のロボットの写真。`smalrubot-s1/legacy-smalrubot-s1*.png`)の **スモウルボットS1** のカードも出す。説明は「アーテックロボ(Studuino)の前の名前です。選ぶと、アーテックロボ(Studuino)が使えます。」。
+- どちらのカードを選んでも、読みこむのは同じ拡張機能 `smalrubotS1`(ブロック・作品・Ruby は同じ)。拡張機能の ID は 1 つのまま。前のカードはライブラリの中だけの別の項目(キーと DOM の id は `smalrubotS1Legacy`)で、選ぶと今のカードに置きかえてから読みこむので、接続の流れも同じになる。
+- 前のカードを選ぶと、画面の上に **名前が変わったことの知らせ**(アラート・閉じるボタンつき。`data-testid="smalrubot-s1-renamed-alert"`)が出る: 「スモウルボットS1 は「アーテックロボ(Studuino)」に名前が変わりました。中身は同じです。これからは「アーテックロボ(Studuino)」を選んでください。」。アラートは接続モーダルより上に出るので、接続の手順の途中でも読める。
+- 前のカードには `smalrubot` / `スモウルボット` などのタグを付けてある(拡張機能ライブラリはいまは検索欄を出していないが、検索を出したときに前の名前で見つかる)。
+- **期限**: 前のカードを出すのは **2027-11-30 まで**(その日の終わりまで。端末の日付で判断)。日付は `legacy-card.jsx` の `SMALRUBOT_S1_LEGACY_CARD_LAST_DAY` の 1 か所で、過ぎると自動で出なくなる。期限が来たら、前のカードのコード(`legacy-card.jsx`・前の絵・知らせ・翻訳・テスト・このセクション)を消す。
+
+
+
+
+
### 変えないもの
前の作品を開けるように、次のものは **変えない**:
@@ -339,7 +354,7 @@ GUI は、イベントを聞いて表示し、センサーの値はこのメソ
### 接続
-1. ブロックパレットの「拡張機能を追加」から **アーテックロボ(ArtecRobo)** を選ぶ
+1. ブロックパレットの「拡張機能を追加」から **アーテックロボ(Studuino)** を選ぶ(2027-11-30 までは **スモウルボットS1** のカードを選んでもよい)
2. 接続モーダルが専用フローで開く(`smalrubot-s1-*-step.jsx` 系)。**生徒用 (接続) / 先生用 (ファームウェア書き込み)** のいずれかを選択

@@ -350,7 +365,7 @@ GUI は、イベントを聞いて表示し、センサーの値はこのメソ
### ファームウェアフラッシュ
-1. 接続モーダルの「ファームウェアを書き込む(先生用)」 もしくはメニューバーの「アーテックロボ」メニューから起動
+1. 接続モーダルの「ファームウェアを書き込む(先生用)」 もしくはメニューバーの「アーテックロボ(Studuino)」メニューから起動
2. ファームウェアフラッシュモーダル (`smalrubot-firmware-modal`) が開く。**macOS では PL2303 Serial Driver アプリのインストール案内** が先に表示される

@@ -360,7 +375,7 @@ GUI は、イベントを聞いて表示し、センサーの値はこのメソ
### ブロックパレット
-接続後はブロックパレットの **アーテックロボ** カテゴリに専用ブロックが表示される(ブロックの一覧は上の「ブロックと選択肢」):
+接続後はブロックパレットの **アーテックロボ(Studuino)** カテゴリに専用ブロックが表示される(ブロックの一覧は上の「ブロックと選択肢」):

@@ -379,6 +394,7 @@ Ruby タブのふりがなでは、`studuino` の上に「アーテックロボ
- `packages/scratch-gui/src/components/studuino-practice-board/` — 練習用の基板のパネル(表示)
- `packages/scratch-gui/src/containers/studuino-practice-board.jsx` — 練習用の基板のパネルのコンテナ(状態を読む・センサーの値を変える・置き場所を測る)
- `packages/scratch-gui/src/components/connection-modal/smalrubot-s1-*-step.jsx` × 5 — 専用接続ステップ(initial / connecting / connected / error / unsupported)
+- `packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx` — 移行期間の前の名前のカード(期限の定数・期限の判定・カードの差しこみ・選んだカードの置きかえ。純粋関数)
#### ライブラリ
@@ -410,6 +426,8 @@ Ruby タブのふりがなでは、`studuino` の上に「アーテックロボ
- `src/containers/connection-modal.jsx` — ファームウェアフラッシュ起動
- `src/components/connection-modal/error-step.jsx` — エラーステップでのファームウェアボタン
- `src/components/gui/gui.jsx` — 練習用の基板のパネルの配置
+- `src/containers/extension-library.jsx` — 前の名前のカードの差しこみと、選んだときの置きかえ・知らせ
+- `src/lib/alerts/index.jsx` — 名前が変わったことの知らせ(`smalrubotS1Renamed`)
詳細マーカー一覧: `docs/maintenance/smalruby-markers-gui.md`
@@ -440,8 +458,8 @@ Ruby タブのふりがなでは、`studuino` の上に「アーテックロボ
## テスト
-- 単体テスト: `packages/scratch-gui/test/unit/lib/smalrubot-firmware-flasher.test.js`, `packages/scratch-gui/test/unit/containers/studuino-practice-board.test.jsx`(パネル)
-- 結合テスト: `packages/scratch-gui/test/integration/smalrubot-firmware.test.js`, `smalrubot-s1-connection-flow.test.js`
+- 単体テスト: `packages/scratch-gui/test/unit/lib/smalrubot-firmware-flasher.test.js`, `packages/scratch-gui/test/unit/containers/studuino-practice-board.test.jsx`(パネル), `packages/scratch-gui/test/unit/lib/smalrubot-s1-legacy-card.test.jsx`(前の名前のカード)
+- 結合テスト: `packages/scratch-gui/test/integration/smalrubot-firmware.test.js`, `smalrubot-s1-connection-flow.test.js`, `smalrubot-s1-legacy-card.test.js`(前の名前のカード)
- VM 単体テスト: `packages/scratch-vm/test/unit/extension_smalrubot_s1.js`
## 関連ドキュメント
diff --git a/docs/extension-smalrubot-s1/screenshots/0101-initial-step-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0101-initial-step-1280x800.png
index 17636b76ec8..7fcabad7874 100644
Binary files a/docs/extension-smalrubot-s1/screenshots/0101-initial-step-1280x800.png and b/docs/extension-smalrubot-s1/screenshots/0101-initial-step-1280x800.png differ
diff --git a/docs/extension-smalrubot-s1/screenshots/0301-block-palette-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0301-block-palette-1280x800.png
index 74416c341e6..d546c8f08ae 100644
Binary files a/docs/extension-smalrubot-s1/screenshots/0301-block-palette-1280x800.png and b/docs/extension-smalrubot-s1/screenshots/0301-block-palette-1280x800.png differ
diff --git a/docs/extension-smalrubot-s1/screenshots/0401-library-card-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0401-library-card-1280x800.png
index ad5169bbdcb..5197ef218b4 100644
Binary files a/docs/extension-smalrubot-s1/screenshots/0401-library-card-1280x800.png and b/docs/extension-smalrubot-s1/screenshots/0401-library-card-1280x800.png differ
diff --git a/docs/extension-smalrubot-s1/screenshots/0402-library-legacy-card-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0402-library-legacy-card-1280x800.png
new file mode 100644
index 00000000000..d874f7ac13c
Binary files /dev/null and b/docs/extension-smalrubot-s1/screenshots/0402-library-legacy-card-1280x800.png differ
diff --git a/docs/extension-smalrubot-s1/screenshots/0403-renamed-alert-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0403-renamed-alert-1280x800.png
new file mode 100644
index 00000000000..36fa97c6d8d
Binary files /dev/null and b/docs/extension-smalrubot-s1/screenshots/0403-renamed-alert-1280x800.png differ
diff --git a/docs/extension-smalrubot-s1/screenshots/0701-about-page-1280x800.png b/docs/extension-smalrubot-s1/screenshots/0701-about-page-1280x800.png
index 4f3d8cfdd8f..a49ef1844c2 100644
Binary files a/docs/extension-smalrubot-s1/screenshots/0701-about-page-1280x800.png and b/docs/extension-smalrubot-s1/screenshots/0701-about-page-1280x800.png differ
diff --git a/docs/furigana/furigana-mapping.md b/docs/furigana/furigana-mapping.md
index 2784d6a0f53..ed6a6b3dae0 100644
--- a/docs/furigana/furigana-mapping.md
+++ b/docs/furigana/furigana-mapping.md
@@ -604,7 +604,7 @@ TryRuby 対応で追加された Ruby メソッドのふりがな。
| `mesh_v1`(レシーバー) | `メッシュ(従来)` | — |
| `mesh_v1.sensor_value("x")` | `メッシュ(従来)` `センサーの値` | 「xセンサーの値」 |
-### アーテックロボ(ArtecRobo)拡張機能(旧 スモウルボットS1)
+### アーテックロボ(Studuino)拡張機能(旧 スモウルボットS1)
`studuino` は事前定義レシーバー。レシーバー自体に `アーテックロボ` のふりがなが付く(読みの「スタディーノ」ではなく、意味としてキットの名前を書く)。ブロックからは `studuino.` を書き出す。前の書き方の `smalrubot_s1` も同じふりがな(レシーバー・メソッド・選択肢)が付く。
diff --git a/docs/maintenance/smalruby-markers-gui.md b/docs/maintenance/smalruby-markers-gui.md
index 2990af54997..c3f17f0d978 100644
--- a/docs/maintenance/smalruby-markers-gui.md
+++ b/docs/maintenance/smalruby-markers-gui.md
@@ -196,6 +196,7 @@ upstream ファイルに追加した Smalruby 固有コードのマーカー一
| `src/lib/legacy-storage.ts` | local sprite assets | スプライトの画像アセットをローカル配信の web store から解決する追加登録 |
| `src/lib/legacy-backpack-storage.ts` | localStorage backpack support | バックパックを localStorage に保存する対応(5 ペア) |
| `src/lib/alerts/index.jsx` | classroom session expired alert | クラスルームのセッション失効アラートの定義 |
+| `src/lib/alerts/index.jsx` | Smalrubot S1 renamed alert | 移行期間の前の名前のカード(スモウルボットS1)を選んだときの、名前が変わったことの知らせ(`smalrubotS1Renamed`。2027-11-30 の期限のあとに消す) |
| `src/components/alerts/alert.jsx` | classroom session expired | セッション失効アラートの表示側 |
| `src/containers/alert.jsx` | classroom session expired | セッション失効アラートのコンテナ側(3 ペア) |
| `src/lib/libraries/extensions/index.jsx` | TM2Scratch extension / AkaDako extension / Ruby String extension | 拡張機能ライブラリへの Smalruby 拡張エントリ(各 2 ペア。取り外し可能拡張の分離マーカーと同名系列) |
@@ -211,6 +212,7 @@ upstream ファイルに追加した Smalruby 固有コードのマーカー一
| `src/components/blocks/blocks.css` | show whole block shape on flyout hover | フライアウトにマウスを乗せている間、長いブロックが右へはみ出して見えるようにする(`clip-path`・RTL 対応)。スクロールバーを左に 4px 離し、ホバー中のスクロールバーの地を不透明度 0.4 にする |
| `src/components/blocks/blocks.css` | v2 toolbox category label selector | カテゴリ名を 0.65rem に縮める規則のクラス名を、scratch-blocks v2.1.19 が描く `.blocklyToolboxCategoryLabel` にする(上流は v1 の `.scratchCategoryMenuItemLabel` のままで効かない) |
| `src/components/library/library.jsx` | extension library key | 拡張機能の項目のキーに `extensionId` を使う |
+| `src/containers/extension-library.jsx` | Smalrubot S1 legacy card | 移行期間(2027-11-30 まで)だけ、アーテックロボ(Studuino)のカードの後ろに前の名前のカード「スモウルボットS1」を差しこみ、選ばれたら同じ拡張機能 `smalrubotS1` を読みこんで知らせを出す(import・`handleItemSelect`・render・propTypes・mapDispatchToProps の 5 ペア。処理は `src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx`) |
| `src/components/library/library.jsx` | modal header actions | `headerActions` を `Modal` に渡す(prop と propType) |
| `src/components/modal/modal.jsx` | modal header actions | ヘッダーの右のボタン置き場 `headerActions`(拡張機能のライブラリ・甲子園のテストのモーダルが使う)。描画と propType |
| `src/components/modal/modal.css` | modal header actions | `.header-item-actions`(`headerActions` の置き場。LTR / RTL の余白) |
diff --git a/docs/smalruby-language-spec-extensions.ja.md b/docs/smalruby-language-spec-extensions.ja.md
index 7ef39063c12..a1a90303c58 100644
--- a/docs/smalruby-language-spec-extensions.ja.md
+++ b/docs/smalruby-language-spec-extensions.ja.md
@@ -18,7 +18,7 @@
5. [音声合成(Text to Speech)](#5-音声合成text-to-speech)
6. [翻訳(Translate)](#6-翻訳translate)
7. [メッシュ V2(Mesh V2)](#7-メッシュ-v2mesh-v2)
-8. [アーテックロボ(ArtecRobo)(旧 スモウルボット S1)](#8-アーテックロボartecrobo旧-スモウルボット-s1)
+8. [アーテックロボ(Studuino)(旧 スモウルボット S1)](#8-アーテックロボstuduino旧-スモウルボット-s1)
9. [マイクロビット モア(Microbit More)](#9-マイクロビット-モアmicrobit-more)
10. [甲子園(Koshien)](#10-甲子園koshien)
11. [Ruby 文字列(Ruby String)](#11-ruby-文字列ruby-string)
@@ -155,7 +155,7 @@
---
-## 8. アーテックロボ(ArtecRobo)(旧 スモウルボット S1)
+## 8. アーテックロボ(Studuino)(旧 スモウルボット S1)
アーテック社のロボットキット「アーテックロボ(ArtecRobo)」の制御基板 Studuino(スタディーノ)と、つないだ部品(センサー・LED・モーター・サーボ)を制御します。
diff --git a/docs/smalruby-language-spec-extensions.md b/docs/smalruby-language-spec-extensions.md
index 3f3013a8d3a..bed02c66afd 100644
--- a/docs/smalruby-language-spec-extensions.md
+++ b/docs/smalruby-language-spec-extensions.md
@@ -18,7 +18,7 @@ Only extensions visible in the extension library are listed (those with `default
5. [Text to Speech](#5-text-to-speech)
6. [Translate](#6-translate)
7. [Mesh V2](#7-mesh-v2)
-8. [ArtecRobo (formerly Smalrubot S1)](#8-artecrobo-formerly-smalrubot-s1)
+8. [ArtecRobo (Studuino) (formerly Smalrubot S1)](#8-artecrobo-studuino-formerly-smalrubot-s1)
9. [Microbit More](#9-microbit-more)
10. [Koshien](#10-koshien)
11. [Ruby String](#11-ruby-string)
@@ -155,7 +155,7 @@ Allow users to interact over a computer network. (Requires internet connection)
---
-## 8. ArtecRobo (formerly Smalrubot S1)
+## 8. ArtecRobo (Studuino) (formerly Smalrubot S1)
Control the Studuino board of Artec's ArtecRobo robot kit and the parts connected to it (sensors, LEDs, motors, servo).
diff --git a/packages/scratch-gui/.prettierignore b/packages/scratch-gui/.prettierignore
index ea7e69b63b8..cec3359149b 100644
--- a/packages/scratch-gui/.prettierignore
+++ b/packages/scratch-gui/.prettierignore
@@ -397,6 +397,8 @@ src/lib/libraries/extensions/*
!src/lib/libraries/extensions/microbitMore/**
!src/lib/libraries/extensions/smalruby-ruby/
!src/lib/libraries/extensions/smalruby-ruby/**
+!src/lib/libraries/extensions/smalrubot-s1/
+!src/lib/libraries/extensions/smalrubot-s1/**
!src/lib/libraries/extensions/tm2scratch/
!src/lib/libraries/extensions/tm2scratch/**
@@ -473,6 +475,7 @@ test/integration/*
!test/integration/ruby-tab.test.js
!test/integration/smalrubot-firmware.test.js
!test/integration/smalrubot-s1-connection-flow.test.js
+!test/integration/smalrubot-s1-legacy-card.test.js
!test/integration/lesson-goal.test.js
!test/integration/smalruby-lesson1-challenges-5-8.test.js
!test/integration/smalruby-lesson1-challenges-9-11.test.js
diff --git a/packages/scratch-gui/pages/about.html b/packages/scratch-gui/pages/about.html
index fe4196844a5..a2928c34cbe 100644
--- a/packages/scratch-gui/pages/about.html
+++ b/packages/scratch-gui/pages/about.html
@@ -1019,7 +1019,7 @@
計測と制御のプログラミング
- 株式会社アーテックのロボットキット「アーテックロボ(ArtecRobo)」と、その制御基板「Studuino®(スタディーノ)」に対応。ChromebookとUSBケーブルだけで、センサーやモーターを制御するIoTプログラミングを実現します。実機が無くても、画面の中の練習用の基板で試せます。アーテックロボは株式会社アーテックの製品で、Studuino® は同社の登録商標です。
+ 株式会社アーテックのロボットキット「アーテックロボ(Studuino)」に対応。制御基板「Studuino®(スタディーノ)」とChromebookをUSBケーブルでつなぐだけで、センサーやモーターを制御するIoTプログラミングを実現します。実機が無くても、画面の中の練習用の基板で試せます。アーテックロボは株式会社アーテックの製品で、Studuino® は同社の登録商標です。
diff --git a/packages/scratch-gui/src/components/menu-bar/menu-bar.jsx b/packages/scratch-gui/src/components/menu-bar/menu-bar.jsx
index 681c835b46b..b955b69b9f4 100644
--- a/packages/scratch-gui/src/components/menu-bar/menu-bar.jsx
+++ b/packages/scratch-gui/src/components/menu-bar/menu-bar.jsx
@@ -1392,7 +1392,7 @@ class MenuBar extends React.Component {
>
diff --git a/packages/scratch-gui/src/containers/extension-library.jsx b/packages/scratch-gui/src/containers/extension-library.jsx
index ac9870924ea..cdb870ed9c2 100644
--- a/packages/scratch-gui/src/containers/extension-library.jsx
+++ b/packages/scratch-gui/src/containers/extension-library.jsx
@@ -12,6 +12,13 @@ import LibraryComponent from '../components/library/library.jsx';
import extensionIcon from '../components/action-menu/icon--sprite.svg';
import {toggleShowAllExtensions} from '../reducers/extension-filter';
+// === Smalruby: Start of Smalrubot S1 legacy card ===
+import {showStandardAlert} from '../reducers/alerts';
+import {
+ resolveLegacyCard,
+ withLegacyCards
+} from '../lib/libraries/extensions/smalrubot-s1/legacy-card.jsx';
+// === Smalruby: End of Smalrubot S1 legacy card ===
import styles from './extension-library.css';
@@ -50,7 +57,12 @@ class ExtensionLibrary extends React.PureComponent {
handleToggleShowAllExtensions (event) {
this.props.onToggleShowAllExtensions(event.target.checked);
}
- handleItemSelect (item) {
+ handleItemSelect (selectedItem) {
+ // === Smalruby: Start of Smalrubot S1 legacy card ===
+ // The old card loads the same extension as the current card and tells about the rename.
+ const {item, alertId} = resolveLegacyCard(selectedItem, extensionLibraryContent);
+ if (alertId && this.props.onShowAlert) this.props.onShowAlert(alertId);
+ // === Smalruby: End of Smalrubot S1 legacy card ===
const id = item.extensionId;
let url = item.extensionURL ? item.extensionURL : id;
if (!item.disabled && !id) {
@@ -75,7 +87,9 @@ class ExtensionLibrary extends React.PureComponent {
showAllExtensionsParam === 'false' ? false :
this.props.showAllExtensions;
- const extensionLibraryThumbnailData = extensionLibraryContent
+ // === Smalruby: Start of Smalrubot S1 legacy card ===
+ const extensionLibraryThumbnailData = withLegacyCards(extensionLibraryContent, new Date())
+ // === Smalruby: End of Smalrubot S1 legacy card ===
.filter(extension => {
if (!showAllExtensions && extension.defaultHidden) {
return false;
@@ -129,6 +143,9 @@ ExtensionLibrary.propTypes = {
intl: intlShape.isRequired,
onCategorySelected: PropTypes.func,
onRequestClose: PropTypes.func,
+ // === Smalruby: Start of Smalrubot S1 legacy card ===
+ onShowAlert: PropTypes.func,
+ // === Smalruby: End of Smalrubot S1 legacy card ===
onToggleShowAllExtensions: PropTypes.func,
showAllExtensions: PropTypes.bool,
visible: PropTypes.bool,
@@ -140,6 +157,9 @@ const mapStateToProps = state => ({
});
const mapDispatchToProps = dispatch => ({
+ // === Smalruby: Start of Smalrubot S1 legacy card ===
+ onShowAlert: alertId => dispatch(showStandardAlert(alertId)),
+ // === Smalruby: End of Smalrubot S1 legacy card ===
onToggleShowAllExtensions: showAll => dispatch(toggleShowAllExtensions(showAll))
});
diff --git a/packages/scratch-gui/src/lib/alerts/index.jsx b/packages/scratch-gui/src/lib/alerts/index.jsx
index f17ec65e342..db43e740efd 100644
--- a/packages/scratch-gui/src/lib/alerts/index.jsx
+++ b/packages/scratch-gui/src/lib/alerts/index.jsx
@@ -346,8 +346,26 @@ const alerts = [
),
level: AlertLevels.WARN,
showRejoin: 'teacher'
- }
+ },
// === Smalruby: End of classroom session expired alert ===
+ // === Smalruby: Start of Smalrubot S1 renamed alert ===
+ {
+ alertId: 'smalrubotS1Renamed',
+ clearList: ['smalrubotS1Renamed'],
+ closeButton: true,
+ content: (
+
+
+
+ ),
+ level: AlertLevels.INFO_BLUE
+ }
+ // === Smalruby: End of Smalrubot S1 renamed alert ===
];
export {
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/index.jsx b/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
index fc17edeeb54..0dfdb8d72a5 100644
--- a/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
+++ b/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
@@ -483,7 +483,7 @@ export default [
{
name: (
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx
new file mode 100644
index 00000000000..4f6fb7a0f93
--- /dev/null
+++ b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx
@@ -0,0 +1,124 @@
+// === Smalruby: This file is Smalruby-specific (renamed extension card for the transition period) ===
+import React from 'react';
+import { FormattedMessage } from 'react-intl';
+// The pictures of the old card are the Smalrubot S1 robot, as in the old teaching materials.
+import legacyInsetIconURL from './legacy-smalrubot-s1-small.png';
+import legacyIconURL from './legacy-smalrubot-s1.png';
+
+/**
+ * The extension that the old card loads. There is only one extension; the old
+ * card is just a second way to reach it under the old name.
+ */
+const SMALRUBOT_S1_EXTENSION_ID = 'smalrubotS1';
+
+/**
+ * The key of the old card in the extension library. It is not an extension ID:
+ * it only keeps the React key and the DOM id of the two cards apart.
+ */
+const SMALRUBOT_S1_LEGACY_CARD_ID = 'smalrubotS1Legacy';
+
+/**
+ * The last day (local time) on which the old card is shown. The old name
+ * "Smalrubot S1" stays selectable for one year so that existing teaching
+ * materials keep working. After this day the card disappears by itself; its
+ * code is then removed (see docs/extension-smalrubot-s1/README.md).
+ */
+const SMALRUBOT_S1_LEGACY_CARD_LAST_DAY = '2027-11-30';
+
+/** The alert shown after the old card is chosen (src/lib/alerts/index.jsx). */
+const SMALRUBOT_S1_RENAMED_ALERT_ID = 'smalrubotS1Renamed';
+
+const pad2 = (n) => String(n).padStart(2, '0');
+
+/**
+ * Format a date as YYYY-MM-DD in local time.
+ * @param {Date} date - The date.
+ * @returns {string} The local date string.
+ */
+const toLocalDateString = (date) => `${date.getFullYear()}-${pad2(date.getMonth() + 1)}-${pad2(date.getDate())}`;
+
+/**
+ * Whether the old card is still shown on the given date.
+ * @param {Date} now - The current date.
+ * @param {string} [lastDay] - The last day (YYYY-MM-DD) to show the card.
+ * @returns {boolean} True until the end of the last day (local time).
+ */
+const isLegacyCardShown = (now, lastDay = SMALRUBOT_S1_LEGACY_CARD_LAST_DAY) => {
+ if (!(now instanceof Date) || isNaN(now.getTime())) return false;
+ return toLocalDateString(now) <= lastDay;
+};
+
+/**
+ * Build the old card with the old name and the old pictures. It copies the connection settings of the current card so
+ * that the library item looks and behaves like a normal extension card.
+ * @param {object} canonical - The current "ArtecRobo" card.
+ * @returns {object} The old "Smalrubot S1" card.
+ */
+const makeLegacyCard = (canonical) => ({
+ ...canonical,
+ name: (
+
+ ),
+ description: (
+
+ ),
+ extensionId: SMALRUBOT_S1_LEGACY_CARD_ID,
+ iconURL: legacyIconURL,
+ insetIconURL: legacyInsetIconURL,
+ featured: true,
+ tags: ['smalrubot', 'smalrubot s1', 'スモウルボット', 'スモウルボットS1', 'artecrobo', 'studuino'],
+ legacyOf: SMALRUBOT_S1_EXTENSION_ID,
+ renamedAlertId: SMALRUBOT_S1_RENAMED_ALERT_ID,
+});
+
+/**
+ * Add the old card right after the current card while the transition period
+ * lasts. The list given is not changed.
+ * @param {Array} content - The extension library content.
+ * @param {Date} now - The current date.
+ * @param {string} [lastDay] - The last day (YYYY-MM-DD) to show the card.
+ * @returns {Array} The content with the old card, or the same content.
+ */
+const withLegacyCards = (content, now, lastDay = SMALRUBOT_S1_LEGACY_CARD_LAST_DAY) => {
+ if (!isLegacyCardShown(now, lastDay)) return content;
+ const index = content.findIndex((item) => item.extensionId === SMALRUBOT_S1_EXTENSION_ID);
+ if (index < 0) return content;
+ const result = content.slice();
+ result.splice(index + 1, 0, makeLegacyCard(content[index]));
+ return result;
+};
+
+/**
+ * Turn a chosen card into the card to load. The old card loads the current
+ * extension and asks for the rename alert.
+ * @param {object} item - The chosen library item.
+ * @param {Array} content - The extension library content.
+ * @returns {{item: object, alertId: (string|null)}} The card to load and the alert to show.
+ */
+const resolveLegacyCard = (item, content) => {
+ if (!item || !item.legacyOf) return { item, alertId: null };
+ const canonical = content.find((ext) => ext.extensionId === item.legacyOf);
+ return {
+ item: canonical || { ...item, extensionId: item.legacyOf },
+ alertId: item.renamedAlertId || null,
+ };
+};
+
+export {
+ SMALRUBOT_S1_EXTENSION_ID,
+ SMALRUBOT_S1_LEGACY_CARD_ID,
+ SMALRUBOT_S1_LEGACY_CARD_LAST_DAY,
+ SMALRUBOT_S1_RENAMED_ALERT_ID,
+ isLegacyCardShown,
+ makeLegacyCard,
+ resolveLegacyCard,
+ withLegacyCards,
+};
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1-small.png b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1-small.png
new file mode 100644
index 00000000000..51d756eb515
Binary files /dev/null and b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1-small.png differ
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1.png b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1.png
new file mode 100644
index 00000000000..3f7bb6e6430
Binary files /dev/null and b/packages/scratch-gui/src/lib/libraries/extensions/smalrubot-s1/legacy-smalrubot-s1.png differ
diff --git a/packages/scratch-gui/src/locales/en.js b/packages/scratch-gui/src/locales/en.js
index ed947a12f04..f1d66895f4d 100644
--- a/packages/scratch-gui/src/locales/en.js
+++ b/packages/scratch-gui/src/locales/en.js
@@ -27,7 +27,7 @@ export default {
'gui.smalruby3.previewInfo.welcome': 'Welcome to the Smalruby 3.0 Preview',
'gui.smalruby3.menuBar.downloadRubyCodeToComputer': 'Save Ruby to your computer',
'gui.menuBar.meshV2': 'Mesh',
- 'gui.menuBar.smalrubotS1': 'ArtecRobo',
+ 'gui.menuBar.smalrubotS1': 'ArtecRobo (Studuino)',
'gui.menuBar.smalrubotS1.flashFirmware': 'Write Firmware',
'gui.smalrubotFirmware.title': 'Studuino Firmware',
'gui.smalrubotFirmware.description':
@@ -1005,11 +1005,11 @@ export default {
'If the host is not displayed, please set the domain. The zip code of a facility such as a school is ideal.',
'mesh.domainExampleTitle': 'Example',
'mesh.domainExample': '100-0014',
- 'gui.smalruby3.extension.smalrubotS1.name': 'ArtecRobo',
+ 'gui.smalruby3.extension.smalrubotS1.name': 'ArtecRobo (Studuino)',
'gui.smalruby3.extension.smalrubotS1.description':
'Control the Studuino® board of ArtecRobo. ArtecRobo is a product of Artec Co., Ltd., and Studuino® is a registered trademark of Artec Co., Ltd.',
'gui.smalruby3.extension.smalrubotS1.connectingMessage': 'Connecting the Studuino',
- 'smalrubotS1.categoryName': 'ArtecRobo',
+ 'smalrubotS1.categoryName': 'ArtecRobo (Studuino)',
'smalrubotS1.action': '[ACTION] (M1, M2)',
'smalrubotS1.actionAndStopAfter': '[ACTION] for [SECS] seconds (M1, M2)',
'smalrubotS1.bendArm': 'bend arm (servo motor D10) [DEGREE] degrees in [SECS] seconds',
@@ -1034,6 +1034,11 @@ export default {
'smalrubotS1.sensorPositionsMenu.irA4': 'infrared sensor (photoreflector) (A4)',
'smalrubotS1.sensorPositionsMenu.irA5': 'infrared sensor (photoreflector) (A5)',
'smalrubotS1.robotCarLabel': 'Robot car',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.name': 'Smalrubot S1',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.description':
+ 'The former name of ArtecRobo (Studuino). Choosing it adds ArtecRobo (Studuino).',
+ 'gui.smalruby3.alerts.smalrubotS1Renamed':
+ 'Smalrubot S1 is now called "ArtecRobo (Studuino)". It works the same. From now on, please choose "ArtecRobo (Studuino)".',
'gui.smalruby3.blockDisplayModal.title': 'Block Display Settings',
'gui.smalruby3.blockDisplayModal.selectAll': 'Select All',
'gui.smalruby3.blockDisplayModal.selectNone': 'Select None',
diff --git a/packages/scratch-gui/src/locales/ja-Hira.js b/packages/scratch-gui/src/locales/ja-Hira.js
index e2e6e70f8c6..529cb19acca 100644
--- a/packages/scratch-gui/src/locales/ja-Hira.js
+++ b/packages/scratch-gui/src/locales/ja-Hira.js
@@ -18,7 +18,7 @@ export default {
'gui.rubyVersion.v1': 'バージョン1',
'gui.rubyVersion.v2': 'バージョン2 (しょきせってい)',
'gui.menuBar.meshV2': 'メッシュ',
- 'gui.menuBar.smalrubotS1': 'アーテックロボ',
+ 'gui.menuBar.smalrubotS1': 'アーテックロボ (Studuino)',
'gui.menuBar.smalrubotS1.flashFirmware': 'ファームウェアかきこみ',
'gui.smalrubotFirmware.title': 'Studuino (スタディーノ) ファームウェア',
'gui.smalrubotFirmware.description':
@@ -1416,11 +1416,11 @@ export default {
'faceSensing.topOfHead': 'あたまのてっぺん',
'faceSensing.left': 'ひだり',
'faceSensing.right': 'みぎ',
- 'gui.smalruby3.extension.smalrubotS1.name': 'アーテックロボ (ArtecRobo)',
+ 'gui.smalruby3.extension.smalrubotS1.name': 'アーテックロボ (Studuino)',
'gui.smalruby3.extension.smalrubotS1.description':
'アーテックロボ (ArtecRobo) の Studuino® (スタディーノ) きばんをうごかす。アーテックロボはかぶしきがいしゃアーテックのせいひんで、Studuino® はどうしゃのとうろくしょうひょうです。',
'gui.smalruby3.extension.smalrubotS1.connectingMessage': 'スタディーノにせつぞくしています。',
- 'smalrubotS1.categoryName': 'アーテックロボ',
+ 'smalrubotS1.categoryName': 'アーテックロボ (Studuino)',
'smalrubotS1.action': '[ACTION] (M1, M2)',
'smalrubotS1.actionAndStopAfter': '[SECS] びょう [ACTION] (M1, M2)',
'smalrubotS1.bendArm': '[SECS] びょうでアーム(サーボモーター D10)を [DEGREE] どにまげる',
@@ -1446,6 +1446,11 @@ export default {
'smalrubotS1.sensorPositionsMenu.irA4': 'せきがいせんセンサー(フォトリフレクタ)(A4)',
'smalrubotS1.sensorPositionsMenu.irA5': 'せきがいせんセンサー(フォトリフレクタ)(A5)',
'smalrubotS1.robotCarLabel': 'ロボットカー',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.name': 'スモウルボットS1 (エス1)',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.description':
+ 'アーテックロボ (Studuino) のまえのなまえです。えらぶと、アーテックロボ (Studuino) がつかえます。',
+ 'gui.smalruby3.alerts.smalrubotS1Renamed':
+ 'スモウルボットS1 (エス1) は「アーテックロボ (Studuino)」になまえがかわりました。なかみはおなじです。これからは「アーテックロボ (Studuino)」をえらんでください。',
'gui.smalruby3.blockDisplayModal.title': 'ブロックひょうじせってい',
'gui.smalruby3.blockDisplayModal.selectAll': 'すべてせんたく',
'gui.smalruby3.blockDisplayModal.selectNone': 'すべてせんたくかいじょ',
diff --git a/packages/scratch-gui/src/locales/ja.js b/packages/scratch-gui/src/locales/ja.js
index f8eb6cea507..b737b1770b4 100644
--- a/packages/scratch-gui/src/locales/ja.js
+++ b/packages/scratch-gui/src/locales/ja.js
@@ -18,7 +18,7 @@ export default {
'gui.rubyVersion.v1': 'バージョン1',
'gui.rubyVersion.v2': 'バージョン2 (初期設定)',
'gui.menuBar.meshV2': 'メッシュ',
- 'gui.menuBar.smalrubotS1': 'アーテックロボ',
+ 'gui.menuBar.smalrubotS1': 'アーテックロボ(Studuino)',
'gui.menuBar.smalrubotS1.flashFirmware': 'ファームウェア書き込み',
'gui.smalrubotFirmware.title': 'Studuino ファームウェア',
'gui.smalrubotFirmware.description':
@@ -1379,11 +1379,11 @@ export default {
'faceSensing.topOfHead': '頭のてっぺん',
'faceSensing.left': '左',
'faceSensing.right': '右',
- 'gui.smalruby3.extension.smalrubotS1.name': 'アーテックロボ(ArtecRobo)',
+ 'gui.smalruby3.extension.smalrubotS1.name': 'アーテックロボ(Studuino)',
'gui.smalruby3.extension.smalrubotS1.description':
'アーテックロボ(ArtecRobo)の Studuino®(スタディーノ)基板を動かす。アーテックロボは株式会社アーテックの製品で、Studuino® は同社の登録商標です。',
'gui.smalruby3.extension.smalrubotS1.connectingMessage': 'Studuino に接続しています。',
- 'smalrubotS1.categoryName': 'アーテックロボ',
+ 'smalrubotS1.categoryName': 'アーテックロボ(Studuino)',
'smalrubotS1.action': '[ACTION] (M1, M2)',
'smalrubotS1.actionAndStopAfter': '[SECS] 秒 [ACTION] (M1, M2)',
'smalrubotS1.bendArm': '[SECS] 秒でアーム(サーボモーター D10)を [DEGREE] 度に曲げる',
@@ -1408,6 +1408,11 @@ export default {
'smalrubotS1.sensorPositionsMenu.irA4': '赤外線センサー(フォトリフレクタ)(A4)',
'smalrubotS1.sensorPositionsMenu.irA5': '赤外線センサー(フォトリフレクタ)(A5)',
'smalrubotS1.robotCarLabel': 'ロボットカー',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.name': 'スモウルボットS1',
+ 'gui.smalruby3.extension.smalrubotS1Legacy.description':
+ 'アーテックロボ(Studuino)の前の名前です。選ぶと、アーテックロボ(Studuino)が使えます。',
+ 'gui.smalruby3.alerts.smalrubotS1Renamed':
+ 'スモウルボットS1 は「アーテックロボ(Studuino)」に名前が変わりました。中身は同じです。これからは「アーテックロボ(Studuino)」を選んでください。',
'gui.smalruby3.blockDisplayModal.title': 'ブロック表示設定',
'gui.smalruby3.blockDisplayModal.selectAll': 'すべて選択',
'gui.smalruby3.blockDisplayModal.selectNone': 'すべて選択解除',
diff --git a/packages/scratch-gui/test/integration/smalrubot-s1-legacy-card.test.js b/packages/scratch-gui/test/integration/smalrubot-s1-legacy-card.test.js
new file mode 100644
index 00000000000..5e84f8b59fb
--- /dev/null
+++ b/packages/scratch-gui/test/integration/smalrubot-s1-legacy-card.test.js
@@ -0,0 +1,42 @@
+import path from 'path';
+import SeleniumHelper from '../helpers/selenium-helper';
+
+const seleniumHelper = new SeleniumHelper();
+const { clickText, clickXpath, getDriver, loadUri } = seleniumHelper;
+
+const uri = path.resolve(__dirname, '../../build/index.html');
+
+let driver;
+
+const count = (selector) => driver.executeScript(`return document.querySelectorAll('${selector}').length;`);
+
+describe('Smalrubot S1 legacy card', () => {
+ beforeAll(async () => {
+ driver = await getDriver();
+ });
+
+ afterAll(async () => {
+ await driver.quit();
+ });
+
+ test('shows both cards and the old card adds ArtecRobo (Studuino) with the rename alert', async () => {
+ await loadUri(uri);
+ await clickXpath('//button[@title="Add Extension"]');
+
+ // Both the current card and the old card are in the library, with different ids.
+ expect(await count('#smalrubotS1')).toBe(1);
+ expect(await count('#smalrubotS1Legacy')).toBe(1);
+
+ await clickText('Smalrubot S1');
+ await new Promise((resolve) => setTimeout(resolve, 1000));
+
+ expect(await count('[data-testid="smalrubot-s1-renamed-alert"]')).toBe(1);
+ const loaded = await driver.executeScript(
+ 'return document.querySelectorAll("[id^=connectionModal]").length > 0 || ' +
+ 'document.querySelector("[data-testid=smalrubot-s1-unsupported-help]") !== null || ' +
+ 'document.querySelector("[data-testid=smalrubot-s1-initial-connect]") !== null;',
+ );
+ // The same extension as the current card is loaded, so its connection flow opens.
+ expect(loaded).toBe(true);
+ });
+});
diff --git a/packages/scratch-gui/test/unit/lib/smalrubot-s1-legacy-card.test.jsx b/packages/scratch-gui/test/unit/lib/smalrubot-s1-legacy-card.test.jsx
new file mode 100644
index 00000000000..8303f48134b
--- /dev/null
+++ b/packages/scratch-gui/test/unit/lib/smalrubot-s1-legacy-card.test.jsx
@@ -0,0 +1,144 @@
+/* eslint-env jest */
+import '@testing-library/jest-dom';
+import { render } from '@testing-library/react';
+import React from 'react';
+import { IntlProvider } from 'react-intl';
+import alerts, { AlertLevels } from '../../../src/lib/alerts/index.jsx';
+import extensionLibraryContent from '../../../src/lib/libraries/extensions/index.jsx';
+import {
+ SMALRUBOT_S1_EXTENSION_ID,
+ SMALRUBOT_S1_LEGACY_CARD_ID,
+ SMALRUBOT_S1_LEGACY_CARD_LAST_DAY,
+ SMALRUBOT_S1_RENAMED_ALERT_ID,
+ isLegacyCardShown,
+ resolveLegacyCard,
+ withLegacyCards,
+} from '../../../src/lib/libraries/extensions/smalrubot-s1/legacy-card.jsx';
+import en from '../../../src/locales/en.js';
+import jaHira from '../../../src/locales/ja-Hira.js';
+import ja from '../../../src/locales/ja.js';
+
+const BEFORE_END = new Date(2026, 10, 19, 12, 0, 0);
+const LAST_DAY_LATE = new Date(2027, 10, 30, 23, 59, 59);
+const AFTER_END = new Date(2027, 11, 1, 0, 0, 0);
+
+describe('isLegacyCardShown', () => {
+ test('should keep the old card until 2027-11-30', () => {
+ expect(SMALRUBOT_S1_LEGACY_CARD_LAST_DAY).toBe('2027-11-30');
+ });
+
+ test('should show the old card before the last day', () => {
+ expect(isLegacyCardShown(BEFORE_END)).toBe(true);
+ });
+
+ test('should show the old card until the end of the last day', () => {
+ expect(isLegacyCardShown(LAST_DAY_LATE)).toBe(true);
+ });
+
+ test('should hide the old card after the last day', () => {
+ expect(isLegacyCardShown(AFTER_END)).toBe(false);
+ });
+
+ test('should follow the given last day', () => {
+ expect(isLegacyCardShown(BEFORE_END, '2026-11-18')).toBe(false);
+ });
+
+ test('should hide the old card when the date is invalid', () => {
+ expect(isLegacyCardShown(new Date('invalid'))).toBe(false);
+ expect(isLegacyCardShown(null)).toBe(false);
+ });
+});
+
+describe('withLegacyCards', () => {
+ test('should add the old card right after the current card', () => {
+ const content = withLegacyCards(extensionLibraryContent, BEFORE_END);
+ const index = content.findIndex(item => item.extensionId === SMALRUBOT_S1_EXTENSION_ID);
+ expect(content).toHaveLength(extensionLibraryContent.length + 1);
+ expect(content[index + 1].extensionId).toBe(SMALRUBOT_S1_LEGACY_CARD_ID);
+ expect(content[index + 1].legacyOf).toBe(SMALRUBOT_S1_EXTENSION_ID);
+ });
+
+ test('should keep the keys of the cards unique', () => {
+ const content = withLegacyCards(extensionLibraryContent, BEFORE_END);
+ const ids = content.map(item => item.extensionId).filter(Boolean);
+ expect(new Set(ids).size).toBe(ids.length);
+ });
+
+ test('should not change the given list', () => {
+ const before = extensionLibraryContent.length;
+ withLegacyCards(extensionLibraryContent, BEFORE_END);
+ expect(extensionLibraryContent).toHaveLength(before);
+ expect(extensionLibraryContent.some(item => item.legacyOf)).toBe(false);
+ });
+
+ test('should not add the old card after the last day', () => {
+ expect(withLegacyCards(extensionLibraryContent, AFTER_END)).toBe(extensionLibraryContent);
+ });
+
+ test('should let the old card be found by its old names', () => {
+ const legacy = withLegacyCards(extensionLibraryContent, BEFORE_END).find(item => item.legacyOf);
+ expect(legacy.tags).toEqual(expect.arrayContaining(['smalrubot', 'スモウルボット']));
+ });
+
+ test('should show the old name and say that it is the former name', () => {
+ const legacy = withLegacyCards(extensionLibraryContent, BEFORE_END).find(item => item.legacyOf);
+ const { container } = render(
+
+
+ {legacy.name}
+ {legacy.description}
+
+ ,
+ );
+ expect(container).toHaveTextContent('スモウルボットS1');
+ expect(container).toHaveTextContent('アーテックロボ(Studuino)の前の名前です');
+ });
+});
+
+describe('resolveLegacyCard', () => {
+ test('should load the current extension and ask for the alert when the old card is chosen', () => {
+ const legacy = withLegacyCards(extensionLibraryContent, BEFORE_END).find(item => item.legacyOf);
+ const { item, alertId } = resolveLegacyCard(legacy, extensionLibraryContent);
+ expect(item.extensionId).toBe(SMALRUBOT_S1_EXTENSION_ID);
+ expect(item.launchPeripheralConnectionFlow).toBe(true);
+ expect(alertId).toBe(SMALRUBOT_S1_RENAMED_ALERT_ID);
+ });
+
+ test('should leave the other cards as they are', () => {
+ const current = extensionLibraryContent.find(ext => ext.extensionId === SMALRUBOT_S1_EXTENSION_ID);
+ expect(resolveLegacyCard(current, extensionLibraryContent)).toEqual({ item: current, alertId: null });
+ });
+});
+
+describe('Smalrubot S1 renamed alert', () => {
+ test('should be defined with a close button', () => {
+ const alert = alerts.find(a => a.alertId === SMALRUBOT_S1_RENAMED_ALERT_ID);
+ expect(alert).toBeDefined();
+ expect(alert.closeButton).toBe(true);
+ });
+
+ test('should use a level that has a background so the text is readable over the modal', () => {
+ const alert = alerts.find(a => a.alertId === SMALRUBOT_S1_RENAMED_ALERT_ID);
+ expect(alert.level).toBe(AlertLevels.INFO_BLUE);
+ });
+
+ test.each([
+ ['ja', ja, 'アーテックロボ(Studuino)」に名前が変わりました'],
+ ['ja-Hira', jaHira, 'アーテックロボ (Studuino)」になまえがかわりました'],
+ ['en', en, 'Smalrubot S1 is now called'],
+ ])('should tell about the rename in %s', (locale, messages, text) => {
+ const alert = alerts.find(a => a.alertId === SMALRUBOT_S1_RENAMED_ALERT_ID);
+ const { getByTestId } = render(
+
+ {alert.content}
+ ,
+ );
+ expect(getByTestId('smalrubot-s1-renamed-alert')).toHaveTextContent(text);
+ });
+});
diff --git a/packages/scratch-vm/src/extensions/scratch3_smalrubot_s1/index.js b/packages/scratch-vm/src/extensions/scratch3_smalrubot_s1/index.js
index 70fd3b925e0..47a2dc6f248 100644
--- a/packages/scratch-vm/src/extensions/scratch3_smalrubot_s1/index.js
+++ b/packages/scratch-vm/src/extensions/scratch3_smalrubot_s1/index.js
@@ -943,7 +943,7 @@ class Scratch3SmalrubotS1Blocks {
* @returns {string} - the name of this extension.
*/
static get EXTENSION_NAME() {
- return 'ArtecRobo';
+ return 'ArtecRobo (Studuino)';
}
/**
diff --git a/packages/scratch-vm/test/unit/extension_smalrubot_s1.js b/packages/scratch-vm/test/unit/extension_smalrubot_s1.js
index 46195c32e12..43d2f1f48a3 100644
--- a/packages/scratch-vm/test/unit/extension_smalrubot_s1.js
+++ b/packages/scratch-vm/test/unit/extension_smalrubot_s1.js
@@ -89,7 +89,7 @@ test('Smalrubot S1 Blocks', (t) => {
const blocks = new SmalrubotS1Blocks(mockRuntime);
const info = blocks.getInfo();
st.equal(info.id, 'smalrubotS1');
- st.equal(info.name, 'ArtecRobo');
+ st.equal(info.name, 'ArtecRobo (Studuino)');
st.ok(info.blocks.length > 0);
st.equal(info.showStatusButton, true);
st.end();