Skip to content

Commit f9fb3b2

Browse files
authored
Merge pull request #20 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 40996cf + 0cb7543 commit f9fb3b2

4 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/components/CippComponents/CippAddTestReportDrawer.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ export const CippAddTestReportDrawer = ({
261261
label="Name"
262262
name="name"
263263
formControl={formControl}
264-
validators={{ required: 'Name is required' }}
264+
validators={{
265+
required: 'Name is required',
266+
maxLength: { value: 256, message: 'Name must be 256 characters or fewer' },
267+
}}
265268
/>
266269
</Grid>
267270
<Grid size={12}>

src/components/CippComponents/CippAlertSnoozeDialog.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const SNOOZE_OPTIONS = [
1919
{ value: '7', label: 'Snooze for 7 days' },
2020
{ value: '14', label: 'Snooze for 14 days' },
2121
{ value: '30', label: 'Snooze for 30 days' },
22-
{ value: '-1', label: 'Snooze forever' },
2322
]
2423

2524
export const CippAlertSnoozeDialog = ({

src/components/ReportBuilder/ReportBuilderPDF.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const createStyles = (brandColor) =>
5252
alignSelf: 'flex-start',
5353
},
5454
mainTitle: {
55-
fontSize: 48,
5655
fontWeight: 'bold',
5756
color: '#1A202C',
5857
lineHeight: 1.1,
@@ -130,6 +129,8 @@ const createStyles = (brandColor) =>
130129
fontWeight: 'bold',
131130
color: '#1A202C',
132131
marginBottom: 8,
132+
paddingTop: 4,
133+
paddingBottom: 4,
133134
},
134135
pageSubtitle: { fontSize: 11, color: '#4A5568', fontWeight: 'normal' },
135136
headerLogo: { height: 30 },
@@ -143,6 +144,8 @@ const createStyles = (brandColor) =>
143144
fontWeight: 'bold',
144145
color: brandColor,
145146
marginBottom: 12,
147+
paddingTop: 4,
148+
paddingBottom: 4,
146149
pageBreakAfter: 'avoid',
147150
breakAfter: 'avoid',
148151
orphans: 3,
@@ -261,20 +264,26 @@ const createStyles = (brandColor) =>
261264
color: '#1A202C',
262265
marginTop: 10,
263266
marginBottom: 6,
267+
paddingTop: 4,
268+
paddingBottom: 2,
264269
},
265270
heading2: {
266271
fontSize: 14,
267272
fontWeight: 'bold',
268273
color: brandColor,
269274
marginTop: 8,
270275
marginBottom: 5,
276+
paddingTop: 4,
277+
paddingBottom: 2,
271278
},
272279
heading3: {
273280
fontSize: 12,
274281
fontWeight: 'bold',
275282
color: '#2D3748',
276283
marginTop: 6,
277284
marginBottom: 4,
285+
paddingTop: 3,
286+
paddingBottom: 2,
278287
},
279288

280289
/* ── Code ──────────────────────────────────────────── */
@@ -616,6 +625,10 @@ export const ReportBuilderDocument = ({
616625
const reportName = templateName || 'Report'
617626
const safeBlocks = blocks || []
618627

628+
// Dynamic cover title: shrink font for long names, truncate beyond 50 chars
629+
const coverTitle = reportName.length > 50 ? reportName.slice(0, 47) + '...' : reportName
630+
const coverTitleFontSize = coverTitle.length <= 20 ? 48 : coverTitle.length <= 35 ? 36 : 28
631+
619632
return (
620633
<Document>
621634
{/* ── Cover Page ── */}
@@ -631,13 +644,13 @@ export const ReportBuilderDocument = ({
631644

632645
<View style={s.coverHero}>
633646
<Text style={s.coverLabel}>ASSESSMENT REPORT</Text>
634-
<Text style={s.mainTitle}>
635-
{reportName.toUpperCase().split(' ').slice(0, -1).join(' ') || reportName.toUpperCase()}
636-
{reportName.split(' ').length > 1 ? (
647+
<Text style={{ ...s.mainTitle, fontSize: coverTitleFontSize }}>
648+
{coverTitle.toUpperCase().split(' ').slice(0, -1).join(' ') || coverTitle.toUpperCase()}
649+
{coverTitle.split(' ').length > 1 ? (
637650
<>
638651
{'\n'}
639652
<Text style={s.titleAccent}>
640-
{reportName.toUpperCase().split(' ').slice(-1)[0]}
653+
{coverTitle.toUpperCase().split(' ').slice(-1)[0]}
641654
</Text>
642655
</>
643656
) : null}

src/pages/tools/report-builder/builder/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,10 @@ const Page = () => {
15321532
name="templateName"
15331533
label="Template Name"
15341534
formControl={saveForm}
1535-
validators={{ required: 'Template name is required' }}
1535+
validators={{
1536+
required: 'Template name is required',
1537+
maxLength: { value: 256, message: 'Template name must be 256 characters or fewer' },
1538+
}}
15361539
/>
15371540
<CippApiResults apiObject={saveTemplateCall} />
15381541
</Stack>

0 commit comments

Comments
 (0)