diff --git a/pkg/interface/src/views/apps/launch/app.js b/pkg/interface/src/views/apps/launch/app.js index 125fd93f0..895f64a5b 100644 --- a/pkg/interface/src/views/apps/launch/app.js +++ b/pkg/interface/src/views/apps/launch/app.js @@ -15,18 +15,13 @@ import Groups from './components/Groups'; const ScrollbarLessBox = styled(Box)` scrollbar-width: none !important; - + ::-webkit-scrollbar { display: none; } `; export default class LaunchApp extends React.Component { - componentDidMount() { - // preload spinner asset - new Image().src = '/~landscape/img/Spinner.png'; - } - render() { const { props } = this; diff --git a/pkg/interface/src/views/apps/links/components/link-submit.tsx b/pkg/interface/src/views/apps/links/components/link-submit.tsx index c13a05d52..ecd84b596 100644 --- a/pkg/interface/src/views/apps/links/components/link-submit.tsx +++ b/pkg/interface/src/views/apps/links/components/link-submit.tsx @@ -2,8 +2,7 @@ import React, { Component } from 'react'; import { hasProvider } from 'oembed-parser'; import { S3Upload, SubmitDragger } from '~/views/components/s3-upload'; -import { Spinner } from '~/views/components/Spinner'; -import { Box, Text, BaseInput, Button } from "@tlon/indigo-react"; +import { Box, Text, BaseInput, Button } from '@tlon/indigo-react'; import GlobalApi from '~/logic/api/global'; import { S3State } from '~/types'; @@ -57,7 +56,7 @@ export class LinkSubmit extends Component { this.setState({ disabled: true }); const parentIndex = this.props.parentIndex || ''; - let post = createPost([ + const post = createPost([ { text: title }, { url: link } ], parentIndex); @@ -79,7 +78,7 @@ export class LinkSubmit extends Component { setLinkValid(linkValue) { const URLparser = new RegExp( /((?:([\w\d\.-]+)\:\/\/?){1}(?:(www)\.?){0,1}(((?:[\w\d-]+\.)*)([\w\d-]+\.[\w\d]+))){1}(?:\:(\d+)){0,1}((\/(?:(?:[^\/\s\?]+\/)*))(?:([^\?\/\s#]+?(?:.[^\?\s]+){0,1}){0,1}(?:\?([^\s#]+)){0,1})){0,1}(?:#([^#\s]+)){0,1}/ - );; + ); let linkValid = URLparser.test(linkValue); @@ -100,7 +99,7 @@ export class LinkSubmit extends Component { if (result.title && !this.state.linkTitle) { this.setState({ linkTitle: result.title }); } - }).catch((error) => {/*noop*/}); + }).catch((error) => { /* noop*/ }); } else if (!this.state.linkTitle) { this.setState({ linkTitle: decodeURIComponent(linkValue @@ -112,7 +111,7 @@ export class LinkSubmit extends Component { .replace('_', ' ') .replace(/\d{4}\.\d{1,2}\.\d{2}\.\.\d{2}\.\d{2}\.\d{2}-/, '') ) - }) + }); } } } @@ -169,8 +168,8 @@ export class LinkSubmit extends Component { return; } this.s3Uploader.current.inputRef.current.files = files; - const fire = document.createEvent("HTMLEvents"); - fire.initEvent("change", true, true); + const fire = document.createEvent('HTMLEvents'); + fire.initEvent('change', true, true); this.s3Uploader.current?.inputRef.current?.dispatchEvent(fire); } @@ -191,10 +190,10 @@ export class LinkSubmit extends Component { width='100%' borderRadius='2' onDragEnter={this.onDragEnter.bind(this)} - onDragOver={e => { + onDragOver={(e) => { e.preventDefault(); if (isS3Ready) { - this.setState({ dragover: true}) + this.setState({ dragover: true }); } }} onDragLeave={() => this.setState({ dragover: false })} @@ -208,22 +207,29 @@ export class LinkSubmit extends Component { this.state.disabled ) ? null : ( isS3Ready ? ( - + Drop or { if (!this.readyToUpload()) { return; } this.s3Uploader.current.inputRef.current.click(); - }}> upload + }} + > upload a file, or paste a link here ) : ( - + Paste a link here ) @@ -236,7 +242,7 @@ export class LinkSubmit extends Component { uploadSuccess={this.uploadSuccess.bind(this)} uploadError={this.uploadError.bind(this)} className="dn absolute pt3 pb2 pl2 w-100" - > : null} + > : null} { primary disabled={!this.state.linkValid || this.state.disabled} onClick={this.onClickPost.bind(this)} - > + > Post link diff --git a/pkg/interface/src/views/components/Spinner.js b/pkg/interface/src/views/components/Spinner.js index e2225ffa5..08125aaea 100644 --- a/pkg/interface/src/views/components/Spinner.js +++ b/pkg/interface/src/views/components/Spinner.js @@ -1,18 +1,19 @@ -import React, { Component } from 'react'; +import React from 'react'; +import { LoadingSpinner, Text } from '@tlon/indigo-react'; const Spinner = ({ classes = '', text = '', awaiting = false }) => awaiting ? ( -
- + -

{text}

-
+ {text} +
) : null; -export { Spinner as default, Spinner }; \ No newline at end of file +export { Spinner as default, Spinner }; diff --git a/pkg/interface/src/views/components/s3-upload.tsx b/pkg/interface/src/views/components/s3-upload.tsx index cc7231c45..d89ef154a 100644 --- a/pkg/interface/src/views/components/s3-upload.tsx +++ b/pkg/interface/src/views/components/s3-upload.tsx @@ -1,8 +1,7 @@ import React, { Component } from 'react' -import { BaseInput, Box, Text, Icon } from "@tlon/indigo-react"; +import { BaseInput, Box, Text, Icon, LoadingSpinner } from "@tlon/indigo-react"; import S3Client from '~/logic/lib/s3'; -import { Spinner } from './Spinner'; import { S3Credentials, S3Configuration } from '~/types'; import { dateToDa, deSig } from '~/logic/lib/util'; @@ -148,7 +147,7 @@ export class S3Upload extends Component { accept={accept} onChange={this.onChange.bind(this)} /> {this.state.isUploading - ? + ? : {display} } diff --git a/pkg/interface/src/views/landscape/index.tsx b/pkg/interface/src/views/landscape/index.tsx index 2042ccd96..906fa31e9 100644 --- a/pkg/interface/src/views/landscape/index.tsx +++ b/pkg/interface/src/views/landscape/index.tsx @@ -23,11 +23,9 @@ type LandscapeProps = StoreState & { export default class Landscape extends Component { componentDidMount() { document.title = 'OS1 - Landscape'; - // preload spinner asset - new Image().src = '/~landscape/img/Spinner.png'; - this.props.subscription.startApp('groups') - this.props.subscription.startApp('chat') + this.props.subscription.startApp('groups'); + this.props.subscription.startApp('chat'); this.props.subscription.startApp('graph'); }