Skip to content

Commit

Permalink
refactored #1 issue fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kholmogorov27 committed Mar 9, 2023
1 parent 089a65e commit bf92e7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function App() {
const inputRef = useRef(null)

const [showSettings, setShowSettings] = useState(false)
const [showReset, setShowReset] = useState(false)

/* handlers */
const onContextMenuRef = useRef(null)
Expand Down Expand Up @@ -106,7 +107,7 @@ function App() {
handleVisibilityChange.current = () => {
// reset store if user went back from a redirected page
if (document.visibilityState === 'visible' && redirected)
resetStore()
setShowReset(true)
}
useEffect(() => {
document.addEventListener('visibilitychange', () => handleVisibilityChange.current())
Expand Down Expand Up @@ -150,6 +151,9 @@ function App() {
mode === 'opened' && <BsChevronRight/>
}
</LayoutButton>
{
showReset && <div className={classes['cancel-button']} onClick={() => location.reload()}>Cancel</div>
}
</motion.div>
}
</AnimatePresence>
Expand Down
15 changes: 15 additions & 0 deletions src/App.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@
.ignore-mobile-button {
text-decoration: underline;
cursor: pointer;
}

.cancel-button {
position: absolute;
left: 50%;
bottom: 1em;
transform: translateX(-50%);
z-index: 10000;
cursor: pointer;
font-size: x-large;
padding: .5em 1em;
border-radius: 1em;
border: 5px solid var(--primary);
background: var(--secondary);
color: var(--primary);
}

0 comments on commit bf92e7d

Please sign in to comment.