Skip to content

Commit

Permalink
Merge pull request #1034 from entur/react_migration
Browse files Browse the repository at this point in the history
react_migration
  • Loading branch information
testower authored Oct 14, 2024
2 parents f39e95a + cbb8d19 commit 4d56682
Show file tree
Hide file tree
Showing 108 changed files with 3,060 additions and 2,717 deletions.
1,209 changes: 365 additions & 844 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@mui/icons-material": "5.16.7",
"@mui/lab": "5.0.0-alpha.173",
"@mui/material": "5.16.7",
"@mui/x-date-pickers": "7.20.0",
"@reduxjs/toolkit": "2.2.8",
"@sentry/react": "7.119.2",
"@sentry/tracing": "7.114.0",
Expand All @@ -40,7 +41,6 @@
"leaflet": "1.9.4",
"lint-staged": "15.2.10",
"lodash.debounce": "4.0.8",
"material-ui": "0.20.2",
"moment": "2.30.1",
"oidc-client-ts": "3.1.0",
"prop-types": "15.8.1",
Expand Down
5 changes: 3 additions & 2 deletions src/actions/TiamatActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export const getContext = async (auth) => {
return context;
};

const handleQuery = (client, payload) => (dispatch) =>
client.query(payload).then((result) => {
const handleQuery = (client, payload) => (dispatch) => {
return client.query(payload).then((result) => {
dispatch(
createApolloThunk(
types.APOLLO_QUERY_RESULT,
Expand All @@ -94,6 +94,7 @@ const handleQuery = (client, payload) => (dispatch) =>
);
return result;
});
};

const handleMutation = (client, payload) => (dispatch) =>
client
Expand Down
28 changes: 19 additions & 9 deletions src/components/Dialogs/AddStopPlaceSuggestionListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ limitations under the Licence. */

import React, { Component } from "react";
import PropTypes from "prop-types";
import Checkbox from "material-ui/Checkbox";
import Checkbox from "@mui/material/Checkbox";
import ModalityIconImg from "../MainPage/ModalityIconImg";
import { injectIntl } from "react-intl";
import HasExpiredInfo from "../MainPage/HasExpiredInfo";
import { FormControlLabel } from "@mui/material";

class AddStopPlaceSuggestionListItem extends Component {
render() {
Expand All @@ -26,10 +27,14 @@ class AddStopPlaceSuggestionListItem extends Component {

return (
<div style={{ display: "flex", alignItems: "center", padding: 4 }}>
<Checkbox
disabled={suggestion && (suggestion.hasExpired || disabled)}
checked={checked}
onCheck={(e, v) => onCheck(suggestion.id, v)}
<FormControlLabel
control={
<Checkbox
disabled={suggestion && (suggestion.hasExpired || disabled)}
checked={checked}
onChange={(e, v) => onCheck(suggestion.id, v)}
/>
}
label={
<div style={{ display: "flex", alignItems: "center" }}>
{suggestion.isParent ? (
Expand All @@ -39,10 +44,16 @@ class AddStopPlaceSuggestionListItem extends Component {
type={suggestion.stopPlaceType}
submode={suggestion.submode}
style={{ marginRight: 5 }}
iconStyle={{ marginTop: -1 }}
/>
)}
<div style={{ fontSize: "0.9em", flex: 0.8 }}>
<div
style={{
fontSize: "0.9em",
flex: 0.8,
whiteSpace: "nowrap",
paddingRight: 10,
}}
>
{suggestion.name ? (
<span>{suggestion.name}</span>
) : (
Expand All @@ -53,8 +64,7 @@ class AddStopPlaceSuggestionListItem extends Component {
</div>
<div
style={{
fontSize: "0.8em",
lineHeight: "1.2em",
fontSize: "0.9em",
flex: 1.5,
display: "flex",
}}
Expand Down
20 changes: 11 additions & 9 deletions src/components/Dialogs/AltNamesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ limitations under the Licence. */

import React from "react";
import { connect } from "react-redux";
import MdDelete from "material-ui/svg-icons/action/delete";
import MdDelete from "@mui/icons-material/Delete";
import * as altNameConfig from "../../config/altNamesConfig";
import MdEdit from "material-ui/svg-icons/editor/mode-edit";
import IconButton from "material-ui/IconButton";
import MdEdit from "@mui/icons-material/ModeEdit";
import IconButton from "@mui/material/IconButton";
import { StopPlaceActions } from "../../actions/";
import ConfirmDialog from "./ConfirmDialog";
import { getPrimaryColor } from "../../config/themeConfig";
Expand Down Expand Up @@ -256,14 +256,14 @@ class AltNamesDialog extends React.Component {
this.handleEdit(i);
}}
>
<MdEdit color={getPrimaryColor()} />
<MdEdit color={"primary"} />
</IconButton>
<IconButton
onClick={() => {
this.handleRemoveName(i);
}}
>
<MdDelete color="rgb(223, 84, 74)" />
<MdDelete sx="color: rgb(223, 84, 74)" />
</IconButton>
</div>
) : null}
Expand Down Expand Up @@ -298,13 +298,15 @@ class AltNamesDialog extends React.Component {
translations={translations}
handleAddAltName={this.handleAddAltName.bind(this)}
handleTypeChange={(event, key, type) => {
this.setState({ type });
this.setState({ type: event.target.value });
}}
onLanguageChange={(event, key, lang) => {
this.setState({ lang });
this.setState({ lang: event.target.value });
debugger;
}}
onValueChange={(event, value) => {
this.setState({ value });
onValueChange={(event) => {
this.setState({ value: event.target.value });
debugger;
}}
lang={lang}
type={type}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialogs/CompassBearingDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
DialogContent,
DialogTitle,
} from "@mui/material";
import { TextField } from "material-ui";
import { TextField } from "@mui/material";

class CompassBearingDialog extends React.Component {
constructor(props) {
Expand Down
21 changes: 11 additions & 10 deletions src/components/Dialogs/CoordinatesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import {
DialogContent,
DialogTitle,
} from "@mui/material";
import { TextField } from "material-ui";
import { TextField } from "@mui/material";
import { extractCoordinates } from "../../utils/";

class CoordinatesDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
errorText: "",
coordinates: null,
};
}

Expand All @@ -40,9 +41,9 @@ class CoordinatesDialog extends React.Component {
handleClose: PropTypes.func.isRequired,
};

handleInputChange(event, newValue) {
handleInputChange(event) {
this.setState({
coordinates: newValue,
coordinates: event.target.value,
});
}

Expand All @@ -58,7 +59,6 @@ class CoordinatesDialog extends React.Component {
const coordinatesString = this.state
? this.state.coordinates
: this.props.coordinates;

if (typeof coordinatesString === "undefined") return;

const position = extractCoordinates(coordinatesString);
Expand Down Expand Up @@ -97,21 +97,22 @@ class CoordinatesDialog extends React.Component {
<DialogTitle>{confirmDialogTranslation.title}</DialogTitle>
<DialogContent>
{confirmDialogTranslation.body}

<TextField
hintText="lat,lng"
floatingLabelText={formatMessage({ id: "coordinates" })}
style={{ display: "block", margin: "auto", width: "90%" }}
fullWidth
error={!!this.state.errorText}
variant="standard"
placeholder="lat,lng"
label={formatMessage({ id: "coordinates" })}
value={coordinates}
onChange={this.handleInputChange.bind(this)}
errorText={this.state.errorText}
helperText={this.state.errorText}
/>
</DialogContent>
<DialogActions>
<Button
variant="text"
onClick={() => this.handleClose()}
style={{ marginRight: 5 }}
sx={{ marginRight: 5 }}
color="secondary"
>
{confirmDialogTranslation.cancel}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dialogs/DialogHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ limitations under the Licence. */

import React, { Component } from "react";
import PropTypes from "prop-types";
import MdClose from "material-ui/svg-icons/navigation/close";
import IconButton from "material-ui/IconButton";
import MdClose from "@mui/icons-material/Close";
import IconButton from "@mui/material/IconButton";

class DialogHeader extends Component {
render() {
Expand Down
61 changes: 31 additions & 30 deletions src/components/Dialogs/EditAltName.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
limitations under the Licence. */

import React, { Component } from "react";
import FlatButton from "material-ui/FlatButton";
import SelectField from "material-ui/SelectField";
import MenuItem from "material-ui/MenuItem";
import TextField from "material-ui/TextField";
import FlatButton from "@mui/material/Button";
import Select from "@mui/material/Select";
import MenuItem from "@mui/material/MenuItem";
import TextField from "@mui/material/TextField";
import * as altNameConfig from "../../config/altNamesConfig";
import { getIn } from "../../utils/";
import MdClose from "material-ui/svg-icons/navigation/close";
import IconButton from "material-ui/IconButton";
import MdClose from "@mui/icons-material/Close";
import IconButton from "@mui/material/IconButton";

class EditAltName extends Component {
constructor(props) {
Expand Down Expand Up @@ -89,55 +89,56 @@ class EditAltName extends Component {
</IconButton>
</div>
</div>
<SelectField
style={{ marginTop: -10 }}
<Select
style={{ marginTop: 10 }}
variant="standard"
fullWidth={true}
floatingLabelText={translations.nameType}
label={translations.nameType}
value={type}
onChange={(event, key, type) => {
onChange={(event) => {
this.setState({
type,
type: event.target.value,
});
}}
>
{altNameConfig.supportedNameTypes.map((type) => (
<MenuItem
key={"type-" + type}
value={type}
primaryText={formatMessage({
<MenuItem key={"type-" + type} value={type}>
{formatMessage({
id: `altNamesDialog.nameTypes.${type}`,
})}
/>
</MenuItem>
))}
</SelectField>
<SelectField
style={{ marginTop: -10 }}
</Select>

<Select
style={{ marginTop: 10 }}
variant="standard"
fullWidth={true}
floatingLabelText={translations.language}
label={translations.language}
value={lang}
onChange={(event, key, lang) => {
onChange={(event) => {
this.setState({
lang,
lang: event.target.value,
});
}}
>
{altNameConfig.languages.map((key) => (
<MenuItem
key={"lang-" + key}
value={key}
primaryText={formatMessage({
<MenuItem key={"lang-" + key} value={key}>
{formatMessage({
id: `altNamesDialog.languages.${key}`,
})}
/>
</MenuItem>
))}
</SelectField>
</Select>
<TextField
style={{ marginTop: 10 }}
variant={"standard"}
fullWidth={true}
hintText={translations.value}
value={value}
onChange={(e, value) => {
onChange={(event) => {
this.setState({
value,
value: event.target.value,
});
}}
/>
Expand Down
14 changes: 7 additions & 7 deletions src/components/Dialogs/KeyValuesDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ limitations under the Licence. */

import React from "react";
import { connect } from "react-redux";
import MdEdit from "material-ui/svg-icons/editor/mode-edit";
import MdRemove from "material-ui/svg-icons/action/delete";
import MdEdit from "@mui/icons-material/ModeEdit";
import MdRemove from "@mui/icons-material/Delete";
import { getPrimaryColor } from "../../config/themeConfig";
import EditKeyValuePair from "../EditStopPage/EditKeyValuePair";
import CreateKeyValuePair from "../EditStopPage/CreateKeyValuePair";
import { StopPlaceActions, UserActions } from "../../actions/";
import FloatingActionButton from "material-ui/FloatingActionButton";
import ContentAdd from "material-ui/svg-icons/content/add";
import Fab from "@mui/material/Fab";
import { selectKeyValuesDataSource } from "../../reducers/selectors";
import DialogHeader from "./DialogHeader";
import Add from "@mui/icons-material/Add";

class KeyValuesDialog extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -197,13 +197,13 @@ class KeyValuesDialog extends React.Component {
)}
</div>
{!disabled && (
<FloatingActionButton
<Fab
onClick={this.handleOpenCreateValues.bind(this)}
mini={true}
style={{ marginLeft: 20, marginBottom: 10 }}
>
<ContentAdd />
</FloatingActionButton>
<Add />
</Fab>
)}
<EditKeyValuePair
isOpen={this.state.isEditingOpen}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dialogs/Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ See the Licence for the specific language governing permissions and
limitations under the Licence. */

import React from "react";
import RefreshIndicator from "material-ui/RefreshIndicator";
import CircularProgress from "@mui/material/CircularProgress";

const Loader = () => {
const loadingStyle = {
Expand All @@ -25,7 +25,7 @@ const Loader = () => {

return (
<div style={loadingStyle}>
<RefreshIndicator size={70} left={0} top={0} status="loading" />
<CircularProgress size={70} left={0} top={0} status="loading" />
</div>
);
};
Expand Down
Loading

0 comments on commit 4d56682

Please sign in to comment.