File tree Expand file tree Collapse file tree
src/components/entry/overview Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,18 +5,27 @@ import { useSelector } from 'react-redux'
55
66import { ReportModal } from '../../form/ReportModal'
77import Button from '../../ui/Button'
8+ import useLocationPane from '../useLocationPane'
89
910export const ReportButton = ( ) => {
1011 const { location : locationData } = useSelector ( ( state ) => state . location )
1112 const { t } = useTranslation ( )
1213 const typesAccess = useSelector ( ( state ) => state . type . typesAccess )
14+ const { drawerFullyOpen, fullyOpenPaneDrawer } = useLocationPane ( )
1315
1416 const locationName = locationData ?. type_ids
1517 . map ( ( id ) => typesAccess ?. getType ( id ) ?. commonName )
1618 . filter ( Boolean )
1719 . join ( ', ' )
1820 const [ isReportModalOpen , setIsReportModalOpen ] = useState ( false )
1921
22+ const handleReportClick = ( ) => {
23+ if ( ! drawerFullyOpen ) {
24+ fullyOpenPaneDrawer ( )
25+ }
26+ setIsReportModalOpen ( true )
27+ }
28+
2029 return (
2130 < >
2231 { isReportModalOpen && (
@@ -27,11 +36,7 @@ export const ReportButton = () => {
2736 onDismiss = { ( ) => setIsReportModalOpen ( false ) }
2837 />
2938 ) }
30- < Button
31- leftIcon = { < Flag /> }
32- secondary
33- onClick = { ( ) => setIsReportModalOpen ( true ) }
34- >
39+ < Button leftIcon = { < Flag /> } secondary onClick = { handleReportClick } >
3540 { t ( 'form.button.report' ) }
3641 </ Button >
3742 </ >
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
1515import Button from '../../ui/Button'
1616import { theme } from '../../ui/GlobalStyle'
1717import Input from '../../ui/Input'
18+ import useLocationPane from '../useLocationPane'
1819import useSavedLists from './useSavedLists'
1920
2021const SkeletonItemRow = styled . div `
@@ -170,6 +171,7 @@ const SaveToListButton = ({ containerRef }) => {
170171 const addingNewSkeletonRef = useRef ( null )
171172
172173 const { lists } = useSavedLists ( locationId )
174+ const { drawerFullyOpen, fullyOpenPaneDrawer } = useLocationPane ( )
173175
174176 useEffect ( ( ) => {
175177 const handleClickOutside = ( e ) => {
@@ -212,6 +214,9 @@ const SaveToListButton = ({ containerRef }) => {
212214 } , [ isAddingNew ] )
213215
214216 const handleButtonClick = ( ) => {
217+ if ( ! drawerFullyOpen ) {
218+ fullyOpenPaneDrawer ( )
219+ }
215220 if ( ! open ) {
216221 dispatch ( fetchLists ( ) )
217222 }
You can’t perform that action at this time.
0 commit comments