Skip to content

Commit

Permalink
feat: transport pages and menu
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreiffers committed Oct 25, 2023
1 parent 0839030 commit caf7e54
Show file tree
Hide file tree
Showing 14 changed files with 297 additions and 100 deletions.
6 changes: 3 additions & 3 deletions src/app/app-nav-bar/app-nav-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
PATHNAME_REPORTS,
PATHNAME_ABOUT,
PATHNAME_ABOUT_REGISTRATION,
PATHNAME_ABOUT_NAP,
PATHNAME_AI,
PATHNAME_HOME_NAP,
PATHNAME_ORGANIZATIONS,
Expand All @@ -22,7 +21,8 @@ import {
PATHNAME_ABOUT_DATASETS,
PATHNAME_GUIDANCE,
PATHNAME_NEWS_ARCHIVE,
PATHNAME_REQUESTS
PATHNAME_REQUESTS,
PATHNAME_TRANSPORT_GENERAL
} from '../../constants/constants';

import { themeFDK, themeNAP } from '../theme';
Expand All @@ -39,7 +39,7 @@ interface Props {

const transportItems = () => [
<SC.ListItem key={localization.menu.aboutNap}>
<Link href={PATHNAME_ABOUT_NAP}>{localization.menu.aboutNap}</Link>
<Link href={PATHNAME_TRANSPORT_GENERAL}>{localization.menu.aboutNap}</Link>
</SC.ListItem>,
<SC.ListItem key={localization.menu.aboutRegistration}>
<Link as={RouteLink} to={PATHNAME_ABOUT_REGISTRATION}>
Expand Down
28 changes: 23 additions & 5 deletions src/app/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ import {
PATHNAME_ABOUT_CONCEPTS,
PATHNAME_ABOUT_INFORMATIONMODELS,
PATHNAME_AI,
PATHNAME_TRANSPORT,
PATHNAME_REQUESTS
PATHNAME_REQUESTS,
PATHNAME_TRANSPORT_GENERAL,
PATHNAME_TRANSPORT_GENERAL_INFO_ABOUT_THE_PORTAL,
PATHNAME_TRANSPORT_GENERAL_ITS,
PATHNAME_TRANSPORT_GENERAL_ROLES,
PATHNAME_TRANSPORT_USERS_NEWS,
PATHNAME_TRANSPORT_USERS_DATA_IN_NAP,
PATHNAME_TRANSPORT_USERS_WHAT,
PATHNAME_TRANSPORT_USERS_WHERE,
PATHNAME_TRANSPORT_PROVIDERS_ADD,
PATHNAME_TRANSPORT_PROVIDERS_COMPLIANCE
} from '../constants/constants';
import ScrollToTop from '../components/scroll-to-top';
import { getConfig } from '../config';
Expand All @@ -59,8 +68,8 @@ import { CmsArticlePage } from '../pages/cms-article-page/cms-article-page';
import OrganizationsRouter from '../pages/organizations';
import InformationPage from '../pages/cms-information-page';
import TransportPage from '../pages/cms-transport-page';
import RequestsPage from '../pages/requests';
import { AiProjectPage } from '../pages/ai-project-page';
import RequestsPage from '../pages/requests';
import { parseSearchParams } from '../lib/location-history-helper';
import routes from '../routes';

Expand Down Expand Up @@ -115,8 +124,17 @@ export function App({ language, onChangeLanguage }) {
[PATHNAME_ABOUT_CONCEPTS]: InformationPage,
[PATHNAME_ABOUT_INFORMATIONMODELS]: InformationPage,
[PATHNAME_AI]: AiProjectPage,
[PATHNAME_TRANSPORT]: TransportPage,
[PATHNAME_REQUESTS]: RequestsPage
[PATHNAME_REQUESTS]: RequestsPage,
[PATHNAME_TRANSPORT_GENERAL]: TransportPage,
[PATHNAME_TRANSPORT_GENERAL_INFO_ABOUT_THE_PORTAL]: TransportPage,
[PATHNAME_TRANSPORT_GENERAL_ITS]: TransportPage,
[PATHNAME_TRANSPORT_GENERAL_ROLES]: TransportPage,
[PATHNAME_TRANSPORT_USERS_NEWS]: TransportPage,
[PATHNAME_TRANSPORT_USERS_DATA_IN_NAP]: TransportPage,
[PATHNAME_TRANSPORT_USERS_WHAT]: TransportPage,
[PATHNAME_TRANSPORT_USERS_WHERE]: TransportPage,
[PATHNAME_TRANSPORT_PROVIDERS_ADD]: TransportPage,
[PATHNAME_TRANSPORT_PROVIDERS_COMPLIANCE]: TransportPage
};

return (
Expand Down
62 changes: 62 additions & 0 deletions src/app/breadcrumbs/breadcrumbs.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ import {
PATHNAME_ABOUT_CONCEPTS,
PATHNAME_ABOUT_INFORMATIONMODELS,
PATHNAME_AI,
PATHNAME_TRANSPORT_GENERAL,
PATHNAME_TRANSPORT_GENERAL_INFO_ABOUT_THE_PORTAL,
PATHNAME_TRANSPORT_GENERAL_ITS,
PATHNAME_TRANSPORT_GENERAL_ROLES,
PATHNAME_TRANSPORT_USERS_NEWS,
PATHNAME_TRANSPORT_USERS_WHERE,
PATHNAME_TRANSPORT_USERS_WHAT,
PATHNAME_TRANSPORT_USERS_DATA_IN_NAP,
PATHNAME_TRANSPORT_PROVIDERS_ADD,
PATHNAME_TRANSPORT_PROVIDERS_COMPLIANCE,
PATHNAME_REQUESTS
} from '../../constants/constants';
import DatasetBreadcrumb from './dataset-breadcrumb';
Expand Down Expand Up @@ -137,6 +147,58 @@ const routes = [
path: PATHNAME_AI,
breadcrumb: () => <PathNameBreadcrumb pathName='ai' />
},
{
path: PATHNAME_TRANSPORT_GENERAL,
breadcrumb: () => <PathNameBreadcrumb pathName='transportGeneral' />
},
{
path: PATHNAME_TRANSPORT_GENERAL_ROLES,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportRolesAndResponsibilies' />
)
},
{
path: PATHNAME_TRANSPORT_GENERAL_ITS,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportItsDirectiveAndDelegatedRegulations' />
)
},
{
path: PATHNAME_TRANSPORT_GENERAL_INFO_ABOUT_THE_PORTAL,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportInformationAboutThePortal' />
)
},
{
path: PATHNAME_TRANSPORT_USERS_NEWS,
breadcrumb: () => <PathNameBreadcrumb pathName='transportNews' />
},
{
path: PATHNAME_TRANSPORT_USERS_WHERE,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportWhereDoIFindTheData' />
)
},
{
path: PATHNAME_TRANSPORT_USERS_WHAT,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportWhatDataIsAvailable' />
)
},
{
path: PATHNAME_TRANSPORT_USERS_DATA_IN_NAP,
breadcrumb: () => <PathNameBreadcrumb pathName='transportDataInNap' />
},
{
path: PATHNAME_TRANSPORT_PROVIDERS_ADD,
breadcrumb: () => <PathNameBreadcrumb pathName='transportAddData' />
},
{
path: PATHNAME_TRANSPORT_PROVIDERS_COMPLIANCE,
breadcrumb: () => (
<PathNameBreadcrumb pathName='transportDeclarationOfCompliance' />
)
},
{
path: PATHNAME_REQUESTS,
breadcrumb: () => <PathNameBreadcrumb pathName='requests' />
Expand Down
26 changes: 21 additions & 5 deletions src/components/side-menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { NavLink as RouteLink } from 'react-router-dom';
import SC from './styled';

interface MenuItem {
id: string;
id?: string;
title: string;
items?: MenuItem[];
}

interface Props {
Expand All @@ -16,10 +17,25 @@ interface Props {
const SideMenu: FC<Props> = ({ menuItems = [], isSticky, ...props }) => (
<SC.Menu $isSticky={isSticky} {...props}>
<ul>
{menuItems.map(({ id, title: menuItemTitle }) => (
<SC.MenuItem key={id}>
<RouteLink to={id}>{menuItemTitle}</RouteLink>
</SC.MenuItem>
{menuItems.map(({ id, title: menuItemTitle, items }) => (
<>
<SC.MenuItem key={id} isGroup={items && items.length > 0 && !id}>
{id ? (
<RouteLink to={id}>{menuItemTitle}</RouteLink>
) : (
<span>{menuItemTitle}</span>
)}
</SC.MenuItem>
{items?.map(({ id: subId, title: subMenuItemTitle }) => (
<SC.SubMenuItem key={subId}>
{subId ? (
<RouteLink to={subId}>{subMenuItemTitle}</RouteLink>
) : (
<span>{subMenuItemTitle}</span>
)}
</SC.SubMenuItem>
))}
</>
))}
</ul>
</SC.Menu>
Expand Down
27 changes: 19 additions & 8 deletions src/components/side-menu/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,24 @@ const Menu = styled.nav<Props>`
`}
`;

const MenuItem = styled.li`
const MenuItem = styled.li<{ isGroup?: boolean }>`
align-items: center;
display: flex;
list-style: none;
${({ isGroup = false }) =>
isGroup
? css`
font-weight: ${t.fontWeight('FW500')};
`
: css`
&:hover {
background-color: ${({ theme }) => theme.light};
border-radius: 5px;
flex: 1;
}
`}
& > a {
color: ${({ theme }) => theme.dark};
flex: 1;
Expand All @@ -57,16 +70,14 @@ const MenuItem = styled.li`
flex: 1;
}
&:hover {
background-color: ${({ theme }) => theme.light};
border-radius: 5px;
flex: 1;
}
${onMobileView} {
margin: 0;
padding: 12px 0;
}
`;

export default { Menu, MenuItem };
const SubMenuItem = styled(MenuItem)`
margin-left: 1em;
`;

export default { Menu, MenuItem, SubMenuItem };
5 changes: 3 additions & 2 deletions src/components/transport-portal-footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import Link from '@fellesdatakatalog/link';

import {
PATHNAME_ABOUT_REGISTRATION,
PATHNAME_DATASETS
PATHNAME_DATASETS,
PATHNAME_TRANSPORT_GENERAL
} from '../../constants/constants';
import translations from '../../lib/localization';

Expand All @@ -31,7 +32,7 @@ const TransportPortalFooter: FC<Props> = () => (
<Link to={PATHNAME_DATASETS} as={RouteLink}>
{translations.footer.searchDatasets}
</Link>
<Link href='https://transportportal.atlas.vegvesen.no/no/gen/about/'>
<Link to={PATHNAME_TRANSPORT_GENERAL} as={RouteLink}>
{translations.menu.aboutNap}
</Link>
<Link to={PATHNAME_ABOUT_REGISTRATION} as={RouteLink}>
Expand Down
14 changes: 13 additions & 1 deletion src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,20 @@ export const PATHNAME_COMMUNITY_COMMENTS = '/category/12/kommentartråder';
export const PATHNAME_AI = '/kunstig-intelligens';
export const EXTERNAL_AI_PAGE =
'https://www.digdir.no/kunstig-intelligens/kunstig-intelligens-i-offentlig-sektor/4276';
export const PATHNAME_TRANSPORT = '/transport';
export const PATHNAME_REQUESTS = '/requests';
export const PATHNAME_TRANSPORT = '/transport';
export const PATHNAME_TRANSPORT_GENERAL = `${PATHNAME_TRANSPORT}/general`;
export const PATHNAME_TRANSPORT_GENERAL_ROLES = `${PATHNAME_TRANSPORT_GENERAL}/roles-and-responsibilities`;
export const PATHNAME_TRANSPORT_GENERAL_ITS = `${PATHNAME_TRANSPORT_GENERAL}/its-directive-and-delegated-regulations`;
export const PATHNAME_TRANSPORT_GENERAL_INFO_ABOUT_THE_PORTAL = `${PATHNAME_TRANSPORT_GENERAL}/information-about-the-portal`;
export const PATHNAME_TRANSPORT_USERS = `${PATHNAME_TRANSPORT}/users`;
export const PATHNAME_TRANSPORT_USERS_NEWS = `${PATHNAME_TRANSPORT_USERS}/news`;
export const PATHNAME_TRANSPORT_USERS_WHERE = `${PATHNAME_TRANSPORT_USERS}/where-do-i-find-the-data`;
export const PATHNAME_TRANSPORT_USERS_WHAT = `${PATHNAME_TRANSPORT_USERS}/what-data-is-available`;
export const PATHNAME_TRANSPORT_USERS_DATA_IN_NAP = `${PATHNAME_TRANSPORT_USERS}/data-in-nap`;
export const PATHNAME_TRANSPORT_PROVIDERS = `${PATHNAME_TRANSPORT}/providers`;
export const PATHNAME_TRANSPORT_PROVIDERS_ADD = `${PATHNAME_TRANSPORT_PROVIDERS}/add-data`;
export const PATHNAME_TRANSPORT_PROVIDERS_COMPLIANCE = `${PATHNAME_TRANSPORT_PROVIDERS}/declaration-of-compliance`;

export const PARAGRAPH__BODY = 'paragraph--body';
export const PARAGRAPH__IMAGE = 'paragraph--image';
Expand Down
38 changes: 17 additions & 21 deletions src/l10n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,20 @@
"aboutConcepts": "About concept catalog",
"aboutInformationModels": "About information model catalog",
"ai": "Artificial intelligence",
"requests": "Requests"
"requests": "Requests",
"transportGeneral": "General information",
"transportInformationAboutThePortal": "Information about the portal",
"transportRolesAndResponsibilies": "Roles and responsibilities",
"transportItsDirectiveAndDelegatedRegulations": "ITS directive and delegated regulations",
"transportUsers": "For data users",
"transportNews": "News",
"transportWhereDoIFindTheData": "Where do I find the data?",
"transportWhatDataIsAvailable": "What data is available?",
"transportDataInNap": "Data in NAP",
"transportProviders": "For data providers",
"transportAddData": "Add data",
"transportDeclarationOfCompliance": "Declaration of Compliance"

},
"query": {
"intro": "Example: public transport",
Expand All @@ -193,15 +206,14 @@
},
"page": {
"navigation": "Sidenavigering",
"next": "Next page",
"prev": "Previous page",
"next": "Neste side",
"prev": "Forrige side",
"resultsTab": "All",
"datasetTab": "Datasets",
"apiTab": "APIs",
"termTab": "Concepts",
"informationModelTab": "Information models",
"serviceTab": "Services and events",
"requests": "Requests"
"serviceTab": "Services and events"
},
"hitstats": {
"nosearch": "Search among {0} datasets, {1} APIs, {2} concepts and {3} information models",
Expand All @@ -225,7 +237,6 @@
"standard": "Standard",
"showmore": "Show more",
"showfewer": "Show fewer",
"showAll": "Show all",
"publishers": {
"STAT": "Central authority",
"FYLKE": "County",
Expand Down Expand Up @@ -1175,20 +1186,5 @@
"email": "E-mail:",
"submitNewProject": "You can register new projects here:",
"submit": "Register"
},
"requestsPage": {
"title": "Requests",
"ingress": "Here you will find an overview of all requests published in the {lenke}. You can subscribe to, vote on, or comment on requests.",
"requests": "Requests from the Data Community",
"votes": "Number of Votes",
"views": "Number of Views",
"createRequest": "Create request",
"requestData": "Request data",
"requestDataInfo": "Do you want to request data, APIs, or anything else you can do it here. You will be redirected to datalandsbyen.no.",
"newestToOldest": "Newest to Oldest",
"mostVotes": "Most Votes",
"mostViews": "Most Views",
"view": "View",
"search": "Free text search in titles"
}
}
Loading

0 comments on commit caf7e54

Please sign in to comment.