mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
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
28 lines
728 B
TypeScript
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'),
|
|
};
|
|
};
|