Add embeddable share link (#1522)

* add embeddable share link

* use slug from props

* remove unwanted feature policies
This commit is contained in:
Gandharv 2021-12-08 13:12:47 +05:30 committed by GitHub
parent 3477f7ff15
commit edb43eb224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -7,6 +7,7 @@ import { CopyToClipboard } from 'react-copy-to-clipboard';
import 'react-toastify/dist/ReactToastify.css';
import Skeleton from 'react-loading-skeleton';
import { debounce } from 'lodash';
import Textarea from '@/_ui/Textarea';
class ManageAppUsers extends React.Component {
constructor(props) {
@ -134,6 +135,7 @@ class ManageAppUsers extends React.Component {
const appLink = `${window.location.origin}/applications/`;
const shareableLink = appLink + (this.props.slug || appId);
const slugButtonClass = isSlugVerificationInProgress ? '' : slugError !== null ? 'is-invalid' : 'is-valid';
const embeddableLink = `<iframe width="560" height="315" src="${appLink}${this.props.slug}" title="Tooljet app - ${this.props.slug}" frameborder="0" allowfullscreen></iframe>`;
return (
<div>
@ -220,6 +222,27 @@ class ManageAppUsers extends React.Component {
</div>
</div>
<hr />
<div className="shareable-link mb-3">
<label className="form-label">
<small>Get embeddable link for this application</small>
</label>
<div className="input-group">
<Textarea disabled className="input-with-icon" rows={5} value={embeddableLink} />
<span className="input-group-text">
<CopyToClipboard
text={embeddableLink}
onCopy={() =>
toast.success('Link copied to clipboard', {
hideProgressBar: true,
position: 'bottom-center',
})
}
>
<button className="btn btn-secondary btn-sm">Copy</button>
</CopyToClipboard>
</span>
</div>
</div>
{/* <div className="add-user mb-3">
<div className="row">
<div className="col">

View file

@ -1,10 +1,10 @@
import React from 'react';
const Input = ({ helpText, ...props }) => (
const Textarea = ({ helpText, ...props }) => (
<>
<textarea {...props} />
{helpText && <small className="text-muted" dangerouslySetInnerHTML={{ __html: helpText }} />}
</>
);
export default Input;
export default Textarea;