Skip to content

Commit

Permalink
feat: create KIN homepage based on default rsd page.
Browse files Browse the repository at this point in the history
chore: remove other home pages (helmholtz and imperial)
refactor: app header and app footer to use KIN logos and content
refactor: remove go to software page from global search
  • Loading branch information
dmijatovic committed Jul 1, 2024
1 parent 655ae71 commit 5d60235
Show file tree
Hide file tree
Showing 44 changed files with 658 additions and 908 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Define this variable, if you are running different versions of the RSD, in
# order to define the docker project name. If you leave this empty, docker will
# automatically name the containers.
COMPOSE_PROJECT_NAME="rpd"
COMPOSE_PROJECT_NAME="kin"

# ---- PUBLIC ENV VARIABLES -------------

Expand All @@ -25,7 +25,7 @@ POSTGRES_DB_HOST=database
# consumed by services: backend
POSTGRES_DB_HOST_PORT=5432
# consumed by services: database, backend
POSTGRES_DB=rpd-db
POSTGRES_DB=kin-rpd-db
# consumed by services: database
POSTGRES_USER=rsd

Expand Down
72 changes: 36 additions & 36 deletions frontend/__tests__/Home.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,49 @@ import {WrappedComponentWithProps} from '~/utils/jest/WrappedComponents'
// required when AppHeader component is used
jest.mock('~/auth/api/useLoginProviders')
// use DEFAULT MOCK for organisation list used by Helmholtz homepage
jest.mock('~/components/home/helmholtz/useOrganisations')
// jest.mock('~/components/home/helmholtz/useOrganisations')

const props = {
host: {
name: 'rsd'
},
counts: {
software_cnt: 1111,
project_cnt: 2222,
organisation_cnt: 3333
}
host: {
name: 'rsd'
},
counts: {
software_cnt: 1111,
project_cnt: 2222,
organisation_cnt: 3333
}
}

describe('pages/index.tsx', () => {
it('renders default RSD Home page when host=rsd', () => {
it('renders default KIN Home page when host=rsd', () => {
render(WrappedComponentWithProps(Home, {
props
}))
const page = screen.getByTestId('rsd-home-page')
const page = screen.getByTestId('kin-home-page')
expect(page).toBeInTheDocument()
})

it('renders default RSD Home page when host=""', () => {
it('renders default KIN Home page when host=""', () => {
defaultRsdSettings.host.name=''
render(WrappedComponentWithProps(Home, {
props,
settings: defaultRsdSettings
}))
const page = screen.getByTestId('rsd-home-page')
const page = screen.getByTestId('kin-home-page')
expect(page).toBeInTheDocument()
})

it('renders default RSD Home page when no host prop', () => {
it('renders default KIN Home page when no host prop', () => {
render(WrappedComponentWithProps(Home))
const page = screen.getByTestId('rsd-home-page')
const page = screen.getByTestId('kin-home-page')
expect(page).toBeInTheDocument()
})

it('renders counts on RSD Home page', () => {
it('renders counts on KIN Home page', () => {
render(WrappedComponentWithProps(Home,{props}))
// software_cnt
const software = screen.getByText(`${props.counts.software_cnt} Software`)
expect(software).toBeInTheDocument()
// const software = screen.getByText(`${props.counts.software_cnt} Software`)
// expect(software).toBeInTheDocument()
// project_cnt
const project = screen.getByText(`${props.counts.project_cnt} Projects`)
expect(project).toBeInTheDocument()
Expand All @@ -67,23 +67,23 @@ describe('pages/index.tsx', () => {
expect(organisation).toBeInTheDocument()
})

it('renders Helmholtz Home page when host=helmholtz', () => {
defaultRsdSettings.host.name='helmholtz'
render(WrappedComponentWithProps(Home, {
props,
settings: defaultRsdSettings
}))
const page = screen.getByTestId('rsd-helmholtz-home')
expect(page).toBeInTheDocument()
})
// it('renders Helmholtz Home page when host=helmholtz', () => {
// defaultRsdSettings.host.name='helmholtz'
// render(WrappedComponentWithProps(Home, {
// props,
// settings: defaultRsdSettings
// }))
// const page = screen.getByTestId('rsd-helmholtz-home')
// expect(page).toBeInTheDocument()
// })

it('renders Helmholtz Home page when host=HELMHoltz', () => {
defaultRsdSettings.host.name='HELMholtz'
render(WrappedComponentWithProps(Home, {
props,
settings: defaultRsdSettings
}))
const page = screen.getByTestId('rsd-helmholtz-home')
expect(page).toBeInTheDocument()
})
// it('renders Helmholtz Home page when host=HELMHoltz', () => {
// defaultRsdSettings.host.name='HELMholtz'
// render(WrappedComponentWithProps(Home, {
// props,
// settings: defaultRsdSettings
// }))
// const page = screen.getByTestId('rsd-helmholtz-home')
// expect(page).toBeInTheDocument()
// })
})
2 changes: 1 addition & 1 deletion frontend/components/AppFooter/OrganisationLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function OrganisationLogo({host}: { host: RsdHost }) {
)
}
if (host?.logo_url) {
const {name,logo_url,website}=host
const {name,logo_url}=host
return (
<div className="flex items-center">
<span className="h-[4rem] w-[16rem]">
Expand Down
10 changes: 6 additions & 4 deletions frontend/components/AppFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ export default function AppFooter () {
<div className="grid grid-cols-1 gap-8 px-4 md:grid-cols-[2fr,1fr] lg:container lg:mx-auto">
<div className="pt-8 md:py-8">
<p className="text-lg">
The Research Software Directory promotes the impact, re-use and citation of research software.
KIN connects, broadens, deepens, and unlocks knowledge for transitions towards a climate-neutral and climate-resilient society
</p>

<ContactEmail email={host?.email} headers={host?.emailHeaders} />
<div className="py-4"></div>
<OrganisationLogo host={host} />
{/* <div className="py-4"></div> */}
<div className="bg-base-100 w-[20rem] p-4 rounded-md mt-4">
<OrganisationLogo host={host} />
</div>

</div>
<div className="pb-8 md:py-8 flex flex-col gap-2">
<MarkdownPages pages={pages ?? []} />
Expand Down
29 changes: 14 additions & 15 deletions frontend/components/AppHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import useRsdSettings from '~/config/useRsdSettings'
import AddMenu from './AddMenu'
import LoginButton from '~/components/login/LoginButton'
import JavascriptSupportWarning from './JavascriptSupportWarning'
import LogoApp from '~/assets/LogoApp.svg'
import LogoAppSmall from '~/assets/LogoAppSmall.svg'
// import LogoApp from '~/assets/LogoApp.svg'
// import LogoAppSmall from '~/assets/LogoAppSmall.svg'
import GlobalSearchAutocomplete from '~/components/GlobalSearchAutocomplete'
import FeedbackPanelButton from '~/components/feedback/FeedbackPanelButton'
import ResponsiveMenu from './ResponsiveMenu'
Expand Down Expand Up @@ -50,19 +50,18 @@ export default function AppHeader() {
className="flex-1 flex flex-col px-4 xl:flex-row items-start lg:container lg:mx-auto">
<div className="w-full flex-1 flex items-center justify-between">
<Link href="/" passHref className="hover:text-inherit" aria-label="Link to home page">
<LogoApp
className="hidden 2xl:block"
loading='eager'
// lighthouse audit requires explicit width and height
width="100%"
height="1.5rem"
/>
<LogoAppSmall
className="2xl:hidden"
loading='eager'
// lighthouse audit requires explicit width and height
width="7rem"
height="1.5rem"
<img
src="/apple-touch-icon.png"
alt="KIN logo"
title="Klimaatonderzoek Initiatief Nederland"
style={{
height: '3.5rem',
width: 'auto',
padding: '0.5rem',
objectFit: 'contain',
backgroundColor: '#fff',
borderRadius:'50%'
}}
/>
</Link>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ it('shows 3 navigation option on focus', async () => {

// should show 3 navigation options
const listItems = screen.getAllByTestId('global-search-list-item')
expect(listItems.length).toEqual(3)
expect(listItems.length).toEqual(2)
})

it('calls search api on input', async () => {
Expand Down
1 change: 0 additions & 1 deletion frontend/components/GlobalSearchAutocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export default function GlobalSearchAutocomplete(props: Props) {
}, [lastValue])

const defaultValues = [
{name: 'Go to Software page', slug: '', source: 'software'},
{name: 'Go to Projects page', slug: '', source: 'projects'},
{name: 'Go to Organisations page', slug: '', source: 'organisations'},
]
Expand Down
15 changes: 0 additions & 15 deletions frontend/components/home/helmholtz/__mocks__/useOrganisations.tsx

This file was deleted.

Loading

0 comments on commit 5d60235

Please sign in to comment.