From f89b28969f918565592e28a2e68f264f1a3c94e4 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Fri, 9 Dec 2022 19:35:40 +0100 Subject: [PATCH] fix: Migrate code to next 13 breaking changes Signed-off-by: Tilman Vatteroth --- frontend/cypress/e2e/signInButton.spec.ts | 9 ++++--- frontend/next.config.js | 1 + .../components/common/links/internal-link.tsx | 14 +++++----- frontend/src/components/common/redirect.tsx | 5 +--- .../editor-page/app-bar/navbar-branding.tsx | 14 +++++----- .../app-bar/read-only-mode-button.tsx | 18 ++++++------- .../editor-page/app-bar/slide-mode-button.tsx | 18 ++++++------- .../history-card/history-card.tsx | 26 +++++++++---------- .../history-table/history-table-row.tsx | 6 ++--- .../navigation/header-bar/header-nav-link.tsx | 10 ++++--- 10 files changed, 55 insertions(+), 66 deletions(-) diff --git a/frontend/cypress/e2e/signInButton.spec.ts b/frontend/cypress/e2e/signInButton.spec.ts index 2a72d7bd3..738fa1320 100644 --- a/frontend/cypress/e2e/signInButton.spec.ts +++ b/frontend/cypress/e2e/signInButton.spec.ts @@ -36,7 +36,7 @@ describe('When logged-out ', () => { 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', () => { @@ -47,7 +47,7 @@ describe('When logged-out ', () => { 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') .should('be.visible') + .parent() // The absolute URL is used because it is defined as API base URL absolute. .should('have.attr', 'href', '/auth/github') }) @@ -75,7 +76,7 @@ describe('When logged-out ', () => { 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 } ]) - 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') }) }) }) diff --git a/frontend/next.config.js b/frontend/next.config.js index baaa6f2d4..13badad4a 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -86,6 +86,7 @@ const rawNextConfig = { ]) }, output: 'standalone', + swcMinify: false, //Otherwise emoji picker is minified incorrectly experimental: { outputFileTracingRoot: path.join(__dirname, '../') } diff --git a/frontend/src/components/common/links/internal-link.tsx b/frontend/src/components/common/links/internal-link.tsx index 557d59a31..d087d567d 100644 --- a/frontend/src/components/common/links/internal-link.tsx +++ b/frontend/src/components/common/links/internal-link.tsx @@ -30,14 +30,12 @@ export const InternalLink: React.FC = ({ title }) => { return ( - - - - -   - - {text} - + + + +   + + {text} ) } diff --git a/frontend/src/components/common/redirect.tsx b/frontend/src/components/common/redirect.tsx index b7a75fbc2..e701146a6 100644 --- a/frontend/src/components/common/redirect.tsx +++ b/frontend/src/components/common/redirect.tsx @@ -31,10 +31,7 @@ export const Redirect: React.FC = ({ to }) => { return ( - Redirecting to{' '} - - {to} - + Redirecting to {to} ) } diff --git a/frontend/src/components/editor-page/app-bar/navbar-branding.tsx b/frontend/src/components/editor-page/app-bar/navbar-branding.tsx index 9380587d5..b5906a7a7 100644 --- a/frontend/src/components/editor-page/app-bar/navbar-branding.tsx +++ b/frontend/src/components/editor-page/app-bar/navbar-branding.tsx @@ -22,14 +22,12 @@ export const NavbarBranding: React.FC = () => { return ( - - - - - + + + ) diff --git a/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx b/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx index cf1e5c720..83de49938 100644 --- a/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx +++ b/frontend/src/components/editor-page/app-bar/read-only-mode-button.tsx @@ -18,16 +18,14 @@ export const ReadOnlyModeButton: React.FC = () => { const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress) return ( - - - - + + ) } diff --git a/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx b/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx index 773a3e4ff..989382fb6 100644 --- a/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx +++ b/frontend/src/components/editor-page/app-bar/slide-mode-button.tsx @@ -18,16 +18,14 @@ export const SlideModeButton: React.FC = () => { const noteIdentifier = useApplicationState((state) => state.noteDetails.primaryAddress) return ( - - - - + + ) } diff --git a/frontend/src/components/history-page/history-card/history-card.tsx b/frontend/src/components/history-page/history-card/history-card.tsx index 0ef7223d9..910409072 100644 --- a/frontend/src/components/history-page/history-card/history-card.tsx +++ b/frontend/src/components/history-page/history-card/history-card.tsx @@ -63,22 +63,20 @@ export const HistoryCard: React.FC = (
- - -
- - {entryTitle} - -
-
- {DateTime.fromISO(entry.lastVisitedAt).toRelative()} -
- {lastVisited} -
-
{tags}
+ +
return ( - - - {entryTitle} - + + {entryTitle} {formatHistoryDate(entry.lastVisitedAt)} diff --git a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx b/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx index aa9a45395..626e1e80c 100644 --- a/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx +++ b/frontend/src/components/landing-layout/navigation/header-bar/header-nav-link.tsx @@ -32,10 +32,12 @@ export const HeaderNavLink: React.FC> = ({ return ( - - - {children} - + + {children} )