Initial Commit
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Shared types for the CLI TUI.
|
||||
*/
|
||||
|
||||
import type { WalletController } from '../controllers/wallet-controller.js';
|
||||
import type { InvitationController } from '../controllers/invitation-controller.js';
|
||||
|
||||
/**
|
||||
* Screen names for navigation.
|
||||
*/
|
||||
export type ScreenName =
|
||||
| 'seed-input'
|
||||
| 'wallet'
|
||||
| 'templates'
|
||||
| 'wizard'
|
||||
| 'invitations'
|
||||
| 'transaction';
|
||||
|
||||
/**
|
||||
* Navigation context data that can be passed between screens.
|
||||
*/
|
||||
export interface NavigationData {
|
||||
/** Template identifier for wizard */
|
||||
templateId?: string;
|
||||
/** Action identifier for wizard */
|
||||
actionId?: string;
|
||||
/** Role identifier for wizard */
|
||||
roleId?: string;
|
||||
/** Invitation ID for transaction screen */
|
||||
invitationId?: string;
|
||||
/** Any additional data */
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigation context interface.
|
||||
*/
|
||||
export interface NavigationContextType {
|
||||
/** Current screen name */
|
||||
screen: ScreenName;
|
||||
/** Data passed to the current screen */
|
||||
data: NavigationData;
|
||||
/** Navigation history stack */
|
||||
history: ScreenName[];
|
||||
/** Navigate to a new screen */
|
||||
navigate: (screen: ScreenName, data?: NavigationData) => void;
|
||||
/** Go back to the previous screen */
|
||||
goBack: () => void;
|
||||
/** Check if we can go back */
|
||||
canGoBack: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* App context interface - provides access to controllers and app-level functions.
|
||||
*/
|
||||
export interface AppContextType {
|
||||
/** Wallet controller for wallet operations */
|
||||
walletController: WalletController;
|
||||
/** Invitation controller for invitation operations */
|
||||
invitationController: InvitationController;
|
||||
/** Show an error message dialog */
|
||||
showError: (message: string) => void;
|
||||
/** Show an info message dialog */
|
||||
showInfo: (message: string) => void;
|
||||
/** Show a confirmation dialog */
|
||||
confirm: (message: string) => Promise<boolean>;
|
||||
/** Exit the application */
|
||||
exit: () => void;
|
||||
/** Update status bar message */
|
||||
setStatus: (message: string) => void;
|
||||
/** Whether the wallet is initialized */
|
||||
isWalletInitialized: boolean;
|
||||
/** Set wallet initialized state */
|
||||
setWalletInitialized: (initialized: boolean) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dialog state for modals.
|
||||
*/
|
||||
export interface DialogState {
|
||||
/** Whether dialog is visible */
|
||||
visible: boolean;
|
||||
/** Dialog type */
|
||||
type: 'error' | 'info' | 'confirm';
|
||||
/** Dialog message */
|
||||
message: string;
|
||||
/** Callback for confirm dialog */
|
||||
onConfirm?: () => void;
|
||||
/** Callback for cancel/dismiss */
|
||||
onCancel?: () => void;
|
||||
}
|
||||
Reference in New Issue
Block a user