Hide API Key and Plugin Key buttons if set server side (#423)
This commit is contained in:
		
							parent
							
								
									d324df1bab
								
							
						
					
					
						commit
						fc60f65c74
					
				|  | @ -17,7 +17,9 @@ interface Props { | |||
|   lightMode: 'light' | 'dark'; | ||||
|   selectedConversation: Conversation; | ||||
|   apiKey: string; | ||||
|   serverSideApiKeyIsSet: boolean; | ||||
|   pluginKeys: PluginKey[]; | ||||
|   serverSidePluginKeysSet: boolean; | ||||
|   folders: Folder[]; | ||||
|   onCreateFolder: (name: string) => void; | ||||
|   onDeleteFolder: (folderId: string) => void; | ||||
|  | @ -44,7 +46,9 @@ export const Chatbar: FC<Props> = ({ | |||
|   lightMode, | ||||
|   selectedConversation, | ||||
|   apiKey, | ||||
|   serverSideApiKeyIsSet, | ||||
|   pluginKeys, | ||||
|   serverSidePluginKeysSet, | ||||
|   folders, | ||||
|   onCreateFolder, | ||||
|   onDeleteFolder, | ||||
|  | @ -198,7 +202,9 @@ export const Chatbar: FC<Props> = ({ | |||
|       <ChatbarSettings | ||||
|         lightMode={lightMode} | ||||
|         apiKey={apiKey} | ||||
|         serverSideApiKeyIsSet={serverSideApiKeyIsSet} | ||||
|         pluginKeys={pluginKeys} | ||||
|         serverSidePluginKeysSet={serverSidePluginKeysSet} | ||||
|         conversationsCount={conversations.length} | ||||
|         onToggleLightMode={onToggleLightMode} | ||||
|         onApiKeyChange={onApiKeyChange} | ||||
|  |  | |||
|  | @ -12,7 +12,9 @@ import { PluginKeys } from './PluginKeys'; | |||
| interface Props { | ||||
|   lightMode: 'light' | 'dark'; | ||||
|   apiKey: string; | ||||
|   serverSideApiKeyIsSet: boolean; | ||||
|   pluginKeys: PluginKey[]; | ||||
|   serverSidePluginKeysSet: boolean; | ||||
|   conversationsCount: number; | ||||
|   onToggleLightMode: (mode: 'light' | 'dark') => void; | ||||
|   onApiKeyChange: (apiKey: string) => void; | ||||
|  | @ -26,7 +28,9 @@ interface Props { | |||
| export const ChatbarSettings: FC<Props> = ({ | ||||
|   lightMode, | ||||
|   apiKey, | ||||
|   serverSideApiKeyIsSet, | ||||
|   pluginKeys, | ||||
|   serverSidePluginKeysSet, | ||||
|   conversationsCount, | ||||
|   onToggleLightMode, | ||||
|   onApiKeyChange, | ||||
|  | @ -62,13 +66,17 @@ export const ChatbarSettings: FC<Props> = ({ | |||
|         } | ||||
|       /> | ||||
| 
 | ||||
|       {!(serverSideApiKeyIsSet) ? ( | ||||
|         <Key apiKey={apiKey} onApiKeyChange={onApiKeyChange} /> | ||||
|       ) : null} | ||||
| 
 | ||||
|       {!(serverSidePluginKeysSet) ? ( | ||||
|         <PluginKeys | ||||
|           pluginKeys={pluginKeys} | ||||
|           onPluginKeyChange={onPluginKeyChange} | ||||
|           onClearPluginKey={onClearPluginKey} | ||||
|         /> | ||||
|       ) : null} | ||||
|     </div> | ||||
|   ); | ||||
| }; | ||||
|  |  | |||
|  | @ -763,7 +763,9 @@ const Home: React.FC<HomeProps> = ({ | |||
|                   lightMode={lightMode} | ||||
|                   selectedConversation={selectedConversation} | ||||
|                   apiKey={apiKey} | ||||
|                   serverSideApiKeyIsSet={serverSideApiKeyIsSet} | ||||
|                   pluginKeys={pluginKeys} | ||||
|                   serverSidePluginKeysSet={serverSidePluginKeysSet} | ||||
|                   folders={folders.filter((folder) => folder.type === 'chat')} | ||||
|                   onToggleLightMode={handleLightMode} | ||||
|                   onCreateFolder={(name) => handleCreateFolder(name, 'chat')} | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue