• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DLR-SC / ESID / 16418551684

21 Jul 2025 01:37PM UTC coverage: 6.386% (-47.7%) from 54.09%
16418551684

Pull #414

github

fifth-island
fix: Add missing license file for pdf.js worker
Pull Request #414: feat: Implement basic article search feature

411 of 532 branches covered (77.26%)

Branch coverage included in aggregate %.

213 of 61424 new or added lines in 13 files covered. (0.35%)

136 existing lines in 7 files now uncovered.

4041 of 69186 relevant lines covered (5.84%)

0.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

22.58
/src/components/OnboardingComponents/SemanticSearch/ArticleDialog.tsx
1
// SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
2
// SPDX-License-Identifier: Apache-2.0
3

4
import React, {useState} from 'react';
1✔
5
import {Dialog, DialogTitle, DialogContent, IconButton, Typography, Box, Button, CircularProgress} from '@mui/material';
1✔
6
import CloseIcon from '@mui/icons-material/Close';
1✔
7
import {SearchResult} from 'types/semanticSearch';
8
import {Document, Page, pdfjs} from 'react-pdf';
1✔
9
import 'react-pdf/dist/Page/AnnotationLayer.css';
1✔
10
import 'react-pdf/dist/Page/TextLayer.css';
1✔
11

12
pdfjs.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs';
1✔
13

14
interface ArticleDialogProps {
15
  open: boolean;
16
  onClose: () => void;
17
  article: SearchResult | null;
18
}
19

20
/**
21
 * A dialog component to display the full content of a selected search result article.
22
 */
23
export default function ArticleDialog({open, onClose, article}: ArticleDialogProps): JSX.Element {
5✔
24
  const [numPages, setNumPages] = useState<number>(0);
5✔
25
  const [pageNumber, setPageNumber] = useState(1);
5✔
26

27
  if (!article) {
5✔
28
    return <></>;
5✔
29
  }
5!
30

NEW
31
  function onDocumentLoadSuccess({numPages: nextNumPages}: {numPages: number}) {
×
NEW
32
    setNumPages(nextNumPages);
×
NEW
33
  }
×
34

NEW
35
  function goToNextPage() {
×
NEW
36
    setPageNumber((prevPageNumber) => Math.min(prevPageNumber + 1, numPages));
×
NEW
37
  }
×
38

NEW
39
  function goToPreviousPage() {
×
NEW
40
    setPageNumber((prevPageNumber) => Math.max(prevPageNumber - 1, 1));
×
NEW
41
  }
×
42

NEW
43
  return (
×
NEW
44
    <Dialog open={open} onClose={onClose} maxWidth='md' fullWidth scroll='paper'>
×
NEW
45
      <DialogTitle sx={{m: 0, p: 6, pb: 5}}>
×
NEW
46
        <Typography variant='h2' sx={{pr: '2rem'}}>
×
NEW
47
          {article.title}
×
NEW
48
        </Typography>
×
NEW
49
        <IconButton
×
NEW
50
          aria-label='close'
×
NEW
51
          onClick={onClose}
×
NEW
52
          sx={{
×
NEW
53
            position: 'absolute',
×
NEW
54
            right: 8,
×
NEW
55
            top: 8,
×
NEW
56
            color: (theme) => theme.palette.grey[500],
×
NEW
57
          }}
×
58
        >
NEW
59
          <CloseIcon />
×
NEW
60
        </IconButton>
×
NEW
61
      </DialogTitle>
×
NEW
62
      <DialogContent dividers sx={{display: 'flex', flexDirection: 'column', alignItems: 'center', p: 1}}>
×
NEW
63
        <Document
×
NEW
64
          file={article.hyperlink}
×
NEW
65
          onLoadSuccess={onDocumentLoadSuccess}
×
NEW
66
          loading={<CircularProgress />}
×
NEW
67
          error='Failed to load PDF file.'
×
68
        >
NEW
69
          <Page pageNumber={pageNumber} />
×
NEW
70
        </Document>
×
NEW
71
      </DialogContent>
×
NEW
72
      <Box sx={{display: 'flex', justifyContent: 'center', alignItems: 'center', p: 1, gap: 2}}>
×
NEW
73
        <Button onClick={goToPreviousPage} disabled={pageNumber <= 1}>
×
74
          Previous
NEW
75
        </Button>
×
NEW
76
        <Typography>
×
NEW
77
          Page {pageNumber} of {numPages}
×
NEW
78
        </Typography>
×
NEW
79
        <Button onClick={goToNextPage} disabled={pageNumber >= numPages}>
×
80
          Next
NEW
81
        </Button>
×
NEW
82
      </Box>
×
NEW
83
    </Dialog>
×
84
  );
NEW
85
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc