mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-15 11:04:49 +00:00
add license dialog
This commit is contained in:
+23
-1
@@ -17,6 +17,10 @@ export enum AppActionType {
|
||||
OpenAboutDialog = 'app.action.openAboutDialog',
|
||||
/** Close about dialog. */
|
||||
CloseAboutDialog = 'app.action.closeAboutDialog',
|
||||
/** Open license dialog. */
|
||||
OpenLicenseDialog = 'app.action.openLicenseDialog',
|
||||
/** Close license dialog. */
|
||||
CloseLicenseDialog = 'app.action.closeLicenseDialog',
|
||||
}
|
||||
|
||||
/** Action that indicates the app has just started. */
|
||||
@@ -59,10 +63,28 @@ export function closeAboutDialog(): AppCloseAboutDialogAction {
|
||||
return { type: AppActionType.CloseAboutDialog };
|
||||
}
|
||||
|
||||
/** Action to open the license dialog. */
|
||||
export type AppOpenLicenseDialogAction = Action<AppActionType.OpenLicenseDialog>;
|
||||
|
||||
/** Creates an action to open the license dialog. */
|
||||
export function openLicenseDialog(): AppOpenLicenseDialogAction {
|
||||
return { type: AppActionType.OpenLicenseDialog };
|
||||
}
|
||||
|
||||
/** Action to close the license dialog. */
|
||||
export type AppCloseLicenseDialogAction = Action<AppActionType.CloseLicenseDialog>;
|
||||
|
||||
/** Creates an action to close the license dialog. */
|
||||
export function closeLicenseDialog(): AppCloseLicenseDialogAction {
|
||||
return { type: AppActionType.CloseLicenseDialog };
|
||||
}
|
||||
|
||||
/** common type for all app actions. */
|
||||
export type AppAction =
|
||||
| AppStartupAction
|
||||
| AppOpenSettingsAction
|
||||
| AppCloseSettingsAction
|
||||
| AppOpenAboutDialogAction
|
||||
| AppCloseAboutDialogAction;
|
||||
| AppCloseAboutDialogAction
|
||||
| AppOpenLicenseDialogAction
|
||||
| AppCloseLicenseDialogAction;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { BleUartAction } from './ble-uart';
|
||||
import { EditorAction } from './editor';
|
||||
import { FlashFirmwareAction } from './flash-firmware';
|
||||
import { HubAction, HubMessageAction } from './hub';
|
||||
import { LicenseAction } from './license';
|
||||
import {
|
||||
BootloaderConnectionAction,
|
||||
BootloaderDidRequestAction,
|
||||
@@ -36,6 +37,7 @@ export type Action =
|
||||
| FlashFirmwareAction
|
||||
| HubAction
|
||||
| HubMessageAction
|
||||
| LicenseAction
|
||||
| MpyAction
|
||||
| NotificationAction
|
||||
| ServiceWorkerAction
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2021 The Pybricks Authors
|
||||
|
||||
import { Action } from 'redux';
|
||||
import { LicenseInfo, LicenseList } from '../reducers/license';
|
||||
|
||||
export enum LicenseActionType {
|
||||
DidFetchList = 'license.action.didFetchList',
|
||||
Select = 'license.action.select',
|
||||
}
|
||||
|
||||
export type LicenseDidFetchListAction = Action<LicenseActionType.DidFetchList> & {
|
||||
list: LicenseList;
|
||||
};
|
||||
|
||||
export function didFetchList(list: LicenseList): LicenseDidFetchListAction {
|
||||
return { type: LicenseActionType.DidFetchList, list };
|
||||
}
|
||||
|
||||
export type LicenseSelectAction = Action<LicenseActionType.Select> & {
|
||||
info: LicenseInfo;
|
||||
};
|
||||
|
||||
export function select(info: LicenseInfo): LicenseSelectAction {
|
||||
return { type: LicenseActionType.Select, info };
|
||||
}
|
||||
|
||||
export type LicenseAction = LicenseDidFetchListAction | LicenseSelectAction;
|
||||
Reference in New Issue
Block a user