From d68b2e44d8ecca20dab7b0b6aedc80c4a6392f9e Mon Sep 17 00:00:00 2001 From: Matilde Park Date: Fri, 20 Mar 2020 17:08:59 -0400 Subject: [PATCH] links: add startup content --- .../src/js/components/lib/channel-sidebar.js | 2 + .../link/src/js/components/lib/welcome.js | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 pkg/interface/link/src/js/components/lib/welcome.js diff --git a/pkg/interface/link/src/js/components/lib/channel-sidebar.js b/pkg/interface/link/src/js/components/lib/channel-sidebar.js index d21ff330a..34121d364 100644 --- a/pkg/interface/link/src/js/components/lib/channel-sidebar.js +++ b/pkg/interface/link/src/js/components/lib/channel-sidebar.js @@ -3,6 +3,7 @@ import React, { Component } from 'react'; import { Route, Link } from 'react-router-dom'; import { ChannelsItem } from '/components/lib/channels-item'; import { SidebarInvite } from '/components/lib/sidebar-invite'; +import { Welcome } from '/components/lib/welcome'; export class ChannelsSidebar extends Component { // drawer to the left @@ -69,6 +70,7 @@ export class ChannelsSidebar extends Component { New Collection + {sidebarInvites} {channelItems} diff --git a/pkg/interface/link/src/js/components/lib/welcome.js b/pkg/interface/link/src/js/components/lib/welcome.js new file mode 100644 index 000000000..8f3dc43e5 --- /dev/null +++ b/pkg/interface/link/src/js/components/lib/welcome.js @@ -0,0 +1,37 @@ +import React, { Component } from 'react'; + + +export class Welcome extends Component { + constructor() { + super(); + this.state = { + show: true + } + } + render() { + let wasWelcomed = localStorage.getItem("urbit-link:wasWelcomed"); + if (wasWelcomed === null) { + localStorage.setItem("urbit-link:wasWelcomed", JSON.stringify(false)); + return wasWelcomed = false; + } else { + wasWelcomed = JSON.parse(wasWelcomed); + } + + let associations = !!this.props.associations ? this.props.associations : {}; + + return ((!wasWelcomed && this.state.show) && (associations.length !== 0)) ? ( +
+

For now, collections only hold links. In the future, they'll be able to organize and display rich varieties of content.

+

{ + localStorage.setItem("urbit-link:wasWelcomed", JSON.stringify(true)); + this.setState({ show: false }) + })}> + Close this message +

+
+ ) :
+ } +} + +export default Welcome