update to blueprintjs 5.x

This commit is contained in:
David Lechner
2023-06-28 14:42:55 -05:00
committed by David Lechner
parent 2fc3bea48f
commit 65e5627568
57 changed files with 369 additions and 889 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { Button, Intent } from '@blueprintjs/core';
import { Error } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
@@ -25,7 +26,7 @@ const DfuError: React.FunctionComponent<DfuErrorProps> = ({ onTryAgain }) => {
export const dfuError: CreateToast<never, 'dismiss' | 'tryAgain'> = (onAction) => ({
message: <DfuError onTryAgain={() => onAction('tryAgain')} />,
icon: 'error',
icon: <Error />,
intent: Intent.DANGER,
onDismiss: () => onAction('dismiss'),
});
+2 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { Intent, ProgressBar } from '@blueprintjs/core';
import { Download } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
@@ -42,7 +43,7 @@ const FlashProgress: React.FunctionComponent<FlashProgressProps> = ({
export const flashProgress: CreateToast<FlashProgressProps> = (onAction, props) => ({
message: <FlashProgress {...props} />,
icon: 'download',
icon: <Download />,
intent: Intent.PRIMARY,
// close one second after progress is complete
timeout: (props.progress ?? 0) < 1 ? 0 : 1000,
+5 -4
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { AnchorButton, Button, Intent } from '@blueprintjs/core';
import { Download, Help, InfoSign } from '@blueprintjs/icons';
import React from 'react';
import {
pybricksUsbDfuTroubleshootingUrl,
@@ -29,13 +30,13 @@ const NoDfuHub: React.FunctionComponent<NoDfuHubProps> = ({
{isLinux() && <p>{i18n.translate('noDfuHub.suggestion1.linux')}</p>}
<div className="pb-ble-alerts-buttons">
{isWindows() && (
<Button icon="download" onClick={onInstallWindowsDriver}>
<Button icon={<Download />} onClick={onInstallWindowsDriver}>
{i18n.translate('noDfuHub.installUsbDriverButton')}
</Button>
)}
{isLinux() && (
<AnchorButton
icon="help"
icon={<Help />}
href={pybricksUsbLinuxUdevRulesUrl}
target="_blank"
rel="noopener"
@@ -45,7 +46,7 @@ const NoDfuHub: React.FunctionComponent<NoDfuHubProps> = ({
</AnchorButton>
)}
<AnchorButton
icon="help"
icon={<Help />}
href={pybricksUsbDfuTroubleshootingUrl}
target="_blank"
rel="noopener"
@@ -64,7 +65,7 @@ export const noDfuHub: CreateToast<never, 'dismiss' | 'installWindowsDriver'> =
message: (
<NoDfuHub onInstallWindowsDriver={() => onAction('installWindowsDriver')} />
),
icon: 'info-sign',
icon: <InfoSign />,
intent: Intent.PRIMARY,
onDismiss: () => onAction('dismiss'),
});
+2 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { Intent } from '@blueprintjs/core';
import { Error } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
@@ -13,7 +14,7 @@ const NoDfuInterface: React.FunctionComponent = () => {
export const noDfuInterface: CreateToast = (onAction) => ({
message: <NoDfuInterface />,
icon: 'error',
icon: <Error />,
intent: Intent.DANGER,
onDismiss: () => onAction('dismiss'),
});
+2 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { Intent } from '@blueprintjs/core';
import { Error } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
@@ -18,7 +19,7 @@ const NoWebUsb: React.FunctionComponent = () => {
export const noWebUsb: CreateToast = (onAction) => ({
message: <NoWebUsb />,
icon: 'error',
icon: <Error />,
intent: Intent.DANGER,
onDismiss: () => onAction('dismiss'),
});
+2 -1
View File
@@ -2,6 +2,7 @@
// Copyright (c) 2022-2023 The Pybricks Authors
import { Intent } from '@blueprintjs/core';
import { InfoSign } from '@blueprintjs/icons';
import React from 'react';
import type { CreateToast } from '../../toasterTypes';
import { useI18n } from './i18n';
@@ -13,7 +14,7 @@ const ReleaseButton: React.FunctionComponent = () => {
export const releaseButton: CreateToast = (onAction) => ({
message: <ReleaseButton />,
icon: 'info-sign',
icon: <InfoSign />,
intent: Intent.PRIMARY,
onDismiss: () => onAction('dismiss'),
});
@@ -3,6 +3,7 @@
import './bootloaderInstructions.scss';
import { Callout, Intent } from '@blueprintjs/core';
import { WarningSign } from '@blueprintjs/icons';
import classNames from 'classnames';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { useDispatch } from 'react-redux';
@@ -370,7 +371,7 @@ const BootloaderInstructions: React.FunctionComponent<BootloaderInstructionsProp
)}
{hubHasUSB(hubType) && isLinux() && (
<Callout intent={Intent.WARNING} icon="warning-sign">
<Callout intent={Intent.WARNING} icon={<WarningSign />}>
{i18n.translate('warning.linux.message', {
learnMore: (
<>
@@ -389,7 +390,7 @@ const BootloaderInstructions: React.FunctionComponent<BootloaderInstructionsProp
)}
{hubHasUSB(hubType) && isWindows() && (
<Callout intent={Intent.WARNING} icon="warning-sign">
<Callout intent={Intent.WARNING} icon={<WarningSign />}>
{i18n.translate('warning.windows.message', {
instructions: (
<a
@@ -15,10 +15,11 @@ import {
Intent,
MultistepDialog,
NonIdealState,
Popover,
Pre,
Spinner,
} from '@blueprintjs/core';
import { Classes as Classes2, Popover2 } from '@blueprintjs/popover2';
import { ChevronDown, ChevronRight, Error, Heart } from '@blueprintjs/icons';
import { FirmwareMetadata, HubType } from '@pybricks/firmware';
import { fileOpen } from 'browser-fs-access';
import classNames from 'classnames';
@@ -124,7 +125,7 @@ const UnsupportedHubs: React.FunctionComponent = () => {
'selectHubPanel.notOnListButton.info.mindstorms.help.sponsor',
)}
</VisuallyHidden>
<Icon icon="heart" />
<Icon icon={<Heart />} />
</>
),
},
@@ -282,13 +283,13 @@ const SelectHubPanel: React.FunctionComponent<SelectHubPanelProps> = ({
<>
<p>{i18n.translate('selectHubPanel.message')}</p>
<HubPicker />
<Popover2
popoverClassName={Classes2.POPOVER2_CONTENT_SIZING}
<Popover
popoverClassName={Classes.POPOVER_CONTENT_SIZING}
placement="right-end"
content={<UnsupportedHubs />}
renderTarget={({ isOpen: _isOpen, ref, ...targetProps }) => (
<Button
elementRef={ref as React.Ref<HTMLButtonElement>}
ref={ref as React.Ref<HTMLButtonElement>}
{...targetProps}
>
{i18n.translate('selectHubPanel.notOnListButton.label')}
@@ -301,7 +302,7 @@ const SelectHubPanel: React.FunctionComponent<SelectHubPanelProps> = ({
<Button
minimal={true}
small={true}
icon={isAdvancedOpen ? 'chevron-down' : 'chevron-right'}
icon={isAdvancedOpen ? <ChevronDown /> : <ChevronRight />}
onClick={() => setIsAdvancedOpen((v) => !v)}
>
{i18n.translate('selectHubPanel.advanced.label')}
@@ -360,7 +361,7 @@ const AcceptLicensePanel: React.FunctionComponent<AcceptLicensePanelProps> = ({
<Pre>{selectedFirmwareData.licenseText}</Pre>
) : (
<NonIdealState
icon={selectedFirmwareError ? 'error' : <Spinner />}
icon={selectedFirmwareError ? <Error /> : <Spinner />}
description={
selectedFirmwareError
? i18n.translate('licensePanel.licenseText.error')
@@ -411,7 +412,7 @@ const ConfigureOptionsPanel: React.FunctionComponent<SelectOptionsPanelProps> =
rightElement={
isHubNameValid ? undefined : (
<Icon
icon="error"
icon={<Error />}
intent={Intent.DANGER}
tagName="div"
/>