diff --git a/pkg/interface/src/views/apps/launch/app.js b/pkg/interface/src/views/apps/launch/app.js index 09efbb006..01410389c 100644 --- a/pkg/interface/src/views/apps/launch/app.js +++ b/pkg/interface/src/views/apps/launch/app.js @@ -9,29 +9,10 @@ import './css/custom.css'; import { Sigil } from "~/logic/lib/sigil"; import Tiles from './components/tiles'; +import Tile from './components/tiles/tile'; import Welcome from './components/welcome'; import Groups from './components/Groups'; -const Tile = ({ children, bg, to, ...rest }) => ( - - - - {children} - - - -); - export default class LaunchApp extends React.Component { componentDidMount() { @@ -57,7 +38,14 @@ export default class LaunchApp extends React.Component {
- + - + [0]) { width="100%" bg="white" border={1} - borderRadius={1} + borderRadius={2} borderColor="lightGray" p={2} fontSize={0} > - {group.metadata.title} + {group.metadata.title} ))} diff --git a/pkg/interface/src/views/apps/launch/components/tiles/basic.js b/pkg/interface/src/views/apps/launch/components/tiles/basic.js index 765545371..7299991e9 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles/basic.js +++ b/pkg/interface/src/views/apps/launch/components/tiles/basic.js @@ -1,7 +1,6 @@ import React from 'react'; import classnames from 'classnames'; -import { Link } from 'react-router-dom'; -import defaultApps from '~/logic/lib/default-apps'; +import { Text, Icon } from '@tlon/indigo-react'; import Tile from './tile'; @@ -9,47 +8,22 @@ export default class BasicTile extends React.PureComponent { render() { const { props } = this; - const children = ( - -

- {props.title} -

- -
- ); - - const routeList = defaultApps.map((e) => { - return `/~${e}`; - }); - - const tile = ( routeList.indexOf(props.linkedUrl) !== -1 ) ? ( - - {children} - - ) : ( - - {children} - - ); - return ( - -
{tile}
+ + + {props.title === 'Dojo' + ? + : null + }{props.title} + ); } diff --git a/pkg/interface/src/views/apps/launch/components/tiles/clock.js b/pkg/interface/src/views/apps/launch/components/tiles/clock.js index 648483d16..e35db3dc8 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles/clock.js +++ b/pkg/interface/src/views/apps/launch/components/tiles/clock.js @@ -63,13 +63,21 @@ const circle = (ctx, x, y, r, from, to, fill) => { ctx.fill(); }; +const circleClip = (ctx, x, y, r, from, to, fill) => { + ctx.globalCompositeOperation = 'xor'; + circle(ctx, x, y, r, from, to, fill); + ctx.globalCompositeOperation = 'source-over'; +}; + const circleOutline = (ctx, x, y, r, from, to, stroke, lineWidth) => { ctx.beginPath(); ctx.arc( x, y, r, from, to ); ctx.fillStyle = 'rgba(0,0,0,0)'; ctx.lineWidth = lineWidth; ctx.strokeStyle = stroke || 'rgba(0,0,0,0)'; - ctx.stroke(); + if (lineWidth) { + ctx.stroke(); + } }; const arc = (ctx, x, y, r, from, to, fill) => { @@ -211,7 +219,7 @@ class Clock extends React.Component { ctr / 2, state.sunriseEnd, state.sunset, - '#6792FF' + 'rgba(33, 157, 255, .3)' ); // Sunrise @@ -220,9 +228,9 @@ class Clock extends React.Component { ctr, ctr, ctr / 2, - state.nightEnd, + state.sunsetStart, state.sunriseEnd, - '#FCC440' + '#FFC700' ); // Sunset @@ -231,31 +239,9 @@ class Clock extends React.Component { ctr, ctr, ctr / 2, - state.nightEnd, - splitArc(state.sunriseEnd, state.nightEnd), - '#FF611E' - ); - - // Sunset - degArc( - ctx, - ctr, - ctr, - ctr / 2, - state.sunset, - state.night, - '#FCC440' - ); - - // Sunset - degArc( - ctx, - ctr, - ctr, - ctr / 2, - splitArc(state.sunset, state.night), - state.night, - '#FF611E' + state.dusk, + state.dawn, + 'rgba(255, 65, 54, .8)' ); // Night @@ -266,7 +252,7 @@ class Clock extends React.Component { ctr / 2, state.night, state.nightEnd, - 'rgb(26, 26, 26)' + 'rgba(0, 0, 0, .8)' ); if ( @@ -328,20 +314,8 @@ class Clock extends React.Component { ctr-1, -1, 2 * Math.PI, - text, - 1 - ); - - // Outer borders - circle( - ctx, - ctr, - ctr, - ctr/1.85, - -1, - 2 * Math.PI, - background, - 1 + 'none', + 0 ); // Center white circle border @@ -352,8 +326,19 @@ class Clock extends React.Component { ctr/1.85, -1, 2 * Math.PI, - text, - 1 + 'none', + 0 + ); + + // Inner hole + circle( + ctx, + ctr, + ctr, + ctr/1.85, + -1, + 2 * Math.PI, + background ); // Text for time and date @@ -373,13 +358,13 @@ class Clock extends React.Component { } render() { - return
+ return ( this.canvasRef = canvasRef } - id="clock-canvas" + style={{ height: '100%', width: '100%'}} + ref={ canvasRef => this.canvasRef = canvasRef } + id="clock-canvas" /> -
; + ); } } @@ -390,7 +375,7 @@ export default class ClockTile extends React.Component { renderWrapper(child) { return ( - + {child} ); diff --git a/pkg/interface/src/views/apps/launch/components/tiles/tile.js b/pkg/interface/src/views/apps/launch/components/tiles/tile.js index 9d903683d..ca65f07aa 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles/tile.js +++ b/pkg/interface/src/views/apps/launch/components/tiles/tile.js @@ -1,15 +1,41 @@ import React from 'react'; +import { Link } from 'react-router-dom'; +import defaultApps from '~/logic/lib/default-apps'; +const routeList = defaultApps.map((e) => { + return `/~${e}`; +}); +import { Box } from "@tlon/indigo-react"; export default class Tile extends React.Component { render() { - const { transparent } = this.props; - const bgClasses = transparent ? ' ' : ' bg-transparent '; + const { bg, to, p, ...props } = this.props; + + let childElement = ( + + {props.children} + + ); + + if (to) { + if (routeList.indexOf(to) === -1) { + childElement= ({childElement}); + } else { + childElement= ({childElement}); + } + + } + return ( -
- {this.props.children} -
+ + {childElement} + ); } } diff --git a/pkg/interface/src/views/apps/launch/components/tiles/weather.js b/pkg/interface/src/views/apps/launch/components/tiles/weather.js index 3cd027174..1b514ae27 100644 --- a/pkg/interface/src/views/apps/launch/components/tiles/weather.js +++ b/pkg/interface/src/views/apps/launch/components/tiles/weather.js @@ -1,5 +1,6 @@ import React from 'react'; import moment from 'moment'; +import { Box, Icon, Text } from '@tlon/indigo-react'; import Tile from './tile'; @@ -47,87 +48,53 @@ export default class WeatherTile extends React.Component { // set appearance based on weather setColors(data) { let weatherStyle = { - gradient1: '', - gradient2: '', + bg: '', text: '' }; switch (data.daily.icon) { case 'clear-day': - weatherStyle = { - gradient1: '#A5CEF0', gradient2: '#FEF4E0', text: 'black' - }; + weatherStyle = { bg: '#FEF4E0', text: 'black' }; break; case 'clear-night': - weatherStyle = { - gradient1: '#56668e', gradient2: '#000080', text: 'white' - }; + weatherStyle = { bg: '#000080', text: 'white' }; break; case 'rain': - weatherStyle = { - gradient1: '#b1b2b3', gradient2: '#b0c7ff', text: 'black' - }; + weatherStyle = { bg: '#b0c7ff', text: 'black' }; break; case 'snow': - weatherStyle = { - gradient1: '#eee', gradient2: '#f9f9f9', text: 'black' - }; + weatherStyle = { bg: '#f9f9f9', text: 'black' }; break; case 'sleet': - weatherStyle = { - gradient1: '#eee', gradient2: '#f9f9f9', text: 'black' - }; + weatherStyle = { bg: '#f9f9f9', text: 'black' }; break; case 'wind': - weatherStyle = { - gradient1: '#eee', gradient2: '#fff', text: 'black' - }; + weatherStyle = { bg: '#fff', text: 'black' }; break; case 'fog': - weatherStyle = { - gradient1: '#eee', gradient2: '#fff', text: 'black' - }; + weatherStyle = { bg: '#fff', text: 'black' }; break; case 'cloudy': - weatherStyle = { - gradient1: '#eee', gradient2: '#b1b2b3', text: 'black' - }; + weatherStyle = { bg: '#b1b2b3', text: 'black' }; break; case 'partly-cloudy-day': - weatherStyle = { - gradient1: '#fcc440', gradient2: '#b1b2b3', text: 'black' - }; + weatherStyle = { bg: '#b1b2b3', text: 'black' }; break; case 'partly-cloudy-night': - weatherStyle = { - gradient1: '#7f7f7f', gradient2: '#56668e', text: 'white' - }; + weatherStyle = { bg: '#56668e', text: 'white' }; break; default: - weatherStyle = { - gradient1: 'white', gradient2: 'white', text: 'black' - }; + weatherStyle = { bg: 'white', text: 'black' }; } return weatherStyle; } // all tile views renderWrapper(child, - weatherStyle = { gradient1: 'white', gradient2: 'white', text: 'black' } + weatherStyle = { bg: 'white', text: 'black' } ) { return ( - -
+ {child} -
); } @@ -136,25 +103,25 @@ export default class WeatherTile extends React.Component { let secureCheck; let error; if (this.state.error === true) { - error =

Please try again. -

; + error =

Please try again.

; } if (location.protocol === 'https:') { secureCheck = ( - this.locationSubmit()}> Detect -> ); } return this.renderWrapper( -
+ this.setState({ manualEntry: !this.state.manualEntry }) } @@ -162,93 +129,113 @@ export default class WeatherTile extends React.Component { <- {secureCheck} -

+ Please enter your{' '} latitude and longitude . -

+ {error} -
-
- { - if (e.key === 'Enter') { - e.preventDefault(); - this.manualLocationSubmit(e.target.value); - } - }} /> - this.manualLocationSubmit()} - value="->" - /> -
-
-
+
+ { + if (e.key === 'Enter') { + e.preventDefault(); + this.manualLocationSubmit(e.target.value); + } + }} /> + this.manualLocationSubmit()} + value="->" + /> +
+ ); } renderNoData() { - return this.renderWrapper(( -
this.setState({ manualEntry: !this.state.manualEntry })} + return this.renderWrapper( + this.setState({ manualEntry: !this.state.manualEntry })} > -

- Weather -

-

- -> Set location -

-
- )); + Weather + + -> Set location + + + ); } renderWithData(data, weatherStyle) { const c = data.currently; const d = data.daily.data[0]; - const da = moment.unix(d.sunsetTime).format('h:mm a') || ''; + const sunset = moment.unix(d.sunsetTime); + const sunsetDiff = sunset.diff(moment(), 'hours'); + + const sunrise = moment.unix(d.sunriseTime); + let sunriseDiff = sunrise.diff(moment(), 'hours'); + + if (sunriseDiff > 24) { + sunriseDiff = sunriseDiff - 24; + } else if (sunriseDiff < 0) { + sunriseDiff = sunriseDiff + 24; + } + + const nextSolarEvent = sunsetDiff > 0 + ? `Sun sets in ${sunsetDiff}h` + : `Sun rises in ${sunriseDiff}h`; return this.renderWrapper( - + + + + {c.summary} + {Math.round(c.temperature)}° + {nextSolarEvent} + + , weatherStyle); } @@ -269,14 +256,8 @@ export default class WeatherTile extends React.Component {
-

- Weather -

-

+ Weather +

Loading, please check again later...

diff --git a/pkg/interface/src/views/apps/launch/components/welcome.js b/pkg/interface/src/views/apps/launch/components/welcome.js index 6a4b3ed28..0bbca37b8 100644 --- a/pkg/interface/src/views/apps/launch/components/welcome.js +++ b/pkg/interface/src/views/apps/launch/components/welcome.js @@ -1,5 +1,6 @@ import React from 'react'; import { Link } from 'react-router-dom'; +import { Box, Text } from '@tlon/indigo-react'; export default class Welcome extends React.Component { constructor() { @@ -18,25 +19,30 @@ export default class Welcome extends React.Component { render() { const firstTime = this.props.firstTime; return (firstTime && this.state.show) ? ( -
-

Welcome. This virtual computer belongs to you completely. The Urbit ID you used to boot it is yours as well.

-

Since your ID and OS belong to you, it’s up to you to keep them safe. Be sure your ID is somewhere you won’t lose it and you keep your OS on a machine you trust.

-

Urbit OS is designed to keep your data secure and hard to lose. But the system is still young — so don’t put anything critical in here just yet.

-

To begin exploring, you should probably pop into a chat and verify there are signs of life in this new place. If you were invited by a friend, you probably already have access to a few groups.

-

If you don't know where to go, feel free to - join the Urbit Community group. -

-

Have fun!

-

Welcome. This virtual computer belongs to you completely. The Urbit ID you used to boot it is yours as well. + Since your ID and OS belong to you, it’s up to you to keep them safe. Be sure your ID is somewhere you won’t lose it and you keep your OS on a machine you trust. + Urbit OS is designed to keep your data secure and hard to lose. But the system is still young — so don’t put anything critical in here just yet. + To begin exploring, you should probably pop into a chat and verify there are signs of life in this new place. If you were invited by a friend, you probably already have access to a few groups. + If you don't know where to go, feel free to join the Urbit Community group. + + Have fun! + { this.disableWelcome(); })} > Close this note -

-
+ + ) : null; } }