File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/pages/Insights/InsightsDrawer Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import { useParams } from 'react-router-dom';
2323import { getColorWithAlpha } from 'src/common/utils' ;
2424import { useEffect , useState } from 'react' ;
2525import { styled } from 'styled-components' ;
26+ import { Divider } from 'src/common/components/divider' ;
2627import { InsightFormValues } from '../FormProvider' ;
2728import { RadioTag } from '../../Video/components/ObservationForm' ;
2829import { ObservationCard } from '../Collection/ObservationCard' ;
@@ -60,6 +61,7 @@ const InsightForm = () => {
6061 return (
6162 < FormContainer >
6263 < XL isBold > { t ( '__INSIGHTS_PAGE_INSIGHT_FORM_TITLE' ) } </ XL >
64+ < Divider />
6365 < div >
6466 < Label > { t ( '__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_TITLE_LABEL' ) } </ Label >
6567 < Field name = "title" >
@@ -189,6 +191,7 @@ const InsightForm = () => {
189191 ) ) }
190192 </ div >
191193 </ div >
194+ < Divider />
192195 < div >
193196 < Label >
194197 { t ( '__INSIGHTS_PAGE_INSIGHT_FORM_FIELD_OBSERVATIONS_LABEL' ) }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { ReactComponent as InsightIcon } from '@zendeskgarden/svg-icons/src/16/l
1515import { ReactComponent as EmptyInsights } from 'src/assets/empty-insights.svg' ;
1616import { useParams } from 'react-router-dom' ;
1717import { Divider } from 'src/common/components/divider' ;
18- import { useMemo } from 'react' ;
18+ import { useEffect , useMemo , useRef } from 'react' ;
1919import { Insight } from './InsightAccordion' ;
2020import { InsightFormValues } from '../FormProvider' ;
2121import { InsightForm } from './InsightForm' ;
@@ -51,6 +51,8 @@ const InsightsDrawer = () => {
5151 const { campaignId } = useParams ( ) ;
5252 const { values } = useFormikContext < InsightFormValues > ( ) ;
5353 const { t } = useTranslation ( ) ;
54+ const ref = useRef < HTMLDivElement > ( null ) ;
55+
5456 const {
5557 data : insights ,
5658 isFetching,
@@ -65,10 +67,17 @@ const InsightsDrawer = () => {
6567 [ insights ]
6668 ) ;
6769
70+ // Reset drawer scroll on editing mode change
71+ useEffect ( ( ) => {
72+ if ( ref . current ) {
73+ ref . current . scrollTop = 0 ;
74+ }
75+ } , [ values . id ] ) ;
76+
6877 if ( isLoading || isError ) return < Skeleton /> ;
6978
7079 return (
71- < DetailContainer >
80+ < DetailContainer ref = { ref } >
7281 < div
7382 style = { { paddingTop : appTheme . space . xs , opacity : isFetching ? 0.5 : 1 } }
7483 >
You can’t perform that action at this time.
0 commit comments