2020-08-08 05:36:57 +02:00
|
|
|
import React, { useRef } from 'react';
|
|
|
|
import Button from 'components/common/Button';
|
|
|
|
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
|
|
|
|
import CopyButton from '../common/CopyButton';
|
|
|
|
|
2020-08-15 10:17:15 +02:00
|
|
|
export default function TrackingCodeForm({ values, onClose }) {
|
2020-08-08 05:36:57 +02:00
|
|
|
const ref = useRef();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<FormLayout>
|
|
|
|
<p>
|
|
|
|
To track stats for <b>{values.name}</b>, place the following code in the <head>
|
|
|
|
section of your website.
|
|
|
|
</p>
|
|
|
|
<FormRow>
|
|
|
|
<textarea
|
|
|
|
ref={ref}
|
|
|
|
rows={3}
|
|
|
|
cols={60}
|
2020-08-17 06:28:54 +02:00
|
|
|
spellCheck={false}
|
2020-08-19 07:37:12 +02:00
|
|
|
defaultValue={`<script async defer data-website-id="${values.website_uuid}" src="${document.location.origin}/umami.js"></script>`}
|
2020-08-08 05:36:57 +02:00
|
|
|
readOnly
|
|
|
|
/>
|
|
|
|
</FormRow>
|
|
|
|
<FormButtons>
|
|
|
|
<CopyButton type="submit" variant="action" element={ref} />
|
|
|
|
<Button onClick={onClose}>Cancel</Button>
|
|
|
|
</FormButtons>
|
|
|
|
</FormLayout>
|
|
|
|
);
|
|
|
|
}
|