import React from "react" import { sectionTitles } from "../stats/behaviours" import * as api from '../api' export function FeatureSetupNotice({ site, feature, title, info, callToAction, 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 renderCallToAction() { return (

{callToAction.action}

) } function renderHideButton() { return ( ) } return (
{title}
{info}
{renderHideButton()} {renderCallToAction()}
) }