Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/steps/sylt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 17 additions & 10 deletions src/components/SideStepper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box, Button, Card, CardContent, CardHeader, Step, StepButton, StepContent, Stepper, Typography } from "@mui/material";
import { TOPIC_TYPE } from "../topics.model";

import { AgricultureOutlined, WbSunnyOutlined, FloodOutlined, BubbleChartOutlined } from '@mui/icons-material';
import { Description, AgricultureOutlined, WbSunnyOutlined, FloodOutlined, BubbleChartOutlined } from '@mui/icons-material';
import { useNavigate } from "react-router-dom";

interface SideStepperProps {
Expand All @@ -10,11 +10,12 @@ interface SideStepperProps {
}

const TOPIC_ORDER = {
uncertainty: 0,
weather: 1,
agriculture: 2,
extremes: 3,
other: 4,
intro: 0,
uncertainty: 1,
weather: 2,
agriculture: 3,
extremes: 4,
other: 5,
}

const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) => {
Expand All @@ -24,6 +25,12 @@ const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) =
<Stepper orientation="vertical" activeStep={TOPIC_ORDER[activeTopic]} nonLinear>

<Step key="0">
<StepButton color="inherit" onClick={() => jumpToTopic('intro')} icon={<Description />}>
<Typography variant="caption">Intro</Typography>
</StepButton>
</Step>

<Step key="1">
<StepButton color="inherit" onClick={() => jumpToTopic('uncertainty')} icon={<BubbleChartOutlined />}>
<Typography variant="caption">Uncertainty and Risk</Typography>
</StepButton>
Expand All @@ -32,7 +39,7 @@ const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) =
</StepContent>
</Step>

<Step key="1">
<Step key="2">
<StepButton color="inherit" onClick={() => jumpToTopic('weather')} icon={<WbSunnyOutlined />}>
<Typography variant="caption">Weather and Climate</Typography>
</StepButton>
Expand All @@ -41,7 +48,7 @@ const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) =
</StepContent>
</Step>

<Step key="2">
<Step key="3">
<StepButton color="inherit" onClick={() => jumpToTopic('agriculture')} icon={<AgricultureOutlined />}>
<Typography variant="caption">Agriculture</Typography>
</StepButton>
Expand All @@ -50,7 +57,7 @@ const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) =
</StepContent>
</Step>

<Step key="3">
<Step key="4">
<StepButton color="inherit" onClick={() => jumpToTopic('extremes')} icon={<FloodOutlined />}>
<Typography variant="caption">Extremes</Typography>
</StepButton>
Expand All @@ -59,7 +66,7 @@ const SideStepper: React.FC<SideStepperProps> = ({ jumpToTopic, activeTopic }) =
</StepContent>
</Step>

{/* <Step key="4">
{/* <Step key="5">
<StepButton color="inherit" onClick={() => jumpToTopic('other')}>
<Typography variant="caption">Other / Not specified</Typography>
</StepButton>
Expand Down
3 changes: 2 additions & 1 deletion src/topics.model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { createRef } from "react";

export type TOPIC_TYPE = 'uncertainty' | 'weather' | 'agriculture' | 'extremes' | 'other';
export type TOPIC_TYPE = 'intro' | 'uncertainty' | 'weather' | 'agriculture' | 'extremes' | 'other';

export const TOPICS = {
intro: createRef<HTMLElement>(),
uncertainty: createRef<HTMLElement>(),
weather: createRef<HTMLElement>(),
agriculture: createRef<HTMLElement>(),
Expand Down
63 changes: 63 additions & 0 deletions src/topics/Intro.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { Grid, Typography } from "@mui/material";
import { useSelector } from "react-redux";
import HoverTooltip from "../components/HoverTooltip";
import StepImage from "../components/StepImage";
import TopicWrapper from "../components/TopicWrapper";
import { RootState } from "../store";
import { TopicStep } from "../topics.model";
import sylt from './steps/sylt.png';

/**
* Build the text elements using React-MUI (material ui)
*
* To adjust to screen sizes, use the <Typography> component: https://mui.com/material-ui/react-typography/
*
* For Tooltips, use the <HoverTooltip linkName="link-text" />
* with image: <HoverTooltip img="/local/path" linkName="link-text" /> or <HoverTooltip img="https://external.url/path/to/img.png" linkName="link-text"/>
* load text from wikipedia: <HoverTooltip wikipedia="PageName" /> ie. <HoverTooltip wikipedia="Normalverteilung" /> in steps_de
* and <HoverTooltip wikipedia="Normal distribution" linkName="link-text"> in steps_en
* If you want to write the text yourself do it like: <HoverTooltip linkName="link-text">This is my own tooltip text...</Tooltip>
*/

const steps_de: TopicStep[] = [
{
content: <>
<Typography variant="h1">RUINS Projekt</Typography>
<div>
<img alt='Intro' style={{ width: 800 }} src={String(sylt)} />
</div>
<Typography variant="h3"sx={{marginTop: '5rem'}}>Willkommen auf der RUINSapp</Typography>
<Typography variant="body2" component="p" sx={{marginTop: '3rem'}}>
Mehrere interaktive Apps ermöglichen es Ihnen das RUINS Projekt zu erkunden. Über die Unsicherheiten in der Umweltsystem Modellierung,
über Wetter und Klimamodelle, Landnutzung und Extremereignisse.
</Typography>
<Typography variant="body2" component="p">
Scrollen Sie nach unten oder wählen sie direkt die Themen links aus.
</Typography>
</>
}
];

const steps_en: TopicStep[] = steps_de;

const Intro: React.FC = () => {
// get the correct steps
const lang = useSelector((state: RootState) => state.settings.lang);
const steps = lang === 'de' ? steps_de : steps_en;

return (
<Grid container spacing={1}>
<Grid item xs={6}>
<TopicWrapper steps={steps}/>
</Grid>

<Grid item xs={6}>
<StepImage />
</Grid>

</Grid>

);
}

export default Intro;