diff --git a/app/soapbox/features/features-panel/index.tsx b/app/soapbox/features/features-panel/index.tsx index dff3579da..5602edf61 100644 --- a/app/soapbox/features/features-panel/index.tsx +++ b/app/soapbox/features/features-panel/index.tsx @@ -10,11 +10,12 @@ const messages = defineMessages({ }); interface IFeaturesPanel { - features: Record, + features: Record, + onChange?: (features: Record) => void, } /** A UI for managing conditional feature flags. */ -const FeaturesPanel: React.FC = ({ features: userFeatures }) => { +const FeaturesPanel: React.FC = ({ features: userFeatures, onChange }) => { const intl = useIntl(); const autoFeatures = useFeatures(); @@ -22,12 +23,20 @@ const FeaturesPanel: React.FC = ({ features: userFeatures }) => return Object.assign({ ...autoFeatures }, { ...userFeatures }); }, [userFeatures, autoFeatures]); + const handleChange = (key: string): React.ChangeEventHandler => { + return (e) => { + if (onChange) { + onChange({ ...userFeatures, [key]: e.target.checked }); + } + }; + }; + return ( {Object.keys(autoFeatures).map(key => ( - + ))}