import React from "react" import { sectionTitles } from "../stats/behaviours" import * as api from '../api' export function FeatureSetupNotice({ site, feature, shortFeatureName, title, info, settingsLink, onHideAction }) { const sectionTitle = sectionTitles[feature] const requestHideSection = () => { if (window.confirm(`Are you sure you want to hide ${sectionTitle}? You can make it visible again in your site settings later.`)) { api.put(`/api/${encodeURIComponent(site.domain)}/disable-feature`, { feature: feature }) .then(response => { if (response.ok) { onHideAction() } }) } } function setupButton() { return (

Set up {shortFeatureName}

) } function hideButton() { return ( ) } return (
{title}
{info}
{hideButton()} {setupButton()}
) }