diff --git a/Dockerfile b/Dockerfile index 70ac83c4..51c9420a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,13 @@ FROM node:12.13.1-alpine +ARG ASSET_PREFIX +ENV ASSET_PREFIX $ASSET_PREFIX + ENV APP_UID=9999 ENV APP_GID=9999 RUN apk --no-cache add shadow -RUN groupmod -g $APP_GID node +RUN groupmod -g $APP_GID node RUN usermod -u $APP_UID -g $APP_GID node RUN mkdir -p /usr/src diff --git a/components/Footer.tsx b/components/Footer.tsx index b5f626fc..16c4a860 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -10,7 +10,7 @@ const Footer = () => { return (
css` - height: 47px; + height: ${theme.dimensions.footer.height}px; background-color: ${theme.colors.white}; border-top: 1px solid ${theme.colors.grey_3}; display: flex; @@ -19,6 +19,10 @@ const Footer = () => { padding-right: 18px; ${theme.shadow.default}; z-index: 10; + position: fixed; + bottom: 0px; + left: 0px; + right: 0px; `} > { line-height: 24px; font-weight: normal; padding-right: 10px; + padding-left: 5px; ` } > powered by - + + +
); }; diff --git a/components/Head.tsx b/components/Head.tsx index c5881318..8792666e 100644 --- a/components/Head.tsx +++ b/components/Head.tsx @@ -1,15 +1,26 @@ import React from 'react'; import NextHead from 'next/head'; +import { getConfig } from '../global/config'; -export default function Head() { +const Head = () => { + const { NEXT_PUBLIC_BASE_PATH } = getConfig(); return ( - {/* TODO: need correct favicon link */} - + ); -} +}; + +export const PageHead = ({ subtitle }: { subtitle?: string }) => { + return ( + + Overture DMS{subtitle ? ` - ${subtitle}` : ''} + + ); +}; + +export default Head; diff --git a/components/Link.tsx b/components/Link.tsx index 50aac79f..1b2106cc 100644 --- a/components/Link.tsx +++ b/components/Link.tsx @@ -1,7 +1,9 @@ import styled from '@emotion/styled'; import { css } from '@emotion/core'; +import Link from 'next/link'; import defaultTheme from './theme'; +import getInternalLink from '../global/utils/getInternalLink'; const StyledLink = styled('a')` ${({ theme }: { theme: typeof defaultTheme }) => css` @@ -30,10 +32,16 @@ export const StyledLinkAsButton = styled(StyledLink)` position: relative; text-decoration: none; &:hover { - background-color: ${theme.colors.accent_dark}; color: ${theme.colors.white}; + background-color: ${theme.colors.accent_dark}; } `} `; +export const InternalLink = ({ children, path }: { children: React.ReactNode; path: string }) => ( + + {children} + +); + export default StyledLink; diff --git a/components/NavBar.tsx b/components/NavBar.tsx index d1fbd163..bd1ef169 100644 --- a/components/NavBar.tsx +++ b/components/NavBar.tsx @@ -1,20 +1,31 @@ import React from 'react'; import { css } from '@emotion/core'; +import { useRouter } from 'next/router'; import UserDropdown from './UserDropdown'; import defaultTheme from './theme'; import { OvertureLogo } from './theme/icons'; import useAuthContext from '../global/hooks/useAuthContext'; -import { StyledLinkAsButton } from './Link'; +import { StyledLinkAsButton, InternalLink as Link } from './Link'; +import { useTheme } from 'emotion-theming'; +import { EXPLORER_PATH, LOGIN_PATH, USER_PATH } from '../global/utils/constants'; const NavBar: React.ComponentType = ({ labName = 'Data Management System', labIcon }) => { const { token } = useAuthContext(); + const router = useRouter(); + const theme: typeof defaultTheme = useTheme(); + + const activeLinkStyle = ` + background-color: ${theme.colors.grey_2}; + color: ${theme.colors.accent2_dark}; + `; + return (
css` display: flex; justify-content: space-between; - height: 50px; + height: ${theme.dimensions.navbar.height}px; background-color: ${theme.colors.white}; ${theme.shadow.default}; position: sticky; @@ -32,28 +43,29 @@ const NavBar: React.ComponentType = ({ labName = 'Data Management System', cursor: pointer; `} > - css` - display: flex; - align-items: center; - text-decoration: none; - ${theme.typography.heading}; - color: ${theme.colors.accent_dark}; - `} - > - {labIcon || } - {/* set to default until labname config is implemented */} - {labName && ( - - {labName} - - )} - + + css` + display: flex; + align-items: center; + text-decoration: none; + ${theme.typography.heading}; + color: ${theme.colors.accent_dark}; + `} + > + {labIcon || } + {/* set to default until labname config is implemented */} + {labName && ( + + {labName} + + )} + +
= ({ labName = 'Data Management System', align-items: center; justify-content: center; width: 144px; - background-color: ${theme.colors.grey_2}; + background-color: ${theme.colors.white}; height: 100%; &:hover { - background-color: ${theme.colors.grey_3}; + background-color: ${theme.colors.grey_2}; } border-right: 2px solid ${theme.colors.white}; `} > - css` - display: flex; - flex: 1; - height: 100%; - justify-content: center; - align-items: center; - text-decoration: none; - color: ${theme.colors.accent2_dark}; - `} - href="/repository" - > - Data Explorer - + + css` + display: flex; + flex: 1; + height: 100%; + justify-content: center; + align-items: center; + text-decoration: none; + color: ${theme.colors.accent_dark}; + cursor: pointer; + ${router.pathname === EXPLORER_PATH ? activeLinkStyle : ''} + `} + > + Data Explorer + +
{token ? (
= ({ labName = 'Data Management System', width: 195px; height: 100%; display: flex; - background-color: ${theme.colors.grey_2}; + ${router.pathname === USER_PATH ? activeLinkStyle : ''} &:hover { - background-color: ${theme.colors.grey_3}; + background-color: ${theme.colors.grey_2}; } `} > @@ -113,16 +128,17 @@ const NavBar: React.ComponentType = ({ labName = 'Data Management System', justify-content: center; `} > - css` - width: 70px; - ${theme.typography.button}; - line-height: 20px; - `} - href="/login" - > - Log in - + + css` + width: 70px; + ${theme.typography.button}; + line-height: 20px; + `} + > + Log in + +
)} diff --git a/components/PageLayout.tsx b/components/PageLayout.tsx index 986afe49..74acad5e 100644 --- a/components/PageLayout.tsx +++ b/components/PageLayout.tsx @@ -3,22 +3,26 @@ import { css } from '@emotion/core'; import NavBar from './NavBar'; import Footer from './Footer'; +import { PageHead } from './Head'; -const PageLayout = ({ children }: { children: React.ReactNode }) => { +const PageLayout = ({ children, subtitle }: { children: React.ReactNode; subtitle?: string }) => { return ( -
css` - display: grid; - grid-template-rows: 50px 1fr; - min-height: 100vh; - ${theme.typography.regular} - color: ${theme.colors.black}; - `} - > - - {children} -
-
+ <> + +
css` + display: grid; + grid-template-rows: 50px 1fr; + min-height: 100vh; + ${theme.typography.regular} + color: ${theme.colors.black}; + `} + > + + {children} +
+
+ ); }; diff --git a/components/UserDropdown.tsx b/components/UserDropdown.tsx index 9acf44f5..e2a71e01 100644 --- a/components/UserDropdown.tsx +++ b/components/UserDropdown.tsx @@ -7,6 +7,9 @@ import defaultTheme from './theme'; import { Avatar, ChevronDown } from './theme/icons'; import useAuthContext from '../global/hooks/useAuthContext'; import { UserWithId } from '../global/types'; +import { InternalLink as Link } from './Link'; +import { useRouter } from 'next/router'; +import { USER_PATH } from '../global/utils/constants'; const getDisplayName = (user?: UserWithId) => { const greeting = 'Hello'; @@ -26,14 +29,11 @@ const CurrentUser = () => { const { user } = useAuthContext(); return (
- css` - color: ${theme.colors.accent2_dark}; - display: flex; - align-items: center; - justify-content: center; - ` - } + css={css` + display: flex; + align-items: center; + justify-content: center; + `} > { }, [open]); const theme: typeof defaultTheme = useTheme(); const { logout } = useAuthContext(); + const router = useRouter(); + const fillColor = + router.pathname === USER_PATH ? theme.colors.accent2_dark : theme.colors.accent_dark; + return (
{ onClick={() => setOpen(!open)} > { {open ? ( { /> ) : ( { `} >
  • - Profile & Token + + Profile & Token +
  • logout()}>Logout diff --git a/components/pages/repository/Facets.tsx b/components/pages/explorer/Facets.tsx similarity index 99% rename from components/pages/repository/Facets.tsx rename to components/pages/explorer/Facets.tsx index bc5c1e0c..27ca72a4 100644 --- a/components/pages/repository/Facets.tsx +++ b/components/pages/explorer/Facets.tsx @@ -10,6 +10,7 @@ const Aggregations = dynamic( ) as any; const getFacetStyles = (theme: typeof defaultTheme) => css` + padding-bottom: 2rem; .input-range-wrapper div { ${theme.typography.label2} font-weight: bold; @@ -61,7 +62,7 @@ const getFacetStyles = (theme: typeof defaultTheme) => css` } &.collapsed { background-color: ${theme.colors.grey_2}; - margin: -5px -8px -6px -6px; + margin: -5px -8px -6px -7px; padding: 5px 8px 6px 6px; } & .title { diff --git a/components/pages/repository/PageContent.tsx b/components/pages/explorer/PageContent.tsx similarity index 64% rename from components/pages/repository/PageContent.tsx rename to components/pages/explorer/PageContent.tsx index 021ce8ec..cea994fd 100644 --- a/components/pages/repository/PageContent.tsx +++ b/components/pages/explorer/PageContent.tsx @@ -1,22 +1,9 @@ import { css } from '@emotion/core'; -import { useTheme } from 'emotion-theming'; -import styled from '@emotion/styled'; - import RepoTable from './RepoTable'; import Facets from './Facets'; import QueryBar from './QueryBar'; import { PageContentProps } from './index'; -import defaultTheme from '../../theme'; -import Footer from '../../Footer'; - -export const Collapsible = styled('div')` - ${({ theme }: { theme: typeof defaultTheme }) => css` - border-top: 1px solid ${theme.colors.grey_2}; - height: 47px; - width: 100%; - `} -`; const PageContent = (props: PageContentProps) => { return ( @@ -36,27 +23,35 @@ const PageContent = (props: PageContentProps) => { css={(theme) => css` flex: 3; flex-direction: column; - min-width: 250px; - max-width: 270px; + min-width: ${theme.dimensions.facets.minWidth}px; + max-width: ${theme.dimensions.facets.maxWidth}px; background-color: ${theme.colors.white}; z-index: 1; ${theme.shadow.right}; + height: calc( + 100vh - ${theme.dimensions.footer.height + theme.dimensions.navbar.height}px + ); + overflow-y: scroll; `} > -
  • css` display: flex; flex-direction: column; width: 100%; + height: calc( + 100vh - ${theme.dimensions.footer.height + theme.dimensions.navbar.height}px + ); + overflow-y: scroll; `} >
    css` flex: 8.5; margin: 0 15px 0 15px; + max-width: calc(100vw - ${theme.dimensions.facets.maxWidth + 10}px); `} > diff --git a/components/pages/repository/QueryBar.tsx b/components/pages/explorer/QueryBar.tsx similarity index 100% rename from components/pages/repository/QueryBar.tsx rename to components/pages/explorer/QueryBar.tsx diff --git a/components/pages/repository/RepoTable.tsx b/components/pages/explorer/RepoTable.tsx similarity index 100% rename from components/pages/repository/RepoTable.tsx rename to components/pages/explorer/RepoTable.tsx diff --git a/components/pages/repository/getConfigError.tsx b/components/pages/explorer/getConfigError.tsx similarity index 93% rename from components/pages/repository/getConfigError.tsx rename to components/pages/explorer/getConfigError.tsx index 862ee431..8c8a9a58 100644 --- a/components/pages/repository/getConfigError.tsx +++ b/components/pages/explorer/getConfigError.tsx @@ -2,18 +2,16 @@ import { ReactNode } from 'react'; import { css } from '@emotion/core'; import { Checkmark, Warning } from '../../theme/icons'; -import theme from '../../theme/'; +import theme from '../../theme'; import StyledLink from '../../Link'; import { getConfig } from '../../../global/config'; -import { Project } from './'; +import { Project } from '.'; const ArrangerAdminUILink = () => { - const { NEXT_PUBLIC_ARRANGER_API } = getConfig(); - const splitApi: string[] = NEXT_PUBLIC_ARRANGER_API.split('//'); - const adminUiUrl: string = [splitApi[0], '//ui.', splitApi[1]].join(''); + const { NEXT_PUBLIC_ARRANGER_ADMIN_UI } = getConfig(); return ( - + Arranger Admin UI ); diff --git a/components/pages/repository/index.tsx b/components/pages/explorer/index.tsx similarity index 98% rename from components/pages/repository/index.tsx rename to components/pages/explorer/index.tsx index 0e2df98b..5a7b14da 100644 --- a/components/pages/repository/index.tsx +++ b/components/pages/explorer/index.tsx @@ -99,7 +99,7 @@ const RepositoryPage = () => { }); return ( - + {ConfigError ? ( {ConfigError} ) : ( diff --git a/components/pages/repository/sqonTypes.ts b/components/pages/explorer/sqonTypes.ts similarity index 100% rename from components/pages/repository/sqonTypes.ts rename to components/pages/explorer/sqonTypes.ts diff --git a/components/pages/login/index.tsx b/components/pages/login/index.tsx index 123a5179..68ecf0a4 100644 --- a/components/pages/login/index.tsx +++ b/components/pages/login/index.tsx @@ -96,13 +96,14 @@ const providers: ProviderType[] = [ { name: 'Google', path: 'google', icon: GoogleLogo }, { name: 'ORCiD', path: 'orcid', icon: OrcidLogo }, { name: 'GitHub', path: 'github', icon: GitHubLogo }, - { name: 'Facebook', path: '', icon: FacebookLogo }, + // Facebook will be hidden until provider implementation is fixed in Ego https://github.com/overture-stack/ego/issues/555 + // { name: 'Facebook', path: '', icon: FacebookLogo }, { name: 'LinkedIn', path: 'linkedin', icon: LinkedInLogo }, ]; const LoginPage = () => { return ( - +
    { ${theme.typography.heading} color: ${theme.colors.accent_dark}; margin: 10px 0; + font-weight: normal; `} > Please choose one of the following log in methods to access your API token for data @@ -149,7 +151,7 @@ const LoginPage = () => {
      { })}
    -
    css` - flex: 2; - background-color: ${theme.colors.primary}; - `} - >
    - +
    css` + flex: 1; + background-color: ${theme.colors.primary}; + `} + /> +
    + +
    diff --git a/components/pages/user/ApiTokenInfo.tsx b/components/pages/user/ApiTokenInfo.tsx index b41cb171..19cda3a6 100644 --- a/components/pages/user/ApiTokenInfo.tsx +++ b/components/pages/user/ApiTokenInfo.tsx @@ -155,11 +155,7 @@ const ApiTokenInfo = () => { }, [token]); return ( -
    +

    css` @@ -232,6 +228,7 @@ const ApiTokenInfo = () => { justify-content: space-between; margin-bottom: 2rem; margin-top: 1rem; + max-width: 600px; `} >
    css` + flex-direction: row; + justify-content: space-between; + width: 800px; + margin-top: 1.5rem; + margin-bottom: 0.5rem; + padding-bottom: 2.5rem; + border-bottom: 1px solid ${theme.colors.grey_3}; + `} +`; + +const UserTitle = styled('h1')` + ${({ theme }: { theme: typeof defaultTheme }) => css` + ${theme.typography.regular}; + font-size: 30px; + line-height: 36px; + color: ${theme.colors.accent_dark}; + margin-bottom: 0.5rem; + margin-top: 0.1rem; + `} +`; + +const UserEmail = styled('div')` + ${({ theme }: { theme: typeof defaultTheme }) => css` + ${theme.typography.subheading}; + color: ${theme.colors.accent_dark}; + font-weight: normal; + padding-left: 0.2rem; + `} +`; + const UserComponent = () => { const { user } = useAuthContext(); return ( - -
    - css` - margin: 1rem 20rem; - display: flex; - flex-direction: column; - ` - } + + - {!isEmpty(user) && ( -
    css` - display: flex; - flex-direction: row; - justify-content: space-between; - width: 800px; - margin-top: 1.5rem; - margin-bottom: 0.5rem; - padding-bottom: 2.5rem; - border-bottom: 1px solid ${theme.colors.grey_3}; - `} - > -
    - -
    + {!isEmpty(user) && ( + + -

    - css` - ${theme.typography.regular}; - font-size: 30px; - line-height: 36px; - color: ${theme.colors.accent_dark}; - margin-bottom: 0.5rem; - margin-top: 0.1rem; - ` - } - > - {`${user?.firstName} ${user?.lastName}`} -

    +
    - css` - ${theme.typography.subheading}; - color: ${theme.colors.accent_dark}; - font-weight: normal; - padding-left: 0.2rem; - ` - } + css={css` + margin-left: 1rem; + `} > - {user?.email || ''} + {`${user?.firstName} ${user?.lastName}`} + {user?.email || ''}
    -
    -
    - -
    - )} - {!isEmpty(user) && } -
    + + + + )} + {!isEmpty(user) && } + +
    ); }; diff --git a/components/theme/dimensions.ts b/components/theme/dimensions.ts new file mode 100644 index 00000000..5a44d92e --- /dev/null +++ b/components/theme/dimensions.ts @@ -0,0 +1,14 @@ +const dimensions = { + navbar: { + height: 50, + }, + footer: { + height: 47, + }, + facets: { + minWidth: 250, + maxWidth: 270, + }, +}; + +export default dimensions; diff --git a/components/theme/index.ts b/components/theme/index.ts index 02bf3d1e..672ef9fc 100644 --- a/components/theme/index.ts +++ b/components/theme/index.ts @@ -1,9 +1,11 @@ import colors from './colors'; import typography from './typography'; import shadow from './shadow'; +import dimensions from './dimensions'; export default { colors, typography, shadow, + dimensions, }; diff --git a/global/config.ts b/global/config.ts index 784b0b36..fe40aa17 100644 --- a/global/config.ts +++ b/global/config.ts @@ -13,6 +13,8 @@ export const getConfig = () => { NEXT_PUBLIC_ARRANGER_GRAPHQL_FIELD: publicConfig.NEXT_PUBLIC_ARRANGER_GRAPHQL_FIELD || '', NEXT_PUBLIC_ARRANGER_INDEX: publicConfig.NEXT_PUBLIC_ARRANGER_INDEX || '', NEXT_PUBLIC_ARRANGER_API: publicConfig.NEXT_PUBLIC_ARRANGER_API || 'http://localhost:5050', + NEXT_PUBLIC_ARRANGER_ADMIN_UI: publicConfig.NEXT_PUBLIC_ARRANGER_ADMIN_UI, + NEXT_PUBLIC_BASE_PATH: publicConfig.NEXT_PUBLIC_BASE_PATH || '', } as { NEXT_PUBLIC_EGO_API_ROOT: string; NEXT_PUBLIC_EGO_CLIENT_ID: string; @@ -21,5 +23,7 @@ export const getConfig = () => { NEXT_PUBLIC_ARRANGER_GRAPHQL_FIELD: string; NEXT_PUBLIC_ARRANGER_INDEX: string; NEXT_PUBLIC_ARRANGER_API: string; + NEXT_PUBLIC_ARRANGER_ADMIN_UI: string; + NEXT_PUBLIC_BASE_PATH: string; }; }; diff --git a/global/hooks/useAuthContext.tsx b/global/hooks/useAuthContext.tsx index e3addeca..9a163da2 100644 --- a/global/hooks/useAuthContext.tsx +++ b/global/hooks/useAuthContext.tsx @@ -1,9 +1,10 @@ import React, { createContext, useState } from 'react'; import { useRouter } from 'next/router'; -import { EGO_JWT_KEY } from '../utils/constants'; +import { EGO_JWT_KEY, EXPLORER_PATH } from '../utils/constants'; import { decodeToken, extractUser, isValidJwt } from '../utils/egoTokenUtils'; import { UserWithId } from '../../global/types'; +import getInternalLink from '../utils/getInternalLink'; type T_AuthContext = { token?: string; @@ -38,7 +39,7 @@ export const AuthProvider = ({ const logout = () => { removeToken(); - router.push('/repository'); + router.push(getInternalLink({ path: EXPLORER_PATH })); }; if (token !== egoJwt) { diff --git a/global/types.ts b/global/types.ts index 10631393..54af2cfb 100644 --- a/global/types.ts +++ b/global/types.ts @@ -18,7 +18,7 @@ export enum Language { export enum ProviderType { GOOGLE = 'GOOGLE', - FACEBOOK = 'FACEBOOK', + // FACEBOOK = 'FACEBOOK', // hide from allowed types, related to https://github.com/overture-stack/ego/issues/555 GITHUB = 'GITHUB', LINKEDIN = 'LINKEDIN', ORCID = 'ORCID', diff --git a/global/utils/constants.ts b/global/utils/constants.ts index d23f60b1..59a5add4 100644 --- a/global/utils/constants.ts +++ b/global/utils/constants.ts @@ -4,3 +4,7 @@ const { NEXT_PUBLIC_EGO_API_ROOT } = getConfig(); export const EGO_JWT_KEY = 'EGO_JWT'; export const EGO_API_KEY_ENDPOINT = `${NEXT_PUBLIC_EGO_API_ROOT}/o/api_key`; + +export const EXPLORER_PATH = '/explorer'; +export const USER_PATH = '/user'; +export const LOGIN_PATH = '/login'; diff --git a/global/utils/getInternalLink.ts b/global/utils/getInternalLink.ts new file mode 100644 index 00000000..5d791035 --- /dev/null +++ b/global/utils/getInternalLink.ts @@ -0,0 +1,8 @@ +import urlJoin from 'url-join'; + +import { getConfig } from '../config'; + +export default ({ path }: { path: string }) => { + const { NEXT_PUBLIC_BASE_PATH } = getConfig(); + return urlJoin(NEXT_PUBLIC_BASE_PATH, path); +}; diff --git a/next.config.js b/next.config.js index ee6f3f7f..98441130 100644 --- a/next.config.js +++ b/next.config.js @@ -9,5 +9,10 @@ module.exports = withCSS({ NEXT_PUBLIC_ARRANGER_GRAPHQL_FIELD: process.env.NEXT_PUBLIC_ARRANGER_GRAPHQL_FIELD, NEXT_PUBLIC_ARRANGER_INDEX: process.env.NEXT_PUBLIC_ARRANGER_INDEX, NEXT_PUBLIC_ARRANGER_API: process.env.NEXT_PUBLIC_ARRANGER_API_URL, + NEXT_PUBLIC_ARRANGER_ADMIN_UI: process.env.NEXT_PUBLIC_ARRANGER_ADMIN_UI_URL, + // using ASSET_PREFIX for the public runtime BASE_PATH because basePath in the top level config was not working + // with the dms reverse proxy setup + NEXT_PUBLIC_BASE_PATH: process.env.ASSET_PREFIX, }, + assetPrefix: process.env.ASSET_PREFIX || '', }); diff --git a/package.json b/package.json index e9c0b8de..8e62ea9b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dms-ui", - "version": "0.6.0", + "version": "0.7.0", "private": true, "scripts": { "dev": "next dev", diff --git a/pages/_app.tsx b/pages/_app.tsx index 0ebe15a2..ae0a70c8 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,10 +1,11 @@ import Root from '../components/Root'; import { AppContext } from 'next/app'; -import { EGO_JWT_KEY } from '../global/utils/constants'; +import { EGO_JWT_KEY, LOGIN_PATH } from '../global/utils/constants'; import { PageWithConfig } from '../global/utils/pages/types'; import { useEffect, useState } from 'react'; import Router from 'next/router'; +import getInternalLink from '../global/utils/getInternalLink'; const DMSApp = ({ Component, @@ -18,7 +19,7 @@ const DMSApp = ({ const egoJwt = localStorage.getItem(EGO_JWT_KEY) || undefined; setInitialToken(egoJwt); if (!Component.isPublic && !egoJwt) { - Router.push('/login'); + Router.push(getInternalLink({ path: LOGIN_PATH })); } }); diff --git a/pages/repository/index.tsx b/pages/explorer/index.tsx similarity index 57% rename from pages/repository/index.tsx rename to pages/explorer/index.tsx index 972f861e..f54b4b8c 100644 --- a/pages/repository/index.tsx +++ b/pages/explorer/index.tsx @@ -1,14 +1,14 @@ import React from 'react'; -import Repository from '../../components/pages/repository'; +import Explorer from '../../components/pages/explorer'; import { createPage } from '../../global/utils/pages'; -const RepositoryPage = createPage({ +const ExplorerPage = createPage({ getInitialProps: async ({ query, egoJwt }) => { return { query, egoJwt }; }, isPublic: true, })(() => { - return ; + return ; }); -export default RepositoryPage; +export default ExplorerPage; diff --git a/pages/index.tsx b/pages/index.tsx index 658c4b97..1f988c47 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,13 +1,13 @@ import React from 'react'; -import RepositoryPage from './repository'; +import ExplorerPage from './explorer'; import { createPage } from '../global/utils/pages'; const HomePage = createPage({ getInitialProps: async () => {}, isPublic: true, })(() => { - return ; + return ; }); export default HomePage; diff --git a/pages/logged-in.tsx b/pages/logged-in.tsx index 04b1f864..9c4548ab 100644 --- a/pages/logged-in.tsx +++ b/pages/logged-in.tsx @@ -4,10 +4,11 @@ import { css } from '@emotion/core'; import { getConfig } from '../global/config'; import { createPage } from '../global/utils/pages'; -import { EGO_JWT_KEY } from '../global/utils/constants'; +import { EGO_JWT_KEY, EXPLORER_PATH, LOGIN_PATH } from '../global/utils/constants'; import Router from 'next/router'; import { isValidJwt } from '../global/utils/egoTokenUtils'; import PageLayout from '../components/PageLayout'; +import getInternalLink from '../global/utils/getInternalLink'; const fetchEgoToken = () => { const { NEXT_PUBLIC_EGO_API_ROOT, NEXT_PUBLIC_EGO_CLIENT_ID } = getConfig(); @@ -31,7 +32,7 @@ const fetchEgoToken = () => { .then((jwt) => { if (isValidJwt(jwt)) { localStorage.setItem(EGO_JWT_KEY, jwt); - setTimeout(() => Router.push('/repository'), 2000); + setTimeout(() => Router.push(getInternalLink({ path: EXPLORER_PATH })), 2000); } else { throw new Error('Invalid jwt, cannot login.'); } @@ -39,7 +40,7 @@ const fetchEgoToken = () => { .catch((err) => { console.warn(err); localStorage.removeItem(EGO_JWT_KEY); - Router.push('/login'); + Router.push(getInternalLink({ path: LOGIN_PATH })); }); }; diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 4965832f..00000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/images/favicon.ico b/public/images/favicon.ico new file mode 100644 index 00000000..e58d67fc Binary files /dev/null and b/public/images/favicon.ico differ diff --git a/static/avatar.svg b/public/static/avatar.svg similarity index 100% rename from static/avatar.svg rename to public/static/avatar.svg diff --git a/static/checkmark.svg b/public/static/checkmark.svg similarity index 100% rename from static/checkmark.svg rename to public/static/checkmark.svg diff --git a/static/chevron-down.svg b/public/static/chevron-down.svg similarity index 100% rename from static/chevron-down.svg rename to public/static/chevron-down.svg diff --git a/static/facebook.svg b/public/static/facebook.svg similarity index 100% rename from static/facebook.svg rename to public/static/facebook.svg diff --git a/static/github.svg b/public/static/github.svg similarity index 100% rename from static/github.svg rename to public/static/github.svg diff --git a/static/google.svg b/public/static/google.svg similarity index 100% rename from static/google.svg rename to public/static/google.svg diff --git a/static/illustration.svg b/public/static/illustration.svg similarity index 100% rename from static/illustration.svg rename to public/static/illustration.svg diff --git a/static/linkedin.svg b/public/static/linkedin.svg similarity index 100% rename from static/linkedin.svg rename to public/static/linkedin.svg diff --git a/static/logomark.svg b/public/static/logomark.svg similarity index 100% rename from static/logomark.svg rename to public/static/logomark.svg diff --git a/static/orcid.svg b/public/static/orcid.svg similarity index 100% rename from static/orcid.svg rename to public/static/orcid.svg diff --git a/static/overture-user.svg b/public/static/overture-user.svg similarity index 100% rename from static/overture-user.svg rename to public/static/overture-user.svg diff --git a/static/primary.svg b/public/static/primary.svg similarity index 100% rename from static/primary.svg rename to public/static/primary.svg diff --git a/public/vercel.svg b/public/vercel.svg deleted file mode 100644 index fbf0e25a..00000000 --- a/public/vercel.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file