Skip to content

Commit

Permalink
fix(frontend): prevent hiding post verification settings
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Sep 9, 2024
1 parent 8f194d3 commit ba36a21
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default async function LangfuseSettingsPage () {

return (
<>
<IntegrationsSettings schema={settings} />
<IntegrationsSettings schema={settings} showPostVerificationSettings={!!process.env.EXPERIMENTAL_MESSAGE_VERIFY_SERVICE} />
</>
);
}
Expand Down
12 changes: 2 additions & 10 deletions frontend/app/src/components/settings/IntegrationsSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

import type { AllSettings } from '@/api/site-settings';
import { SettingsField } from '@/components/settings/SettingsField';
import { useExperimentalFeatures } from '@/experimental/experimental-features-provider';

export function IntegrationsSettings ({ schema }: { schema: AllSettings }) {

export function IntegrationsSettings ({ schema, showPostVerificationSettings }: { schema: AllSettings, showPostVerificationSettings: boolean }) {
return (
<div className="space-y-8 max-w-screen-md">
<LangfuseSettings schema={schema} />
<ExperimentalPostVerificationSettings schema={schema} />
{showPostVerificationSettings && <ExperimentalPostVerificationSettings schema={schema} />}
</div>
);
}
Expand All @@ -26,12 +24,6 @@ export function LangfuseSettings ({ schema, hideTitle, disabled, onChanged }: {
}

export function ExperimentalPostVerificationSettings ({ schema, hideTitle, disabled, onChanged }: { schema: AllSettings, hideTitle?: boolean, disabled?: boolean, onChanged?: () => void }) {
const { message_verify_service } = useExperimentalFeatures();

if (!message_verify_service) {
return null;
}

return (
<section className="space-y-6">
{!hideTitle && <h2 className="text-lg font-medium">[Experimental] Post verifications</h2>}
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/src/components/settings/SettingsField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function SettingsField ({ name, item, arrayItemSchema, objectSchema, onCh
el = <Input {...props} placeholder={item.default} />;
break;
case 'bool':
el = <Switch {...props} onChange={undefined} checked={props.value} onCheckedChange={props.onChange} />;
el = <Switch className='block' {...props} onChange={undefined} checked={props.value} onCheckedChange={props.onChange} />;
break;
case 'dict':
case 'list':
Expand Down

0 comments on commit ba36a21

Please sign in to comment.