mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-20 15:44:25 +01:00
Cleanup Phase 1: Remove unused React imports from safe components (#2702)
Co-authored-by: Michael Neale <michael.neale@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { IpcRendererEvent } from 'electron';
|
||||
import { openSharedSessionFromDeepLink } from './sessionLinks';
|
||||
import { initializeSystem } from './utils/providerUtils';
|
||||
@@ -8,6 +8,7 @@ import { ToastContainer } from 'react-toastify';
|
||||
import { toastService } from './toasts';
|
||||
import { extractExtensionName } from './components/settings/extensions/utils';
|
||||
import { GoosehintsModal } from './components/GoosehintsModal';
|
||||
import { type ExtensionConfig } from './extensions';
|
||||
|
||||
import ChatView from './components/ChatView';
|
||||
import SuspenseLoader from './suspense-loader';
|
||||
@@ -46,10 +47,28 @@ export type View =
|
||||
| 'recipeEditor'
|
||||
| 'permission';
|
||||
|
||||
export type ViewOptions =
|
||||
| SettingsViewOptions
|
||||
| { resumedSession?: SessionDetails }
|
||||
| Record<string, unknown>;
|
||||
export type ViewOptions = {
|
||||
// Settings view options
|
||||
extensionId?: string;
|
||||
showEnvVars?: boolean;
|
||||
deepLinkConfig?: ExtensionConfig;
|
||||
|
||||
// Session view options
|
||||
resumedSession?: SessionDetails;
|
||||
sessionDetails?: SessionDetails;
|
||||
error?: string;
|
||||
shareToken?: string;
|
||||
baseUrl?: string;
|
||||
|
||||
// Recipe editor options
|
||||
config?: unknown;
|
||||
|
||||
// Permission view options
|
||||
parentView?: View;
|
||||
|
||||
// Generic options
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
export type ViewConfig = {
|
||||
view: View;
|
||||
@@ -103,7 +122,7 @@ export default function App() {
|
||||
return `${cmd} ${args.join(' ')}`.trim();
|
||||
}
|
||||
|
||||
function extractRemoteUrl(link: string): string {
|
||||
function extractRemoteUrl(link: string): string | null {
|
||||
const url = new URL(link);
|
||||
return url.searchParams.get('url');
|
||||
}
|
||||
@@ -164,7 +183,7 @@ export default function App() {
|
||||
if (provider && model) {
|
||||
setView('chat');
|
||||
try {
|
||||
await initializeSystem(provider, model, {
|
||||
await initializeSystem(provider as string, model as string, {
|
||||
getExtensions,
|
||||
addExtension,
|
||||
});
|
||||
@@ -289,7 +308,7 @@ export default function App() {
|
||||
};
|
||||
setView(viewFromUrl, initialViewOptions);
|
||||
} else {
|
||||
setView(viewFromUrl);
|
||||
setView(viewFromUrl as View);
|
||||
}
|
||||
}
|
||||
window.electron.on('set-view', handleSetView);
|
||||
|
||||
Reference in New Issue
Block a user