-
Notifications
You must be signed in to change notification settings - Fork 34
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
a20a0a0
commit e741cf3
Showing
5 changed files
with
62 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Meta } from 'frontend-essentials' | ||
import { css, cx } from '@emotion/css' | ||
|
||
import pagesManifest from 'pages-manifest.json' | ||
import Title from 'components/common/Title' | ||
import Info from 'components/common/Info' | ||
|
||
const { title, description } = pagesManifest.find(({ chunk }) => chunk === 'periodic-sync') | ||
|
||
const WebVitals = () => { | ||
const { syncTime } = localStorage | ||
|
||
return ( | ||
<div> | ||
<Meta title={`${title} | Client-side Rendering`} description={description} /> | ||
|
||
<Title>{title}</Title> | ||
|
||
<Info className={style.info}>{description}</Info> | ||
|
||
{window.matchMedia('(display-mode: standalone)').matches ? ( | ||
<span className={style.syncTime}> | ||
Last sync time:{' '} | ||
{syncTime | ||
? `${new Date(syncTime).toLocaleDateString('en-GB')} ${new Date(syncTime).toLocaleTimeString()}` | ||
: 'Never'} | ||
</span> | ||
) : ( | ||
<span className={cx(style.syncTime, style.alert)}>App not installed.</span> | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
const style = { | ||
info: css` | ||
margin-top: 20px; | ||
`, | ||
syncTime: css` | ||
display: block; | ||
margin-top: 20px; | ||
`, | ||
alert: css` | ||
color: red; | ||
` | ||
} | ||
|
||
export default WebVitals |