mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
MAESTRO: fix 6 TypeScript errors in web/mobile layer
- Card.tsx: Use Omit<HTMLAttributes, 'title'> to avoid title type conflict - useWebSocket.ts: Add 'user_input' to ServerMessageType union - App.tsx: Remove non-standard renotify property from NotificationOptions - useMobileKeyboardHandler.ts: Use type alias for MobileKeyboardSession - CommandInputBar.tsx: Use proper double-cast for ref typing - serviceWorker.ts: Extract registration.active to guarded local variable
This commit is contained in:
@@ -261,8 +261,8 @@ export const Card = forwardRef<HTMLDivElement, CardProps>(function Card(
|
||||
* </Card>
|
||||
* ```
|
||||
*/
|
||||
export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
|
||||
/** Main title text */
|
||||
export interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
||||
/** Main title text (overrides HTML title attribute to support ReactNode) */
|
||||
title?: ReactNode;
|
||||
/** Subtitle or secondary text */
|
||||
subtitle?: ReactNode;
|
||||
|
||||
@@ -25,15 +25,16 @@ import type { AITabData } from './useWebSocket';
|
||||
/**
|
||||
* Session type for the mobile keyboard handler
|
||||
* Only includes fields needed for keyboard handling
|
||||
* Kept minimal to accept any object with these optional fields
|
||||
*/
|
||||
export interface MobileKeyboardSession {
|
||||
export type MobileKeyboardSession = {
|
||||
/** Current input mode */
|
||||
inputMode?: 'ai' | 'terminal';
|
||||
inputMode?: string;
|
||||
/** Array of AI tabs */
|
||||
aiTabs?: AITabData[];
|
||||
/** Currently active tab ID */
|
||||
activeTabId?: string;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Input mode type for the handler
|
||||
|
||||
@@ -105,6 +105,7 @@ export type ServerMessageType =
|
||||
| 'active_session_changed'
|
||||
| 'session_output'
|
||||
| 'session_exit'
|
||||
| 'user_input'
|
||||
| 'theme'
|
||||
| 'custom_commands'
|
||||
| 'autorun_state'
|
||||
|
||||
@@ -406,10 +406,9 @@ export default function MobileApp() {
|
||||
const notification = showNotification(title, {
|
||||
body: firstLine,
|
||||
tag: `maestro-response-${session.id}`, // Prevent duplicate notifications for same session
|
||||
renotify: true, // Allow notification to be re-shown if same tag
|
||||
silent: false,
|
||||
requireInteraction: false, // Auto-dismiss on mobile
|
||||
});
|
||||
} as NotificationOptions);
|
||||
|
||||
if (notification) {
|
||||
webLogger.debug(`Notification shown for session: ${session.name}`, 'Mobile');
|
||||
|
||||
@@ -719,7 +719,7 @@ export function CommandInputBar({
|
||||
$
|
||||
</span>
|
||||
<input
|
||||
ref={textareaRef as React.RefObject<HTMLInputElement>}
|
||||
ref={textareaRef as unknown as React.RefObject<HTMLInputElement>}
|
||||
type="text"
|
||||
value={value}
|
||||
onChange={(e) => handleChange(e as unknown as React.ChangeEvent<HTMLTextAreaElement>)}
|
||||
|
||||
@@ -159,7 +159,8 @@ export async function pingServiceWorker(): Promise<boolean> {
|
||||
|
||||
try {
|
||||
const registration = await navigator.serviceWorker.ready;
|
||||
if (!registration.active) return false;
|
||||
const activeWorker = registration.active;
|
||||
if (!activeWorker) return false;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
const messageChannel = new MessageChannel();
|
||||
@@ -170,7 +171,7 @@ export async function pingServiceWorker(): Promise<boolean> {
|
||||
// Timeout after 1 second
|
||||
setTimeout(() => resolve(false), 1000);
|
||||
|
||||
registration.active.postMessage('ping', [messageChannel.port2]);
|
||||
activeWorker.postMessage('ping', [messageChannel.port2]);
|
||||
});
|
||||
} catch {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user