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

IQSS / dataverse-frontend / 14227773064

02 Apr 2025 07:18PM UTC coverage: 97.467% (-0.6%) from 98.075%
14227773064

push

github

GPortas
Added: explanatory comment to port mapping of dev_dataverse and removed redundant param

2652 of 2775 branches covered (95.57%)

Branch coverage included in aggregate %.

6006 of 6108 relevant lines covered (98.33%)

13660.16 hits per line

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

90.0
/src/sections/layout/header/Header.tsx
1
import { useContext } from 'react'
2
import { AuthContext } from 'react-oauth2-code-pkce'
3
import { useLocation } from 'react-router-dom'
4
import { useTranslation } from 'react-i18next'
5
import { Button, Navbar } from '@iqss/dataverse-design-system'
6
import dataverse_logo from '@/assets/dataverse_brand_icon.svg'
7
import { Route } from '@/sections/Route.enum'
8
import { useSession } from '@/sections/session/SessionContext'
9
import { LoggedInHeaderActions } from './LoggedInHeaderActions'
10
import { CollectionRepository } from '@/collection/domain/repositories/CollectionRepository'
11
import { encodeReturnToPathInStateQueryParam } from '@/sections/auth-callback/AuthCallback'
12
import styles from './Header.module.scss'
13

14
interface HeaderProps {
387✔
15
  collectionRepository: CollectionRepository
387✔
16
}
60✔
17
export function Header({ collectionRepository }: HeaderProps) {
244✔
18
  const { t } = useTranslation('header')
85✔
19
  const { user } = useSession()
25✔
20
  const { pathname, search } = useLocation()
25✔
21

22
  const { logIn: oidcLogin } = useContext(AuthContext)
25✔
23

24
  const handleOidcLogIn = () => {
25✔
25
    const state = encodeReturnToPathInStateQueryParam(`${pathname}${search}`)
×
26

60✔
27
    oidcLogin(state)
×
28
  }
29

30
  return (
25✔
31
    <Navbar
32
      brand={{
33
        title: t('brandTitle'),
34
        href: `/spa${Route.HOME}`,
35
        logoImgSrc: dataverse_logo
36
      }}
118✔
37
      className={styles.navbar}>
38
      {user ? (
25✔
39
        <LoggedInHeaderActions user={user} collectionRepository={collectionRepository} />
40
      ) : (
41
        <Button
42
          onClick={handleOidcLogIn}
43
          variant="link"
44
          className={styles['login-btn']}
45
          data-testid="oidc-login">
46
          {t('logIn')}
47
        </Button>
48
      )}
49
    </Navbar>
50
  )
51
}
9✔
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