launch: click to copy base hash
Fixes
-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,9 +20,8 @@ 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 (
<>
@@ -78,11 +78,17 @@ export default class LaunchApp extends React.Component {
borderRadius={2}
fontSize={0}
p={2}
+ cursor="pointer"
+ onClick={() => {
+ writeText(props.baseHash);
+ setHashText('copied');
+ setTimeout(() => {
+ setHashText(props.baseHash);
+ }, 2000);
+ }}
>
- {props.baseHash}
+ {hashText || props.baseHash}
</Box>
</>
);
}
-}
-
