Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Drisch committed Jun 19, 2023
2 parents 98f7e6b + 9d4bd2d commit 081ddb5
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 85 deletions.
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><link rel="manifest" href="/manifest.json"/><link rel="stylesheet" href="/assets/fonts/fonts.css"/><title>MapComponents catalogue</title><script defer="defer" src="/static/js/main.1fd1a6f0.js"></script><link href="/static/css/main.c0676440.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><link rel="manifest" href="/manifest.json"/><link rel="stylesheet" href="/assets/fonts/fonts.css"/><title>MapComponents catalogue</title><script defer="defer" src="/static/js/main.88f95605.js"></script><link href="/static/css/main.c0676440.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
6 changes: 3 additions & 3 deletions docs/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"files": {
"main.css": "/static/css/main.c0676440.css",
"main.js": "/static/js/main.1fd1a6f0.js",
"main.js": "/static/js/main.88f95605.js",
"static/js/496.a7795644.chunk.js": "/static/js/496.a7795644.chunk.js",
"static/media/logo.svg": "/static/media/logo.c0efa20762a518d34c1c592b0f6cb321.svg",
"index.html": "/index.html",
"main.c0676440.css.map": "/static/css/main.c0676440.css.map",
"main.1fd1a6f0.js.map": "/static/js/main.1fd1a6f0.js.map",
"main.88f95605.js.map": "/static/js/main.88f95605.js.map",
"496.a7795644.chunk.js.map": "/static/js/496.a7795644.chunk.js.map"
},
"entrypoints": [
"static/css/main.c0676440.css",
"static/js/main.1fd1a6f0.js"
"static/js/main.88f95605.js"
]
}
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><link rel="manifest" href="/manifest.json"/><link rel="stylesheet" href="/assets/fonts/fonts.css"/><title>MapComponents catalogue</title><script defer="defer" src="/static/js/main.1fd1a6f0.js"></script><link href="/static/css/main.c0676440.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><meta name="msapplication-TileColor" content="#da532c"><meta name="theme-color" content="#ffffff"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"/><link rel="manifest" href="/manifest.json"/><link rel="stylesheet" href="/assets/fonts/fonts.css"/><title>MapComponents catalogue</title><script defer="defer" src="/static/js/main.88f95605.js"></script><link href="/static/css/main.c0676440.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion docs/static/js/main.1fd1a6f0.js.map

This file was deleted.

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions docs/static/js/main.88f95605.js.map

Large diffs are not rendered by default.

94 changes: 18 additions & 76 deletions src/components/StoryDetailView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, {
useState,
useContext,
useEffect,
useCallback,
useMemo,
} from "react";
import { useResolvedPath, Link } from "react-router-dom";
Expand All @@ -15,16 +14,13 @@ import DemoContext from "./DemoContext";

import useMediaQuery from "@mui/material/useMediaQuery";
import { Grid, Button } from "@mui/material";
//import HighlightOffIcon from "@mui/icons-material/HighlightOff";
//import ExtensionIcon from '@mui/icons-material/Extension';
//import ImportantDevicesIcon from '@mui/icons-material/ImportantDevices';
import ListItemSmall from "./ListItemSmall";
import Divider from "@mui/material/Divider";
import Tag from "./Tag.js";

import { useTranslation } from "react-i18next";

function StoryDetailView(props) {
function StoryDetailView() {
const mediaIsMobile = useMediaQuery("(max-width:900px)");
const basepath = useResolvedPath("/");
const { component_id } = useParams();
Expand Down Expand Up @@ -56,40 +52,25 @@ function StoryDetailView(props) {

const { t, i18n } = useTranslation();

const fetchDescription = useCallback(() => {
if (!componentData || (componentData && !componentData.name)) return;

let currentLanguage = i18n.resolvedLanguage;
fetch(
componentData.url +
"/catalogue/" +
componentData.name +
"." +
currentLanguage +
".html"
)
.then((res) => {
if (!res.ok) {
return t("noDescription");
}
return res.text();
})
.then((text) => {
setDescription(text);
});
}, [componentData, i18n.resolvedLanguage, t]);

useEffect(() => {
if (
demoContext?.componentData &&
typeof demoContext.componentData[component_id] !== "undefined"
) {
let currentLanguage = i18n.resolvedLanguage;
let componentTitle =
currentLanguage !== "en"
? demoContext.componentData[component_id].i18n[currentLanguage].title
: demoContext.componentData[component_id].title;
let componentTitle = demoContext.componentData[component_id].i18n?.[
currentLanguage
]?.title
? demoContext.componentData[component_id].i18n[currentLanguage].title
: demoContext.componentData[component_id].title;
setComponentTitle(componentTitle);
let componentDescription = demoContext.componentData[component_id].i18n?.[
currentLanguage
]?.description
? demoContext.componentData[component_id].i18n[currentLanguage]
.description
: demoContext.componentData[component_id].description;
setDescription(componentDescription);
}
}, [
component_id,
Expand All @@ -104,55 +85,17 @@ function StoryDetailView(props) {
setComponentData(demoContext.componentData[component_id]);
}, [demoContext.componentData, demoContext, component_id]);

useEffect(() => {
fetchDescription();
}, [fetchDescription]);

return (
<>
<Grid container>
<Grid item xs={12} md={6}>
<h1 style={{ marginTop: 0 }}>{componentTitle}</h1>
</Grid>
{/**
* add to bookmarks button
<Grid item xs={12} md={6}>
<div
style={{
display: "flex",
justifyContent: "flex-end",
}}
>
<Button
variant={bookmarkSet ? "contained" : "outlined"}
color="primary"
onClick={() => {
//add to cart but only if element not existing already
if (!demoContext.cartItems.includes(componentData.name)) {
demoContext.setCartItems([
...demoContext.cartItems,
componentData.name,
]);
}
}}
>
<StarIcon></StarIcon>
</Button>
</div>
</Grid>
*/}
</Grid>

<div
style={{ marginBottom: "50px" }}
dangerouslySetInnerHTML={{ __html: description }}
/>
<div style={{ marginBottom: "50px" }}>{description}</div>

<Grid
container
spacing={4}
key="contentContainer"
>
<Grid container spacing={4} key="contentContainer">
<Grid
item
md={8}
Expand Down Expand Up @@ -214,9 +157,8 @@ function StoryDetailView(props) {
></Divider>

<Grid container spacing={2} style={{ marginTop: "0px" }}>
{
componentData?.demos?.length &&
componentData.demos.map((demo,idx) => (
{componentData?.demos?.length &&
componentData.demos.map((demo, idx) => (
<Grid
item
xs={6}
Expand All @@ -231,7 +173,7 @@ function StoryDetailView(props) {
flexDirection: "column",
alignContent: "center",
color: theme.palette.common.white,
borderRadius: '8px'
borderRadius: "8px",
}}
component={Link}
variant="contained"
Expand Down

0 comments on commit 081ddb5

Please sign in to comment.