Files
pybricks-code/src/explorer/alerts/NoFilesToBackup.tsx
T
David Lechner 7232bf6153 add better error message when no files to backup
Instead of showing unexpected error, show message explaining that
there are no files to be backed up and how to fix it.

Fixes: https://github.com/pybricks/support/issues/681
2022-07-06 17:56:08 -05:00

28 lines
728 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import { Icon, Intent } from '@blueprintjs/core';
import React from 'react';
import { CreateToast } from '../../i18nToaster';
import { I18nId, useI18n } from './i18n';
const NoFilesToBackup: React.VoidFunctionComponent = () => {
const i18n = useI18n();
return (
<>
{i18n.translate(I18nId.NoFilesToBackupMessage, {
icon: <Icon icon="plus" />,
})}
</>
);
};
export const noFilesToBackup: CreateToast = (onAction) => {
return {
message: <NoFilesToBackup />,
icon: 'info-sign',
intent: Intent.PRIMARY,
onDismiss: () => onAction('dismiss'),
};
};