From 06ab4bfc795e43dc59147acd4d7ce2f7fefb4c11 Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Thu, 12 Nov 2020 21:06:05 -0800 Subject: [PATCH] launch: click to copy base hash Fixes https://github.com/urbit/landscape/issues/162 --- pkg/interface/src/views/apps/launch/app.js | 130 +++++++++++---------- 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/pkg/interface/src/views/apps/launch/app.js b/pkg/interface/src/views/apps/launch/app.js index aa6baba22..23019e1b1 100644 --- a/pkg/interface/src/views/apps/launch/app.js +++ b/pkg/interface/src/views/apps/launch/app.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import Helmet from 'react-helmet'; import styled from 'styled-components'; @@ -10,6 +10,7 @@ import Tiles from './components/tiles'; import Tile from './components/tiles/tile'; import Welcome from './components/welcome'; import Groups from './components/Groups'; +import { writeText } from '~/logic/lib/util'; const ScrollbarLessBox = styled(Box)` scrollbar-width: none !important; @@ -19,70 +20,75 @@ const ScrollbarLessBox = styled(Box)` } `; -export default class LaunchApp extends React.Component { - render() { - const { props } = this; +export default function LaunchApp(props) { + const [hashText, setHashText] = useState(props.baseHash); - return ( - <> - - OS1 - Home - - - - - - - - - DMs + Drafts - - - - - - - - + return ( + <> + + OS1 - Home + + + - {props.baseHash} + + + + + DMs + Drafts + + + + + + - - ); - } + + { + writeText(props.baseHash); + setHashText('copied'); + setTimeout(() => { + setHashText(props.baseHash); + }, 2000); + }} + > + {hashText || props.baseHash} + + + ); } -