diff --git a/src/Metamaps/GlobalUI/index.js b/src/Metamaps/GlobalUI/index.js index 7a7d2ae5..9422bbed 100644 --- a/src/Metamaps/GlobalUI/index.js +++ b/src/Metamaps/GlobalUI/index.js @@ -1,7 +1,5 @@ /* global $ */ -import clipboard from 'clipboard-js' - import Create from '../Create' import Notifications from './Notifications' @@ -137,19 +135,6 @@ const GlobalUI = { ReactApp.render() self.notifying = false } - }, - shareInvite: function(inviteLink) { - clipboard.copy({ - 'text/plain': inviteLink - }).then(() => { - $('#joinCodesBox .popup').remove() - $('#joinCodesBox').append('
Copied!
') - window.setTimeout(() => $('#joinCodesBox .popup').remove(), 1500) - }, () => { - $('#joinCodesBox .popup').remove() - $('#joinCodesBox').append(`Your browser doesn't support copying, please copy manually.
`) - window.setTimeout(() => $('#joinCodesBox .popup').remove(), 1500) - }) } } diff --git a/src/components/LightBoxes/Invite.js b/src/components/LightBoxes/Invite.js index 53689e74..6ccbf833 100644 --- a/src/components/LightBoxes/Invite.js +++ b/src/components/LightBoxes/Invite.js @@ -1,7 +1,36 @@ import React, { Component } from 'react' +import clipboard from 'clipboard-js' class Invite extends Component { + constructor(props) { + super(props) + this.state = { + copied: false, + unable: false + } + } + + inviteLink = () => { + const { host, protocol } = window ? window.location : {} + const inviteLink = `${protocol}//${host}/join?code=${this.props.inviteCode}` + return inviteLink + } + + shareInvite = () => { + const inviteLink = this.inviteLink() + clipboard.copy({ + 'text/plain': inviteLink + }).then(() => { + this.setState({ copied: true }) + window.setTimeout(() => this.setState({ copied: false }), 1500) + }, () => { + this.setState({ unable: true }) + window.setTimeout(() => this.setState({ unable: false }), 1500) + }) + } + render = () => { + const inviteLink = this.inviteLink() return (Below is a personal invite link containing your unique access code, which can be used multiple times.
- {`/join?code=${this.props.inviteCode}`} - + {inviteLink} + +
++ {this.state.copied && 'Copied!'} + {this.state.unable && "Your browser doesn't support copying, please copy manually."}
STATUS:
-VERSION:
-BUILD:
-LAST UPDATE:
-PRIVATE BETA
-{ METAMAPS_VERSION }
-{ METAMAPS_BUILD }
-{ METAMAPS_LAST_UPDATED }
-Metamaps.cc is a free and open source web platform that supports real-time sense-making and distributed collaboration between individuals, communities and organizations.
- -Using an intuitive graph-based interface, Metamaps.cc helps map out networks of people, ideas, resources, stories, experiences, conversations and much more. The platform is evolving for a range of applications amidst a growing network of designers, developers, facilitators, practitioners, entrepreneurs, and artists.
- -Metamaps.cc is created and maintained by a distributed community of contributors passionate about the evolution of collaboration, alternative forms of value creation and increase of collective intelligence through the lens of the open culture and the peer-to-peer revolution.
- -To view this experience, please upgrade to the latest one of these browsers:
- Chrome - Firefox - Safari -While it's downloading, explore our blog,
watch the tutorials, or visit our knowledge base!
-
-
The Metamaps platform is currently in an invite-only beta with the express purpose of creating a high value knowledge ecosystem, a diverse community of contributors and a culture of collaboration and curiosity.
-As a valued beta tester, you have the ability to invite your peers, colleagues and collaborators onto the platform.
-Below is a personal invite link containing your unique access code, which can be used multiple times.
-{ invite_link() } - -