Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace some buttons #1467

Merged
merged 3 commits into from
Aug 22, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/client/src/assets/icons/trash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import * as Styled from "./styles";
import { Button, Segment } from "semantic-ui-react";
import { Segment } from "semantic-ui-react";
import TranslationText from "../../../../components/legacyComponents/translationText.jsx";
import _ from "lodash";
import { useTranslation } from "react-i18next";
import { Button } from "@mui/material";

const EditorSettingList = props => {
const {
Expand Down Expand Up @@ -60,20 +61,20 @@ const EditorSettingList = props => {
return (
<Styled.Container>
<Segment>
<Button.Group size="mini">
<Button
onClick={() => {
sendSelectAll(true);
}}>
{t("selectAll")}
</Button>
<Button
onClick={() => {
sendSelectAll(false);
}}>
{t("unselectAll")}
</Button>
</Button.Group>
<Button
variant="outlined"
onClick={() => {
sendSelectAll(true);
}}>
{t("selectAll")}
</Button>
<Button
variant="outlined"
onClick={() => {
sendSelectAll(false);
}}>
{t("unselectAll")}
</Button>
</Segment>
{attribute?.map((item, index) => (
<Segment key={index}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
import { useContext } from "react";
import _ from "lodash";
import Highlighter from "react-highlight-words";

import { Button, Divider, Dropdown, Input, Label, Popup, Segment } from "semantic-ui-react";
import { Divider, Dropdown, Input, Label, Popup, Segment } from "semantic-ui-react";
import { Button, CircularProgress, IconButton } from "@mui/material";
import { getWms } from "../../../../api-lib/index";
import { AlertContext } from "../../../../components/alert/alertContext";
import WMTSCapabilities from "ol/format/WMTSCapabilities";
import WMSCapabilities from "ol/format/WMSCapabilities";
import { theme } from "../../../../AppTheme";
import { useTranslation } from "react-i18next";
import TrashIcon from "../../../../assets/icons/trash.svg?react";
import AddIcon from "../../../../assets/icons/add.svg?react";

const MapSettings = props => {
const { showAlert } = useContext(AlertContext);
const { setting, i18n, rmExplorerMap, addExplorerMap, handleAddItem, handleOnChange, state, setState } = props;
const { t } = useTranslation();

function getIconButton(layer, layerType) {
return (
<IconButton
size="small"
onClick={e => {
e.stopPropagation();
if (_.has(setting.data.map.explorer, layerType === "WMS" ? layer.Name : layer.identifier)) {
rmExplorerMap(layer);
} else {
addExplorerMap(layer, layerType, state.wms, _.values(setting.data.map.explorer).length);
}
}}
color={_.has(setting.data.map.explorer, layer.Name) ? "error" : "primary"}>
{_.has(setting.data.map.explorer, layer.Name) ? <TrashIcon /> : <AddIcon />}
</IconButton>
);
}

return (
<>
<div
Expand Down Expand Up @@ -44,9 +64,7 @@ const MapSettings = props => {
flex: 1,
textAlign: "right",
}}>
<Button color="red" size="small">
{state.map === true ? t("collapse") : t("expand")}
</Button>
<Button variant="outlined">{state.map ? t("collapse") : t("expand")}</Button>
</div>
</div>
{state.map === true ? (
Expand Down Expand Up @@ -90,8 +108,8 @@ const MapSettings = props => {
/>
</div>
<Button
compact
loading={state.wmsFetch === true}
sx={{ height: "37px", width: "80px" }}
variant="contained"
onClick={() => {
setState(
{
Expand Down Expand Up @@ -131,14 +149,8 @@ const MapSettings = props => {
});
},
);
}}
secondary
style={{
marginLeft: "1em",
}}
// size='mini'
>
{t("load")}
}}>
{state.wmsFetch ? <CircularProgress size={22} color="inherit" /> : t("load")}
</Button>
</div>
{state.wmts !== null ? (
Expand Down Expand Up @@ -203,28 +215,7 @@ const MapSettings = props => {
}}>
<Highlighter searchWords={[state.searchWms]} textToHighlight={layer.Title} />
</div>
<div>
<Button
color={_.has(setting.data.map.explorer, layer.Name) ? "grey" : "blue"}
icon={
_.has(setting.data.map.explorer, layer.Name) ? "trash alternate outline" : "add"
}
onClick={e => {
e.stopPropagation();
if (_.has(setting.data.map.explorer, layer.Name)) {
rmExplorerMap(layer);
} else {
addExplorerMap(
layer,
"WMS",
state.wms,
_.values(setting.data.map.explorer).length,
);
}
}}
size="mini"
/>
</div>
<div>{getIconButton(layer, "WMS")}</div>
</div>
<div
style={{
Expand Down Expand Up @@ -288,30 +279,7 @@ const MapSettings = props => {
}}>
<Highlighter searchWords={[state.searchWmts]} textToHighlight={layer.Title} />
</div>
<div>
<Button
color={_.has(setting.data.map.explorer, layer.Identifier) ? "grey" : "blue"}
icon={
_.has(setting.data.map.explorer, layer.Identifier)
? "trash alternate outline"
: "add"
}
onClick={e => {
e.stopPropagation();
if (_.has(setting.data.map.explorer, layer.Identifier)) {
rmExplorerMap(layer);
} else {
addExplorerMap(
layer,
"WMTS",
state.wmts,
_.values(setting.data.map.explorer).length,
);
}
}}
size="mini"
/>
</div>
<div>{getIconButton(layer, "WMTS")}</div>
</div>
<div
style={{
Expand Down Expand Up @@ -405,17 +373,16 @@ const MapSettings = props => {
<Highlighter searchWords={[state.searchWmtsUser]} textToHighlight={layer.Title} />
</div>
<div>
<Button
color="grey"
icon="trash alternate outline"
<IconButton
onClick={e => {
e.stopPropagation();
if (_.has(setting.data.map.explorer, layer.Identifier)) {
rmExplorerMap(layer);
}
}}
size="mini"
/>
color="error">
<TrashIcon />
</IconButton>
</div>
</div>
<div
Expand Down
7 changes: 3 additions & 4 deletions src/client/src/pages/settings/editorSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { connect } from "react-redux";
import PropTypes from "prop-types";
import { withTranslation } from "react-i18next";
import _ from "lodash";
import { Button, Divider } from "semantic-ui-react";
import { Divider } from "semantic-ui-react";
import { patchCodeConfig, patchSettings } from "../../api-lib/index";
import TranslationText from "../../components/legacyComponents/translationText.jsx";
import EditorSettingList from "./components/editorSettingList/editorSettingList";
Expand All @@ -17,6 +17,7 @@ import MapSettings from "./components/editorSettingList/mapSettings";
import { locationEditorData } from "./data/locationEditorData";
import { registrationEditorData } from "./data/registrationEditorData";
import { theme } from "../../AppTheme";
import { Button } from "@mui/material";

const projections = {
"EPSG:21781":
Expand Down Expand Up @@ -210,9 +211,7 @@ class EditorSettings extends React.Component {
flex: 1,
textAlign: "right",
}}>
<Button color="red" size="small">
{filter.isSelected === true ? t("collapse") : t("expand")}
</Button>
<Button variant="outlined">{filter.isSelected === true ? t("collapse") : t("expand")}</Button>
</div>
</div>
{filter.isSelected === true && this.handleButtonSelected(filter.name, filter.isSelected) !== null ? (
Expand Down
40 changes: 14 additions & 26 deletions src/client/src/pages/settings/termSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { connect } from "react-redux";
import PropTypes from "prop-types";
import { withTranslation } from "react-i18next";
import Markdown from "markdown-to-jsx";
import { Button, Form, Modal, TextArea } from "semantic-ui-react";
import { Button } from "@mui/material";
import { Form, Modal, TextArea } from "semantic-ui-react";
import TranslationKeys from "../../auth/translationKeys";
import { draftTerms, getTermsDraft, publishTerms } from "../../api-lib/index";
import { CancelButton } from "../../components/buttons/buttons";

class TermSettings extends React.Component {
constructor(props) {
Expand Down Expand Up @@ -125,15 +127,14 @@ class TermSettings extends React.Component {
textAlign: "right",
}}>
<Button
sx={{
display: this.state.draft === true && this.state.dirty === false ? null : "none",
}}
variant="contained"
onClick={() => {
this.setState({
confirmPublication: true,
});
}}
primary
style={{
display: this.state.draft === true && this.state.dirty === false ? null : "none",
textTransform: "capitalize",
}}>
{t("publish")}
</Button>
Expand All @@ -143,39 +144,26 @@ class TermSettings extends React.Component {
<p>{t("disclaimer_publish_message")}</p>
</Modal.Content>
<Modal.Actions>
<Button
negative
<CancelButton
onClick={() => {
this.setState({
confirmPublication: false,
});
}}
style={{
textTransform: "capitalize",
}}>
{t("cancel")}
</Button>
<Button
onClick={() => this.publishTerms()}
primary
style={{
textTransform: "capitalize",
}}>
/>
<Button variant="contained" onClick={() => this.publishTerms()}>
{t("publish")}
</Button>
</Modal.Actions>
</Modal>
<Button
sx={{
display: this.state.dirty === true ? null : "none",
}}
variant="contained"
disabled={this.state.dirty === false}
loading={this.state.saving}
onClick={() => {
this.draftTerms();
}}
secondary
style={{
marginLeft: "1em",
textTransform: "capitalize",
display: this.state.dirty === true ? null : "none",
}}>
{t("save")}
</Button>
Expand Down
Loading