Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
833dcf2
commit c3338c4
Showing
7 changed files
with
168 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,63 @@ | ||
import React from 'react'; | ||
import {Save} from 'react-feather'; | ||
import styled from '@emotion/styled'; | ||
|
||
import Navigation from './Navigation'; | ||
import useRelease from 'src/utils/useLatestRelease'; | ||
|
||
import ActionButton from './ActionButton'; | ||
import NetworkStatus from './NetworkStatus'; | ||
|
||
const Toolbar = () => ( | ||
<Container> | ||
<Navigation /> | ||
<NetworkStatus /> | ||
</Container> | ||
); | ||
const Toolbar = () => { | ||
const latestRelease = useRelease(); | ||
|
||
const hasNewVersion = | ||
latestRelease && | ||
process.env.RELEASE_CHANNEL === 'stable' && | ||
process.env.RELEASE !== latestRelease.name; | ||
|
||
return ( | ||
<Container> | ||
{hasNewVersion && latestRelease && ( | ||
<NewVersionButton onClick={() => location.assign(latestRelease.html_url)}> | ||
<Save size="1rem" /> {latestRelease.name} available | ||
</NewVersionButton> | ||
)} | ||
<Version>{process.env.RELEASE}</Version> | ||
<NetworkStatus /> | ||
</Container> | ||
); | ||
}; | ||
|
||
const Version = styled('div')` | ||
align-items: center; | ||
font-size: 0.7rem; | ||
color: ${p => p.theme.subText}; | ||
margin-top: 4px; | ||
`; | ||
|
||
const Container = styled('header')` | ||
position: sticky; | ||
z-index: 1; | ||
top: 0; | ||
height: 36px; | ||
padding: 0 0.5rem; | ||
padding-left: 75px; | ||
display: grid; | ||
justify-content: end; | ||
grid-auto-flow: column; | ||
grid-auto-columns: max-content; | ||
grid-gap: 0.5rem; | ||
display: flex; | ||
justify-content: flex-end; | ||
gap: 0.5rem; | ||
align-items: center; | ||
background: ${p => p.theme.backgroundSecondary}; | ||
transition: background 300ms; | ||
border-bottom: 1px solid ${p => p.theme.border}; | ||
-webkit-app-region: drag; | ||
`; | ||
|
||
const NewVersionButton = styled(ActionButton)` | ||
position: absolute; | ||
bottom: 1rem; | ||
right: 1rem; | ||
background: #ef5f73; | ||
color: #fff; | ||
padding: 0.375rem 0.5rem; | ||
font-size: 0.75rem; | ||
`; | ||
|
||
export default Toolbar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,53 @@ | ||
import {MemoryRouter, Redirect, Route, Switch} from 'react-router-dom'; | ||
import styled from '@emotion/styled'; | ||
|
||
import Footer from 'app/components/Footer'; | ||
import Titlebar from 'app/components/Titlebar'; | ||
import Devices from 'app/views/devices'; | ||
import OverlayConfig from 'app/views/overlayConfig'; | ||
import Settings from 'app/views/settings'; | ||
import Navigation from 'src/renderer/components/Navigation'; | ||
|
||
const Application = () => ( | ||
<MemoryRouter> | ||
<Titlebar /> | ||
<Frame> | ||
<Switch> | ||
<Redirect from="/" to="/status" exact /> | ||
<Route path="/status" component={Devices} /> | ||
<Route path="/overlay-config" component={OverlayConfig} /> | ||
<Route path="/settings" component={Settings} /> | ||
</Switch> | ||
<Titlebar /> | ||
<Navigation /> | ||
<Content> | ||
<Switch> | ||
<Redirect from="/" to="/status" exact /> | ||
<Route path="/status" component={Devices} /> | ||
<Route path="/overlay-config" component={OverlayConfig} /> | ||
<Route path="/settings" component={Settings} /> | ||
</Switch> | ||
</Content> | ||
</Frame> | ||
<Footer /> | ||
</MemoryRouter> | ||
); | ||
|
||
const Frame = styled('main')` | ||
const Frame = styled('div')` | ||
flex-grow: 1; | ||
height: 0; | ||
display: grid; | ||
grid-template-columns: max-content 1fr; | ||
grid-template-rows: max-content 1fr max-content; | ||
grid-template-areas: | ||
'header header' | ||
'nav main'; | ||
> nav { | ||
grid-area: nav; | ||
} | ||
> header { | ||
grid-area: header; | ||
} | ||
`; | ||
|
||
const Content = styled('main')` | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
overflow: scroll; | ||
`; | ||
|
||
export default Application; |
Oops, something went wrong.