Skip to content

Commit

Permalink
Temporarily removing photo metadata hotkey as it interferes with addi…
Browse files Browse the repository at this point in the history
…ng tags
  • Loading branch information
damianmoore committed Mar 21, 2021
1 parent fb47748 commit ac165b2
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions ui/src/components/PhotoDetail.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useState } from 'react'
import styled from '@emotion/styled'
import useLocalStorageState from 'use-local-storage-state'

Expand All @@ -10,7 +10,7 @@ import { ReactComponent as ArrowBackIcon } from '../static/images/arrow_back.svg
import { ReactComponent as InfoIcon } from '../static/images/info.svg'
import { ReactComponent as CloseIcon } from '../static/images/close.svg'

const I_KEY = 73
// const I_KEY = 73

const Container = styled('div')`
width: 100vw;
Expand Down Expand Up @@ -70,23 +70,24 @@ const PhotoDetail = ({ photoId, photo, refetch }) => {
)
const [showMetadata, setShowMetadata] = useState(false)

useEffect(() => {
const handleKeyDown = (event) => {
switch (event.keyCode) {
case I_KEY:
setShowMetadata(!showMetadata)
break
default:
break
}
}
// TODO: Bring this back so it doesn't get triggered by someone adding a tag with 'i' in it
// useEffect(() => {
// const handleKeyDown = (event) => {
// switch (event.keyCode) {
// case I_KEY:
// setShowMetadata(!showMetadata)
// break
// default:
// break
// }
// }

document.addEventListener('keydown', handleKeyDown)
// document.addEventListener('keydown', handleKeyDown)

return () => {
document.removeEventListener('keydown', handleKeyDown)
}
}, [showMetadata])
// return () => {
// document.removeEventListener('keydown', handleKeyDown)
// }
// }, [showMetadata])

let boxes = photo?.objectTags.map((objectTag) => {
return {
Expand Down Expand Up @@ -124,15 +125,15 @@ const PhotoDetail = ({ photoId, photo, refetch }) => {
height="30"
width="30"
onClick={() => setShowMetadata(!showMetadata)}
title="Press [I] key to show/hide photo details"
// title="Press [I] key to show/hide photo details"
/>
) : (
<CloseIcon
className="showDetailIcon"
height="30"
width="30"
onClick={() => setShowMetadata(!showMetadata)}
title="Press [I] key to show/hide photo details"
// title="Press [I] key to show/hide photo details"
/>
)}
</Container>
Expand Down

0 comments on commit ac165b2

Please sign in to comment.