modified
components/HotKeysMapping.js
@@ -4,7 +4,8 @@ import { HotKeys, configure } from "react-hotkeys";import { Context } from "../components/context";configure({ ignoreTags: [] ignoreTags: [], logLevel: 'debug'});const keyMap = {
@@ -18,7 +19,7 @@ const keyMap = { LOG_PREVIOUS: "ArrowUp", LOG_EDIT: "alt+e", LOG_DELETE_SINGLE: "alt+d", SUBMIT_LOG: "Enter" SUBMIT_LOG: ["Enter", "alt+s"],};const HotKeysMapping = props => {
modified
components/entry.js
@@ -14,7 +14,10 @@ const Entry = ({ entry, removeEntry, isSelected }) => { useEffect(() => { if (isSelected == entry.id) focusedEntry.current.scrollIntoView({ behavior: "smooth" }); { focusedEntry.current.focus(); focusedEntry.current.scrollIntoView({ behavior: "smooth" }); } }); const onSubmit = () => { dispatch({ type: "LOG_EDIT_TOGLE", edit: false });
modified
components/timer.js
@@ -1,4 +1,4 @@import React, { useState, useEffect, useContext } from "react";import React, { useState, useEffect, useContext, useRef } from "react";import styled from "styled-components";import { Context } from "./context";
@@ -8,6 +8,7 @@ import { timeString, timeDiff } from "../utils/time";const Timer = () => { const { state, dispatch } = useContext(Context); const [time, setTime] = useState(timeString(timeDiff(state.timer))); const refToMain = useRef(null); strings.setLanguage(state.language);
@@ -24,6 +25,10 @@ const Timer = () => { }; }, [state.timer]); useEffect(() => { refToMain.current.focus(); }); const submitForm = e => { e.preventDefault(); dispatch({ type: "ADD_LOG", note: state.note });
@@ -40,7 +45,7 @@ const Timer = () => { aria-label={strings.note} placeholder={strings.note} value={state.note || ''} autoFocus ref={refToMain} onChange={e => dispatch({type:"NOTE_UPDATED", note:e.target.value})} /> </Inputs>
@@ -1,4 +1,4 @@import React, { useContext } from "react";import React, { useContext, useEffect, useRef } from "react";import styled, { keyframes } from "styled-components";import Page from "../components/page";
@@ -7,8 +7,12 @@ import strings from "../l10n/about";const About = () => { const { state } = useContext(Context); const refToMain = useRef(null); strings.setLanguage(state.language); useEffect(() => { refToMain.current.focus(); }); return ( <Page title="About"> <GitHubLink
@@ -26,6 +30,7 @@ const About = () => { href="https://www.isaacbythewood.com/" target="_blank" rel="noopener noreferrer" ref={refToMain} > {strings.name} </Creator>
@@ -15,7 +15,8 @@ const Log = () => { const refToMain = useRef(null); useEffect(() => { if (!state.edit && state.logSelectedEntry) refToMain.current.focus(); // focus Main in case nothing selected if (!state.edit && state.logSelectedEntry==='') refToMain.current.focus(); }); strings.setLanguage(state.language);
@@ -82,8 +83,8 @@ const Log = () => { className={ getVisibleEntries(state.log, filter).length === 0 && "empty" } tabIndex="1" ref={refToMain} tabIndex="1" ref={refToMain} > {getTags(state.log).length > 0 && ( <TopBar>