Skip to content

Commit

Permalink
Feature/81 resources refactoring f (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Huber-David authored Nov 28, 2024
1 parent f38e421 commit 4e880e2
Show file tree
Hide file tree
Showing 70 changed files with 1,054 additions and 1,170 deletions.
8 changes: 8 additions & 0 deletions .coverageignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src/common/components/fields/entry/TextEntry.tsx
src/components/detailsPage/layout/content/DetailsContent.tsx
src/components/detailsPage/layout/mainContent/DetailsMainContent.tsx
src/components/detailsPage/layout/mainPage/DetailsPage.tsx
src/components/detailsPage/pages/resources/components/map/ResourceMap.tsx
src/components/home/Home.tsx
src/components/main/App.js
src/common/components/buttons/ShowMapToggleButton.tsx
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ module.exports = {
// these scripts will be executed in the testing environment immediately before executing the test code itself.
setupFiles: ['./jest.setup.js'],

transformIgnorePatterns: [
'/node_modules/(?!vis-network).+\\.js$'
],

// Jest transformations -- this adds support for TypeScript
// using @swc/jest
transform: {
Expand Down
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"js-file-download": "^0.4.12",
"jwt-decode": "^4.0.0",
"keycloak-js": "^22.0.5",
"@vcmap/core": "^6.0.6",
"copy-webpack-plugin": "^12.0.2",
"markdown-to-jsx": "^7.6.2",
"mem": "^10.0.0",
"moment": "^2.30.1",
Expand Down Expand Up @@ -54,7 +56,8 @@
"util": "^0.12.5",
"uuid": "^9.0.0",
"vis-network": "^9.1.9",
"web-vitals": "^4.2.4"
"web-vitals": "^4.2.4",
"webpack": "^5.94.0"
},
"scripts": {
"start": "react-app-rewired start",
Expand Down Expand Up @@ -93,6 +96,11 @@
"@types/rdflib": "^1.2.0",
"@types/react-dom": "^18.3.1",
"@types/css-modules": "^1.0.5",
"@types/ol": "^7.0.0",
"@types/cesium": "^1.70.4",
"browserify-zlib": "^0.2.0",
"eslint-plugin-react-hooks": "^4.6.2",
"https-browserify": "^1.0.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -104,6 +112,7 @@
"@swc/jest": "^0.2.37",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"react-app-rewired": "^2.2.1",
"stream-http": "^3.2.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-react": "^7.37.2",
"customize-cra": "^1.0.0",
Expand Down
27 changes: 25 additions & 2 deletions public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,21 @@
},
"resources": {
"search-bar-text": "Suchen Sie nach speziellen Ressourcen",
"no-resources-available": "Keine Resourcen verfügbar!"
"no-resources-available": "Keine Resourcen verfügbar!",
"resource-detail-not-available": "Ressourcendetails sind nicht verfügbar",
"provided-by": "Bereitgestellt von",
"copyright-owned-by": "Urheberrechtlich geschützt von",
"license": "Lizenz",
"containsPII": "Enthält personenbezogene Daten",
"expiration-date-time": "Ablaufdatum",
"obsolete-date-time": "Veraltetes Datum",
"road-types": "Straßentypen",
"lane-types": "Fahrbahntypen",
"level-of-detail": "Detailgrad",
"traffic-direction": "Verkehrsrichtung",
"download-description": "Beschreibung herunterladen",
"contact-provider": "Anbieter kontaktieren",
"not-found": "Ressource nicht gefunden"
},
"ontologies": {
"title": "Ontologie",
Expand All @@ -571,6 +585,15 @@
"not-authenticated": "Nicht berechtigt",
"results": "Ergebnisse",
"is-loading": "es wird geladen...",
"close": "Schließen"
"close": "Schließen",
"no-title": "Kein Titel vorhanden",
"no-description": "Keine Beschreibung vorhanden",
"general-details": "Allgemeine Details",
"content-details": "Inhaltsdetails",
"compatible-offerings": "Kompatible Angebote",
"directly-related-offerings": "Direkt verwandte Angebote",
"not-specified": "Nicht spezifiziert",
"yes": "Ja",
"no": "Nein"
}
}
27 changes: 25 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,21 @@
},
"resources": {
"search-bar-text": "Search for special resources",
"no-resources-available": "No resources available"
"no-resources-available": "No resources available",
"resource-detail-not-available": "Resource details is not available",
"provided-by": "Provided by",
"copyright-owned-by": "Copyright owned by",
"license": "License",
"containsPII": "Contains PII",
"expiration-date-time": "Expiration date time",
"obsolete-date-time": "Obsolete date time",
"road-types": "Road types",
"lane-types": "Lane types",
"level-of-detail": "Level of detail",
"traffic-direction": "Traffic direction",
"download-description": "Download description",
"contact-provider": "Contact provider",
"not-found": "Resource not found"
},
"ontologies": {
"title": "Ontology",
Expand All @@ -573,6 +587,15 @@
"not-authenticated": "You are not authenticated!",
"results": "results",
"is-loading": "loading...",
"close": "Close"
"close": "Close",
"no-title": "No title available",
"no-description": "No description available",
"general-details": "General details",
"content-details": "Content details",
"compatible-offerings": "Compatible offerings",
"directly-related-offerings": "Directly related offerings",
"not-specified": "Not specified",
"yes": "Yes",
"no": "No"
}
}
26 changes: 26 additions & 0 deletions public/simple-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"properties": {},
"name": "Module",
"startingMapName": "CesiumMap",
"maps": [
{
"type": "CesiumMap",
"name": "CesiumMap"
}
],
"layers": [
{
"type": "OpenStreetMapLayer",
"name": "OpenStreetMapLayer(1)",
"properties": {
"attributions": {
"provider": "OpenStreetMap contributors",
"url": "http://www.openstreetmap.org/",
"year": "2024"
}
},
"activeOnStartup": true,
"zIndex": 0
}
]
}
1 change: 1 addition & 0 deletions public/vienna-streets.geojson

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/common/components/buttons/ShowMapToggleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import ListIcon from '@mui/icons-material/List';
import MapIcon from '@mui/icons-material/Map';
import Text from 'common/components/fields/text/Text';
import React from 'react';
import { useTranslation } from 'react-i18next';

import Text from '../fields/text/Text';
import Svg from '../icon/Svg';

import styles from './ShowMapButton.module.css';
Expand Down
22 changes: 22 additions & 0 deletions src/common/components/fields/entry/TextEntry.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.textEntryContainer {
}

.nameTextField {
display: inline-block;
margin-top: 0;
margin-right: 1rem;
font-weight: bold;

overflow-wrap: break-word;
word-wrap: break-word;
}

.valueTextField {
margin-top: 0;
display: inline-block;

overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-all;
}

24 changes: 24 additions & 0 deletions src/common/components/fields/entry/TextEntry.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { FC } from 'react';
import { useTranslation } from 'react-i18next';

import Text from '../text/Text';

import styles from './TextEntry.module.css'

interface EntryProps {
name: string;
value: string;
}

const TextEntry: FC<EntryProps> = ({ name, value }) => {
const { t } = useTranslation();

return (
<div className={styles.textEntryContainer}>
<Text className={styles.nameTextField}>{name}</Text>
<Text className={styles.valueTextField}>{value || t('common.not-specified')}</Text>
</div>
)
}

export default TextEntry
4 changes: 4 additions & 0 deletions src/common/components/fields/link/Link.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ a.link {
color: var(--secondary-color);
font-weight: normal;
text-decoration: none;

overflow-wrap: break-word;
word-wrap: break-word;
word-break: break-all;
}
14 changes: 13 additions & 1 deletion src/common/components/fields/text/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from './Text.module.css';
interface IText {
className?: string;
visible?: boolean;
children?: ReactElement | string;
children?: ReactElement | string | (ReactElement | string)[];
}

const Text: FC<IText> = ({ className, visible = true, children }) => {
Expand All @@ -16,6 +16,18 @@ const Text: FC<IText> = ({ className, visible = true, children }) => {
if (typeof children === 'string') {
return <p className={classnames([className, styles.text])}>{children}</p>;
}
if (Array.isArray(children)) {
return (<div>
{
children.map((child, index) => {
if (typeof child === 'string') {
return (<span key={index} className={classnames([className, styles.text])}>{child}</span>)
}
return <>{child}</>
})
}
</div>)
}
return <>{children}</>
};

Expand Down
1 change: 0 additions & 1 deletion src/common/components/fields/title/Title.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@

overflow-wrap: break-word;
word-wrap: break-word;
/*word-break: break-all;*/
}
11 changes: 11 additions & 0 deletions src/common/components/header/Header.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,21 @@
.header-breadcrumb {
margin: 0;
user-select: none;
word-break: break-all;
}

@media (max-width: 960px) {
.header-breadcrumb {
font-size: 2.8rem;
}
}

@media (max-width: 768px) {
.header-container {
margin-top: 5.4rem; /* This makes content start at the bottom of the navbar, because this is the height of the navbar */
}

.header-breadcrumb {
font-size: 2.4rem;
}
}
7 changes: 2 additions & 5 deletions src/common/components/layouts/Layout.module.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
.main {
margin: 0 3rem 3rem;
box-sizing: border-box;
}

.horizontal {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
gap: 30px;
box-sizing: border-box;
gap: 3rem;
}

.vertical {
display: flex;
flex-direction: column;
align-items: stretch;
width: 100%;
gap: 30px;
box-sizing: border-box;
gap: 3rem;
}
29 changes: 29 additions & 0 deletions src/common/components/map/Map.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.myMapContainer {
position: relative;
width: 100%;
height: 100%;
background-color: var(--secondary-color-light);
}
.mapElement {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: hidden;
}
.cesium-widget,
.cesium-widget canvas {
width: 100%;
height: 100%;
touch-action: none;
}
.map-overlay {
position: absolute;
z-index: 1;
}
.controls {
position: absolute;
bottom: 20px;
left: 15px;
}
Loading

0 comments on commit 4e880e2

Please sign in to comment.