-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Opetushallitus/OK-497-tabs
Ok 497 tabs
- Loading branch information
Showing
26 changed files
with
503 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Oletko lisännyt tarvittavat yksikkö- tai ui-testit toiminnallisuudelle? Kyllä/En | ||
Oletko tarkistanut ja päivittänyt riippuvuudet? Kyllä/En | ||
Oletko kokeillut toimiiko käyttöliittymä mobiilissa landscape moodissa? Kyllä/En/Ei koske |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import HeaderPage from './page'; | ||
|
||
export default HeaderPage; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { styled } from '@mui/material'; | ||
|
||
export const TabContainer = styled('div')({ | ||
width: '70%', | ||
padding: '1rem 2rem', | ||
}); |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/hakeneet/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { TabContainer } from '../TabContainer'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
|
||
export default function HakeneetPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Hakeneet</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/hakijaryhmat/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { TabContainer } from '../TabContainer'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
|
||
export default function HakijaryhmatPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Hakijaryhmät</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
110 changes: 110 additions & 0 deletions
110
src/app/haku/[oid]/hakukohde/[hakukohde]/hakukohde-tabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
'use client'; | ||
|
||
import { getTranslation } from '@/app/lib/common'; | ||
import { styled } from '@mui/material'; | ||
import { useState } from 'react'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { usePathname } from 'next/navigation'; | ||
import { Link as MuiLink } from '@mui/material'; | ||
|
||
const StyledContainer = styled('div')({ | ||
padding: '0.5rem 1.5rem 0', | ||
width: '100%', | ||
border: '1px solid lightgray', | ||
}); | ||
|
||
const StyledHeader = styled('div')({ | ||
textAlign: 'left', | ||
h2: {}, | ||
'.hakukohdeLabel': { | ||
fontWeight: 600, | ||
}, | ||
'.organisaatioLabel': { | ||
fontWeight: 'normal', | ||
}, | ||
}); | ||
|
||
const StyledTabs = styled('div')({ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
columnGap: '0.5rem', | ||
'.hakukohde-tab': { | ||
cursor: 'pointer', | ||
'&--active': { | ||
borderBottom: '3px solid #0a789c', | ||
}, | ||
}, | ||
}); | ||
|
||
export type BasicTab = { | ||
title: string; | ||
route: string; | ||
}; | ||
|
||
const TABS: BasicTab[] = [ | ||
{ title: 'Perustiedot', route: 'perustiedot' }, | ||
{ title: 'Hakeneet', route: 'hakeneet' }, | ||
{ title: 'Valinnan hallinta', route: 'valinnan-hallinta' }, | ||
{ title: 'Valintakoekutsut', route: 'valintakoekutsut' }, | ||
{ title: 'Pistesyöttö', route: 'pistesyotto' }, | ||
{ title: 'Harkinnanvaraiset', route: 'harkinnanvaraiset' }, | ||
{ title: 'Hakijaryhmät', route: 'hakijaryhmat' }, | ||
{ title: 'Valintalaskennan tulos', route: 'valintalaskennan-tulos' }, | ||
{ title: 'Sijoittelun tulokset', route: 'sijoittelun-tulokset' }, | ||
] as const; | ||
|
||
function getPathMatchingTab(pathName: string) { | ||
const lastPath = pathName.split('/').reverse()[0]; | ||
return TABS.find((tab) => tab.route.startsWith(lastPath)) || TABS[0]; | ||
} | ||
|
||
export const HakukohdeTabs = ({ hakukohdeOid }: { hakukohdeOid: string }) => { | ||
const pathName = usePathname(); | ||
const [activeTab, setActiveTab] = useState<BasicTab>( | ||
getPathMatchingTab(pathName), | ||
); | ||
|
||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', hakukohdeOid], | ||
queryFn: () => getHakukohde(hakukohdeOid), | ||
}); | ||
|
||
const selectActiveTab = (tab: BasicTab) => { | ||
setActiveTab(tab); | ||
}; | ||
|
||
return ( | ||
<StyledContainer> | ||
<StyledHeader> | ||
<h2> | ||
<span className="organisaatioLabel"> | ||
{getTranslation(hakukohde.jarjestyspaikkaHierarkiaNimi)} | ||
</span> | ||
<br /> | ||
<span className="hakukohdeLabel"> | ||
{getTranslation(hakukohde.nimi)} | ||
</span> | ||
</h2> | ||
</StyledHeader> | ||
<StyledTabs> | ||
{TABS.map((tab) => ( | ||
<MuiLink | ||
href={tab.route} | ||
key={'hakukohde-tab-' + tab.route} | ||
className={ | ||
tab.title === activeTab.title | ||
? 'hakukohde-tab hakukohde-tab--active' | ||
: 'hakukohde-tab' | ||
} | ||
onClick={() => selectActiveTab(tab)} | ||
> | ||
{tab.title} | ||
</MuiLink> | ||
))} | ||
</StyledTabs> | ||
</StyledContainer> | ||
); | ||
}; | ||
|
||
export default HakukohdeTabs; |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/harkinnanvaraiset/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function HarkinnanvaraisetPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Harkinnanvaraiset</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import HakukohdeTabs from './hakukohde-tabs'; | ||
|
||
export default function HakuLayout({ | ||
children, | ||
params, | ||
}: { | ||
children: React.ReactNode; | ||
header: React.ReactNode; | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
return ( | ||
<> | ||
<div | ||
className="mainContainer" | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
padding: 0, | ||
width: '100%', | ||
}} | ||
> | ||
<HakukohdeTabs hakukohdeOid={params.hakukohde} /> | ||
{children} | ||
</div> | ||
</> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/perustiedot/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function PerustiedotTab({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Perustiedot</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/pistesyotto/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function PisteSyottoPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Pistesyöttö</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/sijoittelun-tulokset/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function SijoittelunTuloksetPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Sijoittelun tulokset</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/valinnan-hallinta/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function ValinnanHallintaPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Valinnan hallinta</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/haku/[oid]/hakukohde/[hakukohde]/valintakoekutsut/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { getHakukohde } from '@/app/lib/kouta'; | ||
import { useSuspenseQuery } from '@tanstack/react-query'; | ||
import { TabContainer } from '../TabContainer'; | ||
|
||
export default function ValintakoekutsutPage({ | ||
params, | ||
}: { | ||
params: { oid: string; hakukohde: string }; | ||
}) { | ||
const { data: hakukohde } = useSuspenseQuery({ | ||
queryKey: ['getHakukohde', params.hakukohde], | ||
queryFn: () => getHakukohde(params.hakukohde), | ||
}); | ||
|
||
return ( | ||
<TabContainer> | ||
<h3>Valintakoekutsut</h3> | ||
<p>Hakukohde oid: {hakukohde.oid}</p> | ||
</TabContainer> | ||
); | ||
} |
Oops, something went wrong.