Merge pull request #9 from cpvalente/feat/electron

Feat/electron
This commit is contained in:
Carlos Valente
2021-06-13 10:05:03 +02:00
committed by GitHub
18 changed files with 88 additions and 82 deletions
+3
View File
@@ -10,4 +10,7 @@ html,
overflow: hidden; overflow: hidden;
overflow: clip; overflow: clip;
height: 100vh; height: 100vh;
-webkit-user-select: none;
user-select: none;
-webkit-app-region: drag;
} }
@@ -1,16 +1,19 @@
import { IconButton } from '@chakra-ui/button'; import { IconButton } from '@chakra-ui/button';
import { Tooltip } from '@chakra-ui/tooltip';
import { FiChevronsDown } from 'react-icons/fi'; import { FiChevronsDown } from 'react-icons/fi';
export default function ApplyIconBtn(props) { export default function ApplyIconBtn(props) {
const { clickhandler, ...rest } = props; const { clickhandler, ...rest } = props;
return ( return (
<IconButton <Tooltip label='Apply delays'>
size={props.size || 'xs'} <IconButton
icon={<FiChevronsDown />} size={props.size || 'xs'}
colorScheme='orange' icon={<FiChevronsDown />}
onClick={clickhandler} colorScheme='orange'
_focus={{ boxShadow: 'none' }} onClick={clickhandler}
{...rest} _focus={{ boxShadow: 'none' }}
/> {...rest}
/>
</Tooltip>
); );
} }
@@ -6,13 +6,13 @@ export default function LockIconBtn(props) {
const { clickhandler, active, ref } = props; const { clickhandler, active, ref } = props;
return ( return (
<Tooltip label='Lock cursor to current'> <Tooltip label='Lock cursor to current'>
<IconButton <IconButton
ref={ref} ref={ref}
size={props.size || 'xs'} size={props.size || 'xs'}
icon={<FiTarget />} icon={<FiTarget />}
color={active ? 'pink.100' : 'pink.300'} color={active ? 'pink.100' : 'pink.300'}
borderColor={active ? undefined : 'pink.300'} borderColor={active ? undefined : 'pink.300'}
backgroundColor={active ? 'pink.300' : undefined} backgroundColor={active ? 'pink.400' : undefined}
variant={active ? 'solid' : 'outline'} variant={active ? 'solid' : 'outline'}
onClick={clickhandler} onClick={clickhandler}
_focus={{ boxShadow: 'none' }} _focus={{ boxShadow: 'none' }}
@@ -0,0 +1,22 @@
import { IconButton } from '@chakra-ui/button';
import { Tooltip } from '@chakra-ui/tooltip';
import { FiUsers } from 'react-icons/fi';
export default function PublicIconBtn(props) {
const { actionHandler, active, ...rest } = props;
return (
<Tooltip label={active ? 'Make event private' : 'Make event public'}>
<IconButton
size={props.size || 'xs'}
icon={<FiUsers />}
colorScheme='blue'
variant={active ? 'solid' : 'outline'}
onClick={() =>
actionHandler('update', { field: 'isPublic', value: !active })
}
_focus={{ boxShadow: 'none' }}
{...rest}
/>
</Tooltip>
);
}
@@ -1,11 +0,0 @@
import { Flex, Text } from '@chakra-ui/layout';
import styles from './NumberedText.module.css';
export default function NumberedText({ number = 1, text = '' }) {
return (
<Flex>
<div className={styles.stylednumber}>{number}</div>
<Text>{text}</Text>
</Flex>
);
}
@@ -1,13 +0,0 @@
.stylednumber {
display: inline;
text-align: center;
color: white;
font-weight: 600;
background-color: #ff5b7e;
border: 1px solid rgba(255,255,255,0.17);
width: 1.5em;
border-radius: 1em;
margin-right: 0.5em;
}
@@ -8,9 +8,12 @@
.block { .block {
display: 'block'; display: 'block';
overflow-x: hidden; overflow: hidden;
} }
.inline { .inline {
display: inline; display: inline;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
} }
+5 -19
View File
@@ -1,3 +1,4 @@
import { lazy, useEffect } from 'react'; import { lazy, useEffect } from 'react';
import { Heading } from '@chakra-ui/layout'; import { Heading } from '@chakra-ui/layout';
import { Box } from '@chakra-ui/layout'; import { Box } from '@chakra-ui/layout';
@@ -31,43 +32,28 @@ export default function Editor() {
</Box> </Box>
<Box className={styles.editor}> <Box className={styles.editor}>
<Heading size='lg' paddingBottom={'0.25em'}> <h1>Event List</h1>
Event List
</Heading>
<NumberedText number={1} text={'Manage events'} />
<div className={styles.content}> <div className={styles.content}>
<EventListWrapper /> <EventListWrapper />
</div> </div>
</Box> </Box>
<Box className={styles.messages}> <Box className={styles.messages}>
<Heading size='lg' paddingBottom={'0.25em'}> <h1>Display Messages</h1>
Display Messages
</Heading>
<NumberedText
number={3}
text={'Show realtime messages on different screens'}
/>
<div className={styles.content}> <div className={styles.content}>
<MessageControl /> <MessageControl />
</div> </div>
</Box> </Box>
<Box className={styles.playback}> <Box className={styles.playback}>
<Heading size='lg' paddingBottom={'0.25em'}> <h1>Timer Control</h1>
Time Control
</Heading>
<NumberedText number={2} text={'Control timers'} />
<div className={styles.content}> <div className={styles.content}>
<PlaybackControl /> <PlaybackControl />
</div> </div>
</Box> </Box>
<Box className={styles.info} borderRadius='0.5em' overflowX='auto'> <Box className={styles.info} borderRadius='0.5em' overflowX='auto'>
<Heading size='lg' paddingBottom={'0.25em'}> <h1>Info</h1>
Info
</Heading>
<NumberedText number={4} text={'Running Info'} />
<div className={styles.content}></div> <div className={styles.content}></div>
</Box> </Box>
</div> </div>
@@ -69,6 +69,12 @@
} }
} }
h1 {
font-size: 2.5vh;
color: rgba(255, 255, 255, 0.63);
padding-bottom: 0.25em;
}
.mainContainer > div { .mainContainer > div {
border-radius: 0.5em; border-radius: 0.5em;
height: 100%; height: 100%;
@@ -1,6 +1,6 @@
import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu'; import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu';
import { IconButton } from '@chakra-ui/button'; import { IconButton } from '@chakra-ui/button';
import { FiZap, FiPlus, FiMinusCircle, FiClock } from 'react-icons/fi'; import { FiPlus, FiMinusCircle, FiClock } from 'react-icons/fi';
export default function ActionButtons(props) { export default function ActionButtons(props) {
const { showAdd, showDelay, showBlock, actionHandler } = props; const { showAdd, showDelay, showBlock, actionHandler } = props;
@@ -16,7 +16,7 @@ export default function ActionButtons(props) {
as={IconButton} as={IconButton}
aria-label='Options' aria-label='Options'
size='xs' size='xs'
icon={<FiZap />} icon={<FiPlus />}
_expanded={{ bg: 'orange.300', color: 'white' }} _expanded={{ bg: 'orange.300', color: 'white' }}
_focus={{ boxShadow: 'none' }} _focus={{ boxShadow: 'none' }}
backgroundColor={'orange.200'} backgroundColor={'orange.200'}
@@ -6,7 +6,7 @@ import EventTimes from 'common/components/eventTimes/EventTimes';
import EventTimesVertical from 'common/components/eventTimes/EventTimesVertical'; import EventTimesVertical from 'common/components/eventTimes/EventTimesVertical';
import EditableText from 'common/input/EditableText'; import EditableText from 'common/input/EditableText';
import ActionButtons from './ActionButtons'; import ActionButtons from './ActionButtons';
import VisibleIconBtn from 'common/components/buttons/VisibleIconBtn'; import PublicIconBtn from 'common/components/buttons/PublicIconBtn';
import DeleteIconBtn from 'common/components/buttons/DeleteIconBtn'; import DeleteIconBtn from 'common/components/buttons/DeleteIconBtn';
import { millisToMinutes } from 'common/dateConfig'; import { millisToMinutes } from 'common/dateConfig';
import style from './EventBlock.module.css'; import style from './EventBlock.module.css';
@@ -93,7 +93,7 @@ const ExpandedBlock = (props) => {
onClick={() => props.setCollapsed(true)} onClick={() => props.setCollapsed(true)}
/> />
<div className={style.actionOverlay}> <div className={style.actionOverlay}>
<VisibleIconBtn actionHandler={actionHandler} active={data.isPublic} /> <PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
<ActionButtons <ActionButtons
showAdd showAdd
showDelay showDelay
@@ -146,7 +146,7 @@ const CollapsedBlock = (props) => {
onClick={() => props.setCollapsed(false)} onClick={() => props.setCollapsed(false)}
/> />
<div className={style.actionOverlay}> <div className={style.actionOverlay}>
<VisibleIconBtn actionHandler={actionHandler} active={data.isPublic} /> <PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
<ActionButtons <ActionButtons
showAdd showAdd
showDelay showDelay
@@ -152,6 +152,8 @@
font-size: 0.8em; font-size: 0.8em;
float: right; float: right;
padding-right: 1em; padding-right: 1em;
-webkit-user-select: text;
user-select: text;
} }
/* ================ MORE ================ */ /* ================ MORE ================ */
@@ -1,12 +1,6 @@
import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu'; import { Menu, MenuButton, MenuItem, MenuList } from '@chakra-ui/menu';
import { IconButton } from '@chakra-ui/button'; import { IconButton } from '@chakra-ui/button';
import { import { FiTrash2, FiPlus, FiClock, FiMinusCircle } from 'react-icons/fi';
FiTrash2,
FiZap,
FiPlus,
FiClock,
FiMinusCircle,
} from 'react-icons/fi';
import { Divider } from '@chakra-ui/layout'; import { Divider } from '@chakra-ui/layout';
export default function MenuActionButtons(props) { export default function MenuActionButtons(props) {
@@ -20,9 +14,9 @@ export default function MenuActionButtons(props) {
<Menu isLazy lazyBehavior='unmount'> <Menu isLazy lazyBehavior='unmount'>
<MenuButton <MenuButton
as={IconButton} as={IconButton}
aria-label='Options' aria-label='Create Menu'
size={props.size || 'xs'} size={props.size || 'xs'}
icon={<FiZap />} icon={<FiPlus />}
_expanded={{ bg: 'orange.300', color: 'white' }} _expanded={{ bg: 'orange.300', color: 'white' }}
_focus={{ boxShadow: 'none' }} _focus={{ boxShadow: 'none' }}
backgroundColor={'orange.200'} backgroundColor={'orange.200'}
+1 -6
View File
@@ -1,9 +1,5 @@
import { useMutation, useQueryClient } from 'react-query'; import { useMutation, useQueryClient } from 'react-query';
import { import { downloadEvents, uploadEvents } from 'app/api/ontimeApi';
downloadEvents,
uploadEvents,
uploadEventsWithPath,
} from 'app/api/ontimeApi';
import { EVENTS_TABLE } from 'app/api/apiConstants'; import { EVENTS_TABLE } from 'app/api/apiConstants';
import DownloadIconBtn from './buttons/DownloadIconBtn'; import DownloadIconBtn from './buttons/DownloadIconBtn';
import SettingsIconBtn from './buttons/SettingsIconBtn'; import SettingsIconBtn from './buttons/SettingsIconBtn';
@@ -87,7 +83,6 @@ export default function MenuBar(props) {
style={{ fontSize: '1.5em' }} style={{ fontSize: '1.5em' }}
size='lg' size='lg'
clickhandler={() => handleIPC('help')} clickhandler={() => handleIPC('help')}
disabled
/> />
<SettingsIconBtn style={{ fontSize: '1.5em' }} size='lg' disabled /> <SettingsIconBtn style={{ fontSize: '1.5em' }} size='lg' disabled />
<div className={style.gap} /> <div className={style.gap} />
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

+16 -4
View File
@@ -9,6 +9,10 @@
<title>ontime</title> <title>ontime</title>
<style> <style>
body { body {
-webkit-user-select: none;
user-select: none;
-webkit-app-region: drag;
animation: fadein 0s;
background-color: #0005; background-color: #0005;
} }
h1 { h1 {
@@ -29,10 +33,10 @@
} }
.lds-ellipsis div { .lds-ellipsis div {
position: absolute; position: absolute;
width: 13px; width: 8px;
height: 13px; height: 8px;
border-radius: 50%; border-radius: 50%;
background: #fffa; background: #ff7597aa;
animation-timing-function: cubic-bezier(0, 1, 1, 0); animation-timing-function: cubic-bezier(0, 1, 1, 0);
} }
.lds-ellipsis div:nth-child(1) { .lds-ellipsis div:nth-child(1) {
@@ -51,6 +55,14 @@
left: 56px; left: 56px;
animation: lds-ellipsis3 0.6s infinite; animation: lds-ellipsis3 0.6s infinite;
} }
@keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes lds-ellipsis1 { @keyframes lds-ellipsis1 {
0% { 0% {
transform: scale(0); transform: scale(0);
@@ -79,7 +91,7 @@
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<img src="../../assets/images/logosbwa/LOGO-192.png" /> <img src="../../assets/logo.png" />
<h1>ontime · event timers</h1> <h1>ontime · event timers</h1>
<div class="lds-ellipsis"> <div class="lds-ellipsis">
<div></div> <div></div>
+3 -1
View File
@@ -41,10 +41,12 @@ const nodePath =
// TODO: Icons appear pixelated // TODO: Icons appear pixelated
const trayIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png'); const trayIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png');
const appIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png'); const appIcon = path.join(__dirname, './assets/images/logos/LOGO-512.png');
function showNotification(text) { function showNotification(text) {
new Notification({ new Notification({
title: 'ontime', title: 'ontime',
body: text, body: text,
silent: true,
}).show(); }).show();
} }
@@ -253,6 +255,6 @@ ipcMain.on('send-to-link', (event, arg) => {
// send to help URL // send to help URL
if (arg === 'help') { if (arg === 'help') {
shell.openExternal('http://blank'); shell.openExternal('https://cpvalente.gitbook.io/ontime/');
} }
}); });
+5 -3
View File
@@ -27,18 +27,20 @@
"dist-win": "electron-builder --publish=never --x64 --win", "dist-win": "electron-builder --publish=never --x64 --win",
"dist-mac": "electron-builder --publish=never --x64 --mac", "dist-mac": "electron-builder --publish=never --x64 --mac",
"dist-all": "electron-builder -mw"
"startall": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\""
}, },
"build": { "build": {
"productName": "ontime", "productName": "ontime",
"appId": "no.lightdev.ontime", "appId": "no.lightdev.ontime",
"asar": true, "asar": true,
"dmg": { "dmg": {
"artifactName": "ontime-macOS.dmg",
"icon": "icon.icns"
}, },
"mac": { "mac": {
"target": "dmg", "target": "dmg",
"category": "no.lightdev.ontime" "category": "public.app-category.productivity",
"icon": "icon.icns"
}, },
"win": { "win": {
"target": "nsis" "target": "nsis"