Skip to content

Commit

Permalink
feat(): improve offline support
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Oct 25, 2019
1 parent dc21e5b commit c021d53
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 53 deletions.
3 changes: 2 additions & 1 deletion ui/src/about/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import Center from '../components/Center'
import { VERSION } from '../constants'
import Page from '../layout/Page'
import styles from './AboutPage.module.css'
import logo from './logo.svg'

export default () => (
<Page title="About">
<Center className={styles.about}>
<h1>
<img src={process.env.PUBLIC_URL + '/logo.svg'} />
<img src={logo} />
</h1>
<span>({VERSION})</span>
<p>Read your Internet article flow in one place with complete peace of mind and freedom.</p>
Expand Down
137 changes: 137 additions & 0 deletions ui/src/about/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions ui/src/components/NetworkStatus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React, { ReactNode } from 'react'

import useOnlineStatus from '../hooks/useOnlineStatus'

interface Props {
status: 'online' | 'offline'
children: ReactNode
}

function NetworkStatus({ status, children }: Props) {
const isOnline = useOnlineStatus()
const display = (isOnline && status == 'online') || (!isOnline && status == 'offline')

if (display) {
return <>{children}</>
} else {
return null
}
}

export default NetworkStatus
Loading

0 comments on commit c021d53

Please sign in to comment.