diff --git a/new-client/package.json b/new-client/package.json index f7d040617..e0b35ea8d 100644 --- a/new-client/package.json +++ b/new-client/package.json @@ -45,7 +45,6 @@ "@fontsource/roboto": "^5.0.3", "@jonkoops/matomo-tracker": "^0.7.0", "@mui/icons-material": "^5.11.16", - "@mui/lab": "^5.0.0-alpha.134", "@mui/material": "^5.13.6", "@mui/x-data-grid": "^5.17.14", "@nieuwlandgeo/sldreader": "^0.2.17", @@ -73,7 +72,6 @@ "react-number-format": "^4.9.4", "react-rnd": "^10.3.7", "react-scroll": "^1.8.9", - "recharts": "^2.1.16", "rehype-raw": "^6.1.1", "remark-gfm": "^3.0.1", "x2js": "^3.4.4", diff --git a/new-client/src/components/Diagram.js b/new-client/src/components/Diagram.js deleted file mode 100644 index 2c97fdd31..000000000 --- a/new-client/src/components/Diagram.js +++ /dev/null @@ -1,93 +0,0 @@ -import React from "react"; -import { - LineChart, - Line, - XAxis, - YAxis, - CartesianGrid, - Tooltip, - Legend, -} from "recharts"; -import { hfetch } from "utils/FetchWrapper"; - -class DiagramView extends React.PureComponent { - state = { - data: false, - }; - - // TODO: Add propTypes - - componentDidMount() { - const { source, feature } = this.props; - const url = this.parse(source, feature.getProperties()); - this.load(url); - } - - parse(str, properties) { - if (str && typeof str === "string") { - (str.match(/{(.*?)}/g) || []).forEach((property) => { - function lookup(o, s) { - s = s.replace("{", "").replace("}", "").split("."); - switch (s.length) { - case 1: - return o[s[0]] || ""; - case 2: - return o[s[0]][s[1]] || ""; - case 3: - return o[s[0]][s[1]][s[2]] || ""; - default: - return ""; - } - } - - str = str.replace(property, lookup(properties, property)); - }); - } - return str; - } - - load(url) { - hfetch(url).then((response) => { - response.json().then((rsp) => { - const data = rsp.features.map((feature) => { - return { - date: feature.properties.datetime.split("T")[0], - value: feature.properties.value, - }; - }); - this.setState({ - data: data, - }); - }); - }); - } - - render() { - if (this.state.data) { - return ( - - - - - - - - - ); - } else { - return
Laddar
; - } - } -} - -export default DiagramView; diff --git a/new-client/src/components/FeatureInfo/FeatureInfoContainer.js b/new-client/src/components/FeatureInfo/FeatureInfoContainer.js index 37a42da80..2e49eb11d 100644 --- a/new-client/src/components/FeatureInfo/FeatureInfoContainer.js +++ b/new-client/src/components/FeatureInfo/FeatureInfoContainer.js @@ -161,36 +161,6 @@ class FeatureInfoContainer extends React.PureComponent { ); } - // shortcode(str) { - // const codes = []; - // let shortcodes = str.match(/\[(.*?)\]/g); - // shortcodes = shortcodes === null ? [] : shortcodes; - - // if (shortcodes) { - // shortcodes.forEach((code) => { - // str = str.replace(code, ""); - // var params = code.replace("[", "").replace("]", "").split(" "); - // var c = {}; - - // params.forEach((param, i) => { - // if (i === 0) { - // c.shortcode = param; - // } else { - // let parts = param.split("="); - // c[parts[0]] = param.replace(parts[0] + "=", "").replace(/"/g, ""); - // } - // }); - // codes.push(c); - // }); - // return { - // str: str, - // codes: codes, - // }; - // } else { - // return; - // } - // } - getFeatureProperties = (feature) => { let properties = feature.getProperties(); properties = this.featurePropsParsing.extractPropertiesFromJson(properties); @@ -209,17 +179,6 @@ class FeatureInfoContainer extends React.PureComponent { // an informative feature-info. const { displayName: caption, infoclickDefinition: markdown } = getInfoClickInfoFromLayerConfig(feature, layer); - // TODO: shortCodes, remove? - const shortcodes = []; - // Disabled shortcodes for now as they mess with Markdown tags - // for Links and Imgs that use "[" and "]". - // if (markdown) { - // let transformed = this.shortcode(markdown); - // if (transformed) { - // shortcodes = transformed.codes; - // markdown = transformed.str; - // } - // } // When we've grabbed the markdown-definition for the layer, we can create the // information that we want to display to the user by combining the definition with @@ -232,7 +191,6 @@ class FeatureInfoContainer extends React.PureComponent { value: value, loading: false, caption: caption, - shortcodes: shortcodes, selectedIndex: newIndex, markdown: markdown, }, @@ -252,30 +210,12 @@ class FeatureInfoContainer extends React.PureComponent { } }; - // renderShortcodes(shortcodes, feature) { - // return shortcodes.map((shortcode, i) => { - // switch (shortcode.shortcode) { - // case "diagram": - // return ( - // - // ); - // case "table": - // return ( - // - // ); - // default: - // return null; - // } - // }); - // } - isReadyToShowInfo = () => { - const { caption, value, loading, shortcodes } = this.state; - return caption && !loading && value && shortcodes; + const { caption, value, loading } = this.state; + return caption && !loading && value; }; renderFeatureInformation = () => { - // const { caption, value, shortcodes, markdown } = this.state; const { caption, value } = this.state; return ( diff --git a/new-client/src/components/Table.js b/new-client/src/components/Table.js deleted file mode 100644 index 14fa18252..000000000 --- a/new-client/src/components/Table.js +++ /dev/null @@ -1,98 +0,0 @@ -import React from "react"; -import { hfetch } from "utils/FetchWrapper"; -import { styled } from "@mui/material/styles"; - -const StyledTable = styled("table")(() => ({ - borderCollapse: "collapse", - borderColor: "black", - margin: "10px", - "& th": { - textAlign: "left", - }, - "& td": { - border: "1px solid #999", - }, - "& thead": { - borderBottom: "2px solid", - }, -})); - -class TableView extends React.PureComponent { - state = { - data: false, - }; - - // TODO: Add propTypes - - componentDidMount() { - const { source, feature } = this.props; - const url = this.parse(source, feature.getProperties()); - this.load(url); - } - - parse(str, properties) { - if (str && typeof str === "string") { - (str.match(/{(.*?)}/g) || []).forEach((property) => { - function lookup(o, s) { - s = s.replace("{", "").replace("}", "").split("."); - switch (s.length) { - case 1: - return o[s[0]] || ""; - case 2: - return o[s[0]][s[1]] || ""; - case 3: - return o[s[0]][s[1]][s[2]] || ""; - default: - return ""; - } - } - - str = str.replace(property, lookup(properties, property)); - }); - } - return str; - } - - load(url) { - hfetch(url).then((response) => { - response.json().then((rsp) => { - const data = rsp.features.map((feature) => { - return { - date: feature.properties.datetime.split("T")[0], - value: feature.properties.value, - }; - }); - this.setState({ - data: data, - }); - }); - }); - } - - render() { - if (this.state.data) { - return ( - - - - Datum - Mätvärde - - - - {this.state.data.map((dataPair, i) => ( - - {dataPair.date} - {dataPair.value} - - ))} - - - ); - } else { - return
Laddar
; - } - } -} - -export default TableView;