Skip to content

Commit 0f52b2c

Browse files
authored
Merge pull request #340 from AppQuality/fix-nav-scroll
fix(campaign): Scroll to title on navigation
2 parents bd19ad7 + 75ad186 commit 0f52b2c

File tree

3 files changed

+88
-80
lines changed

3 files changed

+88
-80
lines changed

src/pages/Campaign/ReportRow.tsx

Lines changed: 84 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -85,85 +85,93 @@ export const ReportRow = ({
8585
const { id: campaignId, customer_title } = campaign;
8686

8787
return (
88-
<Row id="reports" style={{ marginBottom: theme.space.xxl }}>
89-
{(reports && reports.length) || isFunctional ? (
90-
<Col xs={12}>
91-
<SectionTitle
92-
title={t('__CAMPAIGN_PAGE_REPORTS_TITLE')}
93-
subtitle={t('__CAMPAIGN_PAGE_REPORTS_DESCRIPTION')}
94-
/>
95-
</Col>
96-
) : null}
97-
{isFunctional && (
98-
<Col xs={12} md={4} lg={3}>
99-
<BugsReportCard campaignId={campaignId} title={customer_title} />
100-
</Col>
101-
)}
102-
{reports && reports.length
103-
? reports.map((report) => (
104-
<Col xs={12} md={4} lg={3}>
105-
<SpecialCard>
106-
<SpecialCard.Meta
107-
justifyContent="start"
108-
style={{ fontSize: theme.fontSizes.sm }}
109-
>
110-
{report.update_date ? (
111-
<>
112-
{t('__CAMPAIGN_PAGE_REPORTS_CARDS_UPDATED_ON_LABEL')}{' '}
113-
{format(new Date(report.update_date), 'dd/MM/yyyy')}
114-
</>
115-
) : (
116-
<>
117-
{t('__CAMPAIGN_PAGE_REPORTS_CARDS_UPLOADED_ON_LABEL')}{' '}
118-
{format(
119-
new Date(report.creation_date ?? ''),
120-
'dd/MM/yyyy'
121-
)}
122-
</>
123-
)}
124-
</SpecialCard.Meta>
88+
<div style={{ minHeight: '100vh' }}>
89+
<Row id="reports">
90+
{(reports && reports.length) || isFunctional ? (
91+
<Col xs={12}>
92+
<SectionTitle
93+
title={t('__CAMPAIGN_PAGE_REPORTS_TITLE')}
94+
subtitle={t('__CAMPAIGN_PAGE_REPORTS_DESCRIPTION')}
95+
/>
96+
</Col>
97+
) : null}
98+
{isFunctional && (
99+
<Col xs={12} md={4} lg={3}>
100+
<BugsReportCard campaignId={campaignId} title={customer_title} />
101+
</Col>
102+
)}
103+
{reports && reports.length
104+
? reports.map((report) => (
105+
<Col xs={12} md={4} lg={3}>
106+
<SpecialCard>
107+
<SpecialCard.Meta
108+
justifyContent="start"
109+
style={{ fontSize: theme.fontSizes.sm }}
110+
>
111+
{report.update_date ? (
112+
<>
113+
{t('__CAMPAIGN_PAGE_REPORTS_CARDS_UPDATED_ON_LABEL')}{' '}
114+
{format(new Date(report.update_date), 'dd/MM/yyyy')}
115+
</>
116+
) : (
117+
<>
118+
{t('__CAMPAIGN_PAGE_REPORTS_CARDS_UPLOADED_ON_LABEL')}{' '}
119+
{format(
120+
new Date(report.creation_date ?? ''),
121+
'dd/MM/yyyy'
122+
)}
123+
</>
124+
)}
125+
</SpecialCard.Meta>
125126

126-
<SpecialCard.Thumb>
127-
{getFileTypeIcon(report.file_type?.type ?? '', report.url)}
128-
</SpecialCard.Thumb>
127+
<SpecialCard.Thumb>
128+
{getFileTypeIcon(report.file_type?.type ?? '', report.url)}
129+
</SpecialCard.Thumb>
129130

130-
<SpecialCard.Header>
131-
<SpecialCard.Header.Label>
132-
{getFileTypeName(report.file_type?.type ?? '', report.url)}
133-
</SpecialCard.Header.Label>
134-
<SpecialCard.Header.Title>
135-
{report.title}
136-
</SpecialCard.Header.Title>
137-
</SpecialCard.Header>
131+
<SpecialCard.Header>
132+
<SpecialCard.Header.Label>
133+
{getFileTypeName(
134+
report.file_type?.type ?? '',
135+
report.url
136+
)}
137+
</SpecialCard.Header.Label>
138+
<SpecialCard.Header.Title>
139+
{report.title}
140+
</SpecialCard.Header.Title>
141+
</SpecialCard.Header>
138142

139-
<SpecialCard.Footer direction="column" justifyContent="center">
140-
<Button
141-
className={`report-btn report-btn-${
142-
report.file_type?.type === 'link' ? 'link' : 'download'
143-
} report-btn-${report.file_type?.type ?? ''}`}
144-
isPill
145-
isStretched
146-
onClick={() => {
147-
// eslint-disable-next-line security/detect-non-literal-fs-filename
148-
window.open(report.url || '', '_blank');
149-
}}
143+
<SpecialCard.Footer
144+
direction="column"
145+
justifyContent="center"
150146
>
151-
<Button.StartIcon>
152-
{report.file_type?.type === 'link' ? (
153-
<OpenLinkIcon />
154-
) : (
155-
<DownloadIcon />
156-
)}
157-
</Button.StartIcon>
158-
{report.file_type?.type === 'link'
159-
? t('__CAMPAIGN_PAGE_REPORTS_CARDS_OPEN_LINK_LABEL')
160-
: t('__CAMPAIGN_PAGE_REPORTS_CARDS_DOWNLOAD_LABEL')}
161-
</Button>
162-
</SpecialCard.Footer>
163-
</SpecialCard>
164-
</Col>
165-
))
166-
: null}
167-
</Row>
147+
<Button
148+
className={`report-btn report-btn-${
149+
report.file_type?.type === 'link' ? 'link' : 'download'
150+
} report-btn-${report.file_type?.type ?? ''}`}
151+
isPill
152+
isStretched
153+
onClick={() => {
154+
// eslint-disable-next-line security/detect-non-literal-fs-filename
155+
window.open(report.url || '', '_blank');
156+
}}
157+
>
158+
<Button.StartIcon>
159+
{report.file_type?.type === 'link' ? (
160+
<OpenLinkIcon />
161+
) : (
162+
<DownloadIcon />
163+
)}
164+
</Button.StartIcon>
165+
{report.file_type?.type === 'link'
166+
? t('__CAMPAIGN_PAGE_REPORTS_CARDS_OPEN_LINK_LABEL')
167+
: t('__CAMPAIGN_PAGE_REPORTS_CARDS_DOWNLOAD_LABEL')}
168+
</Button>
169+
</SpecialCard.Footer>
170+
</SpecialCard>
171+
</Col>
172+
))
173+
: null}
174+
</Row>
175+
</div>
168176
);
169177
};

src/pages/Campaign/navigation/bugs/Navigation.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const BugsNavigation = ({ containerId }: { containerId?: string }) => {
1616
spy
1717
smooth
1818
duration={500}
19-
offset={-350}
19+
offset={-30}
2020
>
2121
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OVERVIEW_LABEL')}
2222
</StickyNavItem>
@@ -30,7 +30,7 @@ export const BugsNavigation = ({ containerId }: { containerId?: string }) => {
3030
spy
3131
smooth
3232
duration={500}
33-
offset={-350}
33+
offset={-30}
3434
>
3535
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_DETAILS_UNIQUE_BUGS_LABEL')}
3636
</StickyNavItem>
@@ -41,7 +41,7 @@ export const BugsNavigation = ({ containerId }: { containerId?: string }) => {
4141
spy
4242
smooth
4343
duration={500}
44-
offset={-350}
44+
offset={-30}
4545
>
4646
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_DETAILS_DEVICES_LABEL')}
4747
</StickyNavItem>

src/pages/Campaign/navigation/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const Navigation = ({
3939
spy
4040
smooth
4141
duration={500}
42-
offset={-350}
42+
offset={-30}
4343
>
4444
{t('__CAMPAIGN_PAGE_NAVIGATION_BUG_ITEM_OTHER_REPORTS_LABEL')}
4545
</StickyNavItem>

0 commit comments

Comments
 (0)