Skip to content

Commit

Permalink
Add install button
Browse files Browse the repository at this point in the history
  • Loading branch information
FilipChalupa committed Mar 9, 2024
1 parent 30a4144 commit 2a1d2cf
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 5 deletions.
34 changes: 29 additions & 5 deletions components/Frontpage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import AccessTimeIcon from '@mui/icons-material/AccessTime'
import AddBoxIcon from '@mui/icons-material/AddBox'
import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder'
import SettingsIcon from '@mui/icons-material/Settings'
import {
Expand All @@ -15,6 +16,7 @@ import Typography from '@mui/material/Typography'
import Image from 'next/image'
import Link from 'next/link'
import * as React from 'react'
import { usePWAInstall } from 'react-use-pwa-install'
import logo from '../public/images/app-icon/favicon.svg'
import { CreateCustomForm } from './CreateCustomForm'

Expand All @@ -36,6 +38,8 @@ export const Frontpage: React.FunctionComponent = () => {

const dynamicPresets = React.useMemo(() => ['1', '2', '3'], [])

const install = usePWAInstall()

return (
<Box paddingTop={4} paddingBottom={4}>
<Container maxWidth="xs">
Expand Down Expand Up @@ -93,11 +97,31 @@ export const Frontpage: React.FunctionComponent = () => {
Create custom controlled
</Typography>
<CreateCustomForm />
<Box paddingBottom={10} />
<Typography variant="h5" component="h2" gutterBottom>
Donate
</Typography>
<Box paddingBottom={4} />
<List>
<ListItem
disablePadding
style={
Boolean(install)
? undefined
: {
opacity: 0,
visibility: 'hidden',
}
}
>
<ListItemButton
onClick={() => {
install()
}}
disabled={!install}
>
<ListItemIcon>
<AddBoxIcon />
</ListItemIcon>
<ListItemText primary="Install Just Countdown" />
</ListItemButton>
</ListItem>
<ListItem disablePadding>
<ListItemButton
component={Link}
Expand All @@ -106,7 +130,7 @@ export const Frontpage: React.FunctionComponent = () => {
<ListItemIcon>
<FavoriteBorderIcon />
</ListItemIcon>
<ListItemText primary="filipchalupa.cz" />
<ListItemText primary="Donate to filipchalupa.cz" />
</ListItemButton>
</ListItem>
</List>
Expand Down
34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"firebase": "^9.15.0",
"react-intersection-observer": "^9.4.1",
"react-keep-awake": "^0.0.3",
"react-use-pwa-install": "^0.2.4",
"sass": "^1.71.1",
"use-chromecast-caf-receiver": "^0.0.3",
"use-chromecast-caf-sender": "^0.0.5",
Expand Down

0 comments on commit 2a1d2cf

Please sign in to comment.