2020-08-08 05:36:57 +02:00
|
|
|
import React, { useRef } from 'react';
|
2020-09-06 02:27:01 +02:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
2020-08-08 05:36:57 +02:00
|
|
|
import Button from 'components/common/Button';
|
|
|
|
import FormLayout, { FormButtons, FormRow } from 'components/layout/FormLayout';
|
2020-09-06 02:27:01 +02:00
|
|
|
import CopyButton from 'components/common/CopyButton';
|
2020-08-08 05:36:57 +02:00
|
|
|
|
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();
|
2020-08-15 10:17:15 +02:00
|
|
|
const { name, share_id } = values;
|
2020-08-08 05:36:57 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<FormLayout>
|
|
|
|
<p>
|
2020-09-06 02:27:01 +02:00
|
|
|
<FormattedMessage
|
|
|
|
id="message.share-url"
|
|
|
|
defaultMessage="This is the publicly shared URL for {target}."
|
|
|
|
values={{ target: <b>{values.name}</b> }}
|
|
|
|
/>
|
2020-08-08 05:36:57 +02:00
|
|
|
</p>
|
|
|
|
<FormRow>
|
|
|
|
<textarea
|
|
|
|
ref={ref}
|
|
|
|
rows={3}
|
|
|
|
cols={60}
|
2020-08-17 06:28:54 +02:00
|
|
|
spellCheck={false}
|
|
|
|
defaultValue={`${document.location.origin}/share/${share_id}/${encodeURIComponent(name)}`}
|
2020-08-08 05:36:57 +02:00
|
|
|
readOnly
|
|
|
|
/>
|
|
|
|
</FormRow>
|
|
|
|
<FormButtons>
|
|
|
|
<CopyButton type="submit" variant="action" element={ref} />
|
2020-09-06 02:27:01 +02:00
|
|
|
<Button onClick={onClose}>
|
|
|
|
<FormattedMessage id="button.cancel" defaultMessage="Cancel" />
|
|
|
|
</Button>
|
2020-08-08 05:36:57 +02:00
|
|
|
</FormButtons>
|
|
|
|
</FormLayout>
|
|
|
|
);
|
|
|
|
}
|