Skip to content

Commit 338c493

Browse files
authored
Merge pull request #225 from Open-STEM/kq-bugs
Addressed 217,219,220 and 223
2 parents c4da6bb + d8db1af commit 338c493

7 files changed

Lines changed: 44 additions & 13 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "https://experientialrobotics.org/",
55
"license": "GPL-2.0-only",
66
"private": true,
7-
"version": "2.0.13",
7+
"version": "2.0.14",
88
"type": "module",
99
"scripts": {
1010
"dev": "vite",

public/CHANGELOG.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version 2.0.13
1+
# Version 2.0.14
22

33
#### Bluetooth support
44
<img height="10%" width="10%" src="src/assets/images/Bluetooth_FM_Black.png"/></img>
@@ -34,8 +34,7 @@
3434
* Support the New Puppet Protocol for communication with the XRP Bluetooth (advanced users) [See XPP](https://xrpcode.io/docs/puppet_protocol)
3535

3636
#### Bug Fixes
37-
* [File SaveAs dialog not using name](https://github.com/Open-STEM/XRPWeb/issues/205)
38-
* [Google Drive Export to PC resulted with zero bytes](https://github.com/Open-STEM/XRPWeb/issues/206)
39-
* [Google Drive Onetime notification](https://github.com/Open-STEM/XRPWeb/issues/198)
40-
* [Scroll in a .py file](https://github.com/Open-STEM/XRPWeb/issues)
41-
* [No way to move files](https://github.com/Open-STEM/XRPWeb/issues/179)
37+
* [Blockly lost changelistener](https://github.com/Open-STEM/XRPWeb/issues/223)
38+
* [Check browser support](https://github.com/Open-STEM/XRPWeb/issues/220)
39+
* [Connect/Reconnect cause duplicate characters in shell](https://github.com/Open-STEM/XRPWeb/issues/219)
40+
* [Correct spelling in Curriculum help menu](https://github.com/Open-STEM/XRPWeb/issues/217)

src/components/dialogs/connectiondlg.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,48 @@
1+
/// <reference types="web-bluetooth" />
12
import Bluetooth from '@assets/images/Bluetooth_FM_Black.png';
23
import Usb from '@assets/images/USB_icon.svg.png';
34
import { ConnectionType, ListItem } from '@/utils/types';
45
import { useTranslation } from 'react-i18next';
6+
import { useEffect, useState } from 'react';
57

68
type ConnProps = {
79
callback: (connection: ConnectionType) => void;
810
};
911

12+
interface ConnectionItem extends ListItem {
13+
disabled?: boolean;
14+
}
15+
1016
/**
1117
* Connection Dialog content
1218
* @param param0
1319
* @returns
1420
*/
1521
function ConnectionDlg(connprops: ConnProps) {
1622
const { t } = useTranslation();
23+
const [isBluetoothAvailable, setIsBluetoothAvailable] = useState<boolean>(true);
24+
25+
useEffect(() => {
26+
if (navigator.bluetooth && typeof navigator.bluetooth.getAvailability === 'function') {
27+
navigator.bluetooth
28+
.getAvailability()
29+
.then((available) => {
30+
setIsBluetoothAvailable(available);
31+
})
32+
.catch(() => {
33+
setIsBluetoothAvailable(false);
34+
});
35+
} else {
36+
setIsBluetoothAvailable(false);
37+
}
38+
}, []);
39+
1740
// list of items to display
18-
const items: ListItem[] = [
41+
const items: ConnectionItem[] = [
1942
{
2043
label: t('bluetoothConnection'),
2144
image: Bluetooth,
45+
disabled: !isBluetoothAvailable,
2246
},
2347
{
2448
label: t('usbConnection'),
@@ -30,7 +54,8 @@ function ConnectionDlg(connprops: ConnProps) {
3054
* Connection handler - handledClick
3155
* @param item
3256
*/
33-
const handleItemClick = (item: ListItem) => {
57+
const handleItemClick = (item: ConnectionItem) => {
58+
if (item.disabled) return;
3459
console.log(item);
3560
switch (item.label) {
3661
case t('bluetoothConnection'):
@@ -53,8 +78,13 @@ function ConnectionDlg(connprops: ConnProps) {
5378
{items.map((item) => (
5479
<li
5580
key={item.label}
56-
className="hover:bg-matisse-300 dark:hover:bg-shark-400 flex flex-row items-center gap-2 px-3 py-1 text-neutral-900 hover:text-neutral-100"
81+
className={`flex flex-row items-center gap-2 px-3 py-1 text-neutral-900 ${
82+
item.disabled
83+
? 'opacity-50 cursor-not-allowed'
84+
: 'hover:bg-matisse-300 dark:hover:bg-shark-400 hover:text-neutral-100 cursor-pointer'
85+
}`}
5786
onClick={() => handleItemClick(item)}
87+
title={item.disabled ? t('bluetooth-not-supported') : ''}
5888
>
5989
<img data-testid={item.label} src={item.image} height="28px" width="36px" />
6090
<span className='text-mountain-mist-700 dark:text-mountain-mist-300'>{item.label}</span>

src/components/xrplayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ function XRPLayout({ forwardedref }: XRPLayoutProps) {
304304
if (editorType !== undefined) {
305305
AppMgr.getInstance().emit(EventType.EVENT_EDITOR, editorType);
306306
}
307+
setActiveTab(action.data.tabNode);
307308
}
308-
setActiveTab(action.data.tabNode);
309309
}
310310
break;
311311
case Actions.DELETE_TAB: {

src/managers/editormgr.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export default class EditorMgr {
145145
EventType.EVENT_EDITOR,
146146
session.type === EditorType.BLOCKLY ? EditorType.BLOCKLY : EditorType.PYTHON,
147147
);
148-
this.layoutModel?.doAction(Actions.selectTab(session.id));
148+
this.layoutModel?.doAction(Actions.selectTab(session.id));
149+
return session?.id;
149150
}
150-
return session?.id;
151151
}
152152
return undefined;
153153
}

src/utils/i18n/locales/en/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"_commentXRP": "This line does not need to be translated; add specific XRP translation below",
3+
"bluetooth-not-supported" : "Bluetooth is not supported in your browser or system. Please use a different browser or system to access the full functionality of the XRP Web IDE.",
34
"file": "File",
45
"file-exists-on-python-convert": "Python file {{ filename }} is already exists. Please rename it before performing conversion.",
56
"firefox-not-supported": "The browser ({{ browser }}) that you are using is not supported. Please use a different browser such as Chrome or Edge to access the full functionality of the XRP Web IDE.",

src/utils/i18n/locales/es/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"_commentXRP": "Esta línea no necesita ser traducida; agregar traducción específica de XRP a continuación",
3+
"bluetooth-not-supported" : "El Bluetooth no está soportado en su navegador o sistema. Por favor use un navegador diferente o sistema para acceder a toda la funcionalidad del IDE Web de XRP.",
34
"file": "Archivo",
45
"file-exists-on-python-convert": "El archivo de Python {{ filename }} ya existe. Cámbiele el nombre antes de realizar la conversión.",
56
"firefox-not-supported": "El navegador ({{ browser }}) que está utilizando no es compatible. Por favor use un navegador diferente como Chrome o Edge para acceder a toda la funcionalidad del IDE Web de XRP.",

0 commit comments

Comments
 (0)