fix: Migrate code to next 13 breaking changes

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2022-12-09 19:35:40 +01:00
parent dae099dfa8
commit f89b28969f
10 changed files with 55 additions and 66 deletions

View file

@ -36,7 +36,7 @@ describe('When logged-out ', () => {
type: AuthProviderType.LOCAL type: AuthProviderType.LOCAL
} }
]) ])
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login') cy.getByCypressId('sign-in-button').should('be.visible').parent().should('have.attr', 'href', '/login')
}) })
it('sign-in button points to login route: ldap', () => { it('sign-in button points to login route: ldap', () => {
@ -47,7 +47,7 @@ describe('When logged-out ', () => {
providerName: 'cy LDAP' providerName: 'cy LDAP'
} }
]) ])
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login') cy.getByCypressId('sign-in-button').should('be.visible').parent().should('have.attr', 'href', '/login')
}) })
}) })
@ -60,6 +60,7 @@ describe('When logged-out ', () => {
]) ])
cy.getByCypressId('sign-in-button') cy.getByCypressId('sign-in-button')
.should('be.visible') .should('be.visible')
.parent()
// The absolute URL is used because it is defined as API base URL absolute. // The absolute URL is used because it is defined as API base URL absolute.
.should('have.attr', 'href', '/auth/github') .should('have.attr', 'href', '/auth/github')
}) })
@ -75,7 +76,7 @@ describe('When logged-out ', () => {
type: AuthProviderType.GOOGLE type: AuthProviderType.GOOGLE
} }
]) ])
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login') cy.getByCypressId('sign-in-button').should('be.visible').parent().should('have.attr', 'href', '/login')
}) })
}) })
@ -89,7 +90,7 @@ describe('When logged-out ', () => {
type: AuthProviderType.LOCAL type: AuthProviderType.LOCAL
} }
]) ])
cy.getByCypressId('sign-in-button').should('be.visible').should('have.attr', 'href', '/login') cy.getByCypressId('sign-in-button').should('be.visible').parent().should('have.attr', 'href', '/login')
}) })
}) })
}) })

View file

@ -86,6 +86,7 @@ const rawNextConfig = {
]) ])
}, },
output: 'standalone', output: 'standalone',
swcMinify: false, //Otherwise emoji picker is minified incorrectly
experimental: { experimental: {
outputFileTracingRoot: path.join(__dirname, '../') outputFileTracingRoot: path.join(__dirname, '../')
} }

View file

@ -30,14 +30,12 @@ export const InternalLink: React.FC<LinkWithTextProps> = ({
title title
}) => { }) => {
return ( return (
<Link href={href}> <Link href={href} className={className} id={id} title={title}>
<a className={className} id={id} title={title}> <ShowIf condition={!!icon}>
<ShowIf condition={!!icon}> <ForkAwesomeIcon icon={icon as IconName} fixedWidth={true} />
<ForkAwesomeIcon icon={icon as IconName} fixedWidth={true} /> &nbsp;
&nbsp; </ShowIf>
</ShowIf> {text}
{text}
</a>
</Link> </Link>
) )
} }

View file

@ -31,10 +31,7 @@ export const Redirect: React.FC<RedirectProps> = ({ to }) => {
return ( return (
<span {...testId('redirect')}> <span {...testId('redirect')}>
Redirecting to{' '} Redirecting to <Link href={to}>{to}</Link>
<Link href={to}>
<a>{to}</a>
</Link>
</span> </span>
) )
} }

View file

@ -22,14 +22,12 @@ export const NavbarBranding: React.FC = () => {
return ( return (
<Navbar.Brand> <Navbar.Brand>
<Link href='/intro'> <Link href='/intro' className='text-secondary text-decoration-none d-flex align-items-center'>
<a className='text-secondary text-decoration-none d-flex align-items-center'> <HedgeDocLogoWithText
<HedgeDocLogoWithText logoType={darkModeActivated ? HedgeDocLogoType.WB_HORIZONTAL : HedgeDocLogoType.BW_HORIZONTAL}
logoType={darkModeActivated ? HedgeDocLogoType.WB_HORIZONTAL : HedgeDocLogoType.BW_HORIZONTAL} size={HedgeDocLogoSize.SMALL}
size={HedgeDocLogoSize.SMALL} />
/> <Branding inline={true} />
<Branding inline={true} />
</a>
</Link> </Link>
</Navbar.Brand> </Navbar.Brand>
) )

View file

@ -18,16 +18,14 @@ export const ReadOnlyModeButton: React.FC = () => {
const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress) const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress)
return ( return (
<Link href={`/s/${noteIdentifier}`}> <Link href={`/s/${noteIdentifier}`} target='_blank'>
<a target='_blank'> <Button
<Button title={t('editor.documentBar.readOnlyMode') ?? undefined}
title={t('editor.documentBar.readOnlyMode') ?? undefined} className='ms-2 text-secondary'
className='ms-2 text-secondary' size='sm'
size='sm' variant='outline-light'>
variant='outline-light'> <ForkAwesomeIcon icon='file-text-o' />
<ForkAwesomeIcon icon='file-text-o' /> </Button>
</Button>
</a>
</Link> </Link>
) )
} }

View file

@ -18,16 +18,14 @@ export const SlideModeButton: React.FC = () => {
const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress) const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress)
return ( return (
<Link href={`/p/${noteIdentifier}`}> <Link href={`/p/${noteIdentifier}`} target='_blank'>
<a target='_blank'> <Button
<Button title={t('editor.documentBar.slideMode') ?? undefined}
title={t('editor.documentBar.slideMode') ?? undefined} className='ms-2 text-secondary'
className='ms-2 text-secondary' size='sm'
size='sm' variant='outline-light'>
variant='outline-light'> <ForkAwesomeIcon icon='television' />
<ForkAwesomeIcon icon='television' /> </Button>
</Button>
</a>
</Link> </Link>
) )
} }

View file

@ -63,22 +63,20 @@ export const HistoryCard: React.FC<HistoryEntryProps & HistoryEventHandlers> = (
<div className={'d-flex flex-column'}> <div className={'d-flex flex-column'}>
<PinButton isDark={false} isPinned={entry.pinStatus} onPinClick={onPinEntry} /> <PinButton isDark={false} isPinned={entry.pinStatus} onPinClick={onPinEntry} />
</div> </div>
<Link href={`/n/${entry.identifier}`}> <Link href={`/n/${entry.identifier}`} className='text-decoration-none flex-fill text-dark'>
<a className='text-decoration-none flex-fill text-dark'> <div className={'d-flex flex-column justify-content-between'}>
<div className={'d-flex flex-column justify-content-between'}> <Card.Title className='m-0 mt-1dot5' {...cypressId('history-entry-title')}>
<Card.Title className='m-0 mt-1dot5' {...cypressId('history-entry-title')}> {entryTitle}
{entryTitle} </Card.Title>
</Card.Title> <div>
<div> <div className='text-black-50 mt-2'>
<div className='text-black-50 mt-2'> <ForkAwesomeIcon icon='clock-o' /> {DateTime.fromISO(entry.lastVisitedAt).toRelative()}
<ForkAwesomeIcon icon='clock-o' /> {DateTime.fromISO(entry.lastVisitedAt).toRelative()} <br />
<br /> {lastVisited}
{lastVisited}
</div>
<div className={`${styles['card-footer-min-height']} p-0`}>{tags}</div>
</div> </div>
<div className={`${styles['card-footer-min-height']} p-0`}>{tags}</div>
</div> </div>
</a> </div>
</Link> </Link>
<div className={'d-flex flex-column'}> <div className={'d-flex flex-column'}>
<EntryMenu <EntryMenu

View file

@ -44,10 +44,8 @@ export const HistoryTableRow: React.FC<HistoryEntryProps & HistoryEventHandlers>
return ( return (
<tr> <tr>
<td> <td>
<Link href={`/n/${entry.identifier}`}> <Link href={`/n/${entry.identifier}`} className='text-light' {...cypressId('history-entry-title')}>
<a className='text-light' {...cypressId('history-entry-title')}> {entryTitle}
{entryTitle}
</a>
</Link> </Link>
</td> </td>
<td>{formatHistoryDate(entry.lastVisitedAt)}</td> <td>{formatHistoryDate(entry.lastVisitedAt)}</td>

View file

@ -32,10 +32,12 @@ export const HeaderNavLink: React.FC<PropsWithChildren<HeaderNavLinkProps>> = ({
return ( return (
<Nav.Item> <Nav.Item>
<Link href={to} passHref={true}> <Link
<a className={`nav-link text-light ${activeClass} ${styles['nav-link']}`} href={to} {...cypressId(props)}> href={to}
{children} passHref={true}
</a> className={`nav-link text-light ${activeClass} ${styles['nav-link']}`}
{...cypressId(props)}>
{children}
</Link> </Link>
</Nav.Item> </Nav.Item>
) )