import {useFormContext} from 'react-hook-form';
import {ComponentType} from 'react';
import {SettingsPanel} from '../../settings-panel';
import {FormSelect, Option} from '../../../../ui/forms/select/select';
import {SettingsErrorGroup} from '../../settings-error-group';
import {FormTextField} from '../../../../ui/forms/input-field/text-field/text-field';
import {AdminSettings} from '../../admin-settings';
import {useClearCache} from './clear-cache';
import {Button} from '../../../../ui/buttons/button';
import {SectionHelper} from '../../../../ui/section-helper';
import {Trans} from '../../../../i18n/trans';
export function CacheSettings() {
const clearCache = useClearCache();
return (
}
description={
}
>
}
/>
);
}
function CacheSelect() {
const {watch, clearErrors} = useFormContext();
const cacheDriver = watch('server.cache_driver');
let CredentialSection: ComponentType | null = null;
if (cacheDriver === 'memcached') {
CredentialSection = MemcachedCredentials;
}
return (
{isInvalid => {
return (
<>
{
clearErrors();
}}
selectionMode="single"
name="server.cache_driver"
label={}
description={
}
>
{CredentialSection && (
)}
>
);
}}
);
}
interface CredentialProps {
isInvalid: boolean;
}
function MemcachedCredentials({isInvalid}: CredentialProps) {
return (
<>
}
required
/>
}
required
/>
>
);
}