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