Improve dialog styles

This commit is contained in:
Paulo Gustavo Veiga 2021-01-13 19:46:45 -08:00
parent 73120ca91d
commit 3552f33ee1
18 changed files with 212 additions and 259 deletions

View File

@ -5,15 +5,9 @@
"action.delete": { "action.delete": {
"defaultMessage": "Delete" "defaultMessage": "Delete"
}, },
"action.delete-button": {
"defaultMessage": "Delete"
},
"action.delete-description": { "action.delete-description": {
"defaultMessage": "Deleted mindmap can not be recovered. Do you want to continue ?." "defaultMessage": "Deleted mindmap can not be recovered. Do you want to continue ?."
}, },
"action.delete-title": {
"defaultMessage": "Delete"
},
"action.duplicate": { "action.duplicate": {
"defaultMessage": "Duplicate" "defaultMessage": "Duplicate"
}, },
@ -32,21 +26,6 @@
"action.rename": { "action.rename": {
"defaultMessage": "Rename" "defaultMessage": "Rename"
}, },
"action.rename-button": {
"defaultMessage": "Rename"
},
"action.rename-description": {
"defaultMessage": "Please, update the name and description for your mindmap."
},
"action.rename-description-placeholder": {
"defaultMessage": "Description"
},
"action.rename-name-placeholder": {
"defaultMessage": "Name"
},
"action.rename-title": {
"defaultMessage": "Rename"
},
"action.share": { "action.share": {
"defaultMessage": "Info" "defaultMessage": "Info"
}, },
@ -80,9 +59,6 @@
"forgot.desc": { "forgot.desc": {
"defaultMessage": "We will send you an email to reset your password" "defaultMessage": "We will send you an email to reset your password"
}, },
"forgot.email": {
"defaultMessage": "Email"
},
"forgot.register": { "forgot.register": {
"defaultMessage": "Send recovery link" "defaultMessage": "Send recovery link"
}, },
@ -104,9 +80,6 @@
"login.desc": { "login.desc": {
"defaultMessage": "Log into your account" "defaultMessage": "Log into your account"
}, },
"login.email": {
"defaultMessage": "Email"
},
"login.error": { "login.error": {
"defaultMessage": "The email address or password you entered is not valid." "defaultMessage": "The email address or password you entered is not valid."
}, },
@ -117,9 +90,6 @@
"defaultMessage": "Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL", "defaultMessage": "Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL",
"description": "Missing production database configured" "description": "Missing production database configured"
}, },
"login.password": {
"defaultMessage": "Password"
},
"login.remberme": { "login.remberme": {
"defaultMessage": "Remember me" "defaultMessage": "Remember me"
}, },
@ -138,18 +108,6 @@
"registration.desc": { "registration.desc": {
"defaultMessage": "Signing up is free and just take a moment" "defaultMessage": "Signing up is free and just take a moment"
}, },
"registration.email": {
"defaultMessage": "Email"
},
"registration.firstname": {
"defaultMessage": "First Name"
},
"registration.lastname": {
"defaultMessage": "Last Name"
},
"registration.password": {
"defaultMessage": "Password"
},
"registration.register": { "registration.register": {
"defaultMessage": "Register" "defaultMessage": "Register"
}, },
@ -160,7 +118,7 @@
"defaultMessage": "Terms of Service: Please check the WiseMapping Account information you've entered above, and review the Terms of Service here. By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy" "defaultMessage": "Terms of Service: Please check the WiseMapping Account information you've entered above, and review the Terms of Service here. By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy"
}, },
"registration.title": { "registration.title": {
"defaultMessage": "Become a member of our comunity" "defaultMessage": "Become a member"
}, },
"resetpassword.success.title": { "resetpassword.success.title": {
"defaultMessage": "Your account has been created successfully" "defaultMessage": "Your account has been created successfully"

View File

@ -11,24 +11,12 @@
"value": "Delete" "value": "Delete"
} }
], ],
"action.delete-button": [
{
"type": 0,
"value": "Delete"
}
],
"action.delete-description": [ "action.delete-description": [
{ {
"type": 0, "type": 0,
"value": "Deleted mindmap can not be recovered. Do you want to continue ?." "value": "Deleted mindmap can not be recovered. Do you want to continue ?."
} }
], ],
"action.delete-title": [
{
"type": 0,
"value": "Delete"
}
],
"action.duplicate": [ "action.duplicate": [
{ {
"type": 0, "type": 0,
@ -65,36 +53,6 @@
"value": "Rename" "value": "Rename"
} }
], ],
"action.rename-button": [
{
"type": 0,
"value": "Rename"
}
],
"action.rename-description": [
{
"type": 0,
"value": "Please, update the name and description for your mindmap."
}
],
"action.rename-description-placeholder": [
{
"type": 0,
"value": "Description"
}
],
"action.rename-name-placeholder": [
{
"type": 0,
"value": "Name"
}
],
"action.rename-title": [
{
"type": 0,
"value": "Rename"
}
],
"action.share": [ "action.share": [
{ {
"type": 0, "type": 0,
@ -161,12 +119,6 @@
"value": "We will send you an email to reset your password" "value": "We will send you an email to reset your password"
} }
], ],
"forgot.email": [
{
"type": 0,
"value": "Email"
}
],
"forgot.register": [ "forgot.register": [
{ {
"type": 0, "type": 0,
@ -209,12 +161,6 @@
"value": "Log into your account" "value": "Log into your account"
} }
], ],
"login.email": [
{
"type": 0,
"value": "Email"
}
],
"login.error": [ "login.error": [
{ {
"type": 0, "type": 0,
@ -233,12 +179,6 @@
"value": "Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL" "value": "Although HSQLDB is bundled with WiseMapping by default during the installation, we do not recommend this database for production use. Please consider using MySQL 5.7 instead. You can find more information how to configure MySQL"
} }
], ],
"login.password": [
{
"type": 0,
"value": "Password"
}
],
"login.remberme": [ "login.remberme": [
{ {
"type": 0, "type": 0,
@ -275,30 +215,6 @@
"value": "Signing up is free and just take a moment" "value": "Signing up is free and just take a moment"
} }
], ],
"registration.email": [
{
"type": 0,
"value": "Email"
}
],
"registration.firstname": [
{
"type": 0,
"value": "First Name"
}
],
"registration.lastname": [
{
"type": 0,
"value": "Last Name"
}
],
"registration.password": [
{
"type": 0,
"value": "Password"
}
],
"registration.register": [ "registration.register": [
{ {
"type": 0, "type": 0,
@ -320,7 +236,7 @@
"registration.title": [ "registration.title": [
{ {
"type": 0, "type": 0,
"value": "Become a member of our comunity" "value": "Become a member"
} }
], ],
"resetpassword.success.title": [ "resetpassword.success.title": [

View File

@ -5,8 +5,7 @@ import { Alert } from "@material-ui/lab";
export const StyledAlert = withStyles({ export const StyledAlert = withStyles({
root: root:
{ {
width: '300px',
margin:'0 auto'
} }
})(Alert); })(Alert);

View File

@ -13,6 +13,7 @@ type InputProps = {
type: string; type: string;
value?: string value?: string
autoComplete?: string; autoComplete?: string;
fullWidth?: boolean
} }
const Input = (props: InputProps) => { const Input = (props: InputProps) => {
@ -22,16 +23,16 @@ const Input = (props: InputProps) => {
const name = props.name; const name = props.name;
const value = props.value; const value = props.value;
const onChange = props.onChange ? props.onChange : () => { }; const onChange = props.onChange ? props.onChange : () => { };
const fieldError = error?.fields?.get(name); const fieldError = Boolean(error?.fields?.get(name));
const required = props.required != undefined ? props.required : true; const required = props.required != undefined ? props.required : true;
const fullWidth = props.fullWidth != undefined ? props.required : true;
return ( return (
<FormControl margin="normal" required={required} fullWidth>
<StyledTextField name={name} type={props.type} label={intl.formatMessage(props.label)} <StyledTextField name={name} type={props.type} label={intl.formatMessage(props.label)}
value={value} onChange={onChange} value={value} onChange={onChange}
error={Boolean(fieldError)} helperText={fieldError} error={fieldError} helperText={fieldError}
variant="outlined" required={required} /> variant="outlined" required={required} fullWidth={fullWidth} margin="dense"/>
</FormControl>
); );
} }
export default Input; export default Input;

View File

@ -3,13 +3,10 @@ import { TextField, withStyles } from "@material-ui/core";
export const StyledTextField = withStyles({ export const StyledTextField = withStyles({
root: root:
{ {
margin: '0 auto',
'& label.Mui-focused': { '& label.Mui-focused': {
color: '#f9a826', color: '#f9a826',
}, },
'& .MuiOutlinedInput-root': { '& .MuiOutlinedInput-root': {
width: '300px',
height: '53px', height: '53px',
borderRadius: '9px', borderRadius: '9px',
fontSize: '16px', fontSize: '16px',

View File

@ -8,6 +8,7 @@ import Footer from '../layout/footer'
import SubmitButton from '../form/submit-button' import SubmitButton from '../form/submit-button'
import Input from '../form/input'; import Input from '../form/input';
import GlobalError from '../form/global-error'; import GlobalError from '../form/global-error';
import { FormControl } from '@material-ui/core';
const ConfigStatusMessage = (props: any) => { const ConfigStatusMessage = (props: any) => {
@ -29,16 +30,17 @@ const LoginError = () => {
const errorCode = new URLSearchParams(window.location.search).get('login_error'); const errorCode = new URLSearchParams(window.location.search).get('login_error');
const intl = useIntl(); const intl = useIntl();
let msg; let msg: null | string = null;
if (errorCode) { if (errorCode) {
if (errorCode === "3") { switch (errorCode) {
case "3":
msg = intl.formatMessage({ id: "login.userinactive", defaultMessage: "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." }); msg = intl.formatMessage({ id: "login.userinactive", defaultMessage: "Sorry, your account has not been activated yet. You'll receive a notification email when it becomes active. Stay tuned!." });
} else { break;
default:
msg = intl.formatMessage({ id: "login.error", defaultMessage: "The email address or password you entered is not valid." }); msg = intl.formatMessage({ id: "login.error", defaultMessage: "The email address or password you entered is not valid." });
} }
} }
<GlobalError error={{msg: msg}} /> return (msg ? <GlobalError error={{ msg: msg }} /> : null);
return null;
} }
@ -59,20 +61,20 @@ const LoginPage = () => {
<LoginError /> <LoginError />
<FormControl>
<form action="/c/perform-login" method="POST" > <form action="/c/perform-login" method="POST" >
<Input name="email" type="email" label={{ id: "login.email", defaultMessage: "Email" }} required={true} autoComplete="email" /> <Input name="email" type="email" label={{ id: "login.email", defaultMessage: "Email" }} required autoComplete="email" />
<Input name="password" type="password" label={{ id: "login.password", defaultMessage: "Password" }} required={true} autoComplete="current-password" /> <Input name="password" type="password" label={{ id: "login.password", defaultMessage: "Password" }} required autoComplete="current-password" />
<div> <div>
<input name="_spring_security_login.remberme" id="staySignIn" type="checkbox" /> <input name="_spring_security_login.remberme" id="staySignIn" type="checkbox" />
<label htmlFor="staySignIn"><FormattedMessage id="login.remberme" defaultMessage="Remember me" /></label> <label htmlFor="staySignIn"><FormattedMessage id="login.remberme" defaultMessage="Remember me" /></label>
</div> </div>
<SubmitButton value={intl.formatMessage({ id: "login.signin", defaultMessage: "Sign In" })} /> <SubmitButton value={intl.formatMessage({ id: "login.signin", defaultMessage: "Sign In" })} />
</form> </form>
</FormControl>
<Link to="/c/forgot-password"><FormattedMessage id="login.forgotpwd" defaultMessage="Forgot Password ?" /></Link> <Link to="/c/forgot-password"><FormattedMessage id="login.forgotpwd" defaultMessage="Forgot Password ?" /></Link>
<ConfigStatusMessage enabled='false' /> <ConfigStatusMessage />
</PageContent> </PageContent>

View File

@ -1,4 +1,3 @@
import { TextField, withStyles } from '@material-ui/core';
import styled from 'styled-components'; import styled from 'styled-components';

View File

@ -9,7 +9,7 @@ import EditOutlinedIcon from '@material-ui/icons/EditOutlined';
import PublicOutlinedIcon from '@material-ui/icons/PublicOutlined'; import PublicOutlinedIcon from '@material-ui/icons/PublicOutlined';
import PrintOutlinedIcon from '@material-ui/icons/PrintOutlined'; import PrintOutlinedIcon from '@material-ui/icons/PrintOutlined';
import ShareOutlinedIcon from '@material-ui/icons/ShareOutlined'; import ShareOutlinedIcon from '@material-ui/icons/ShareOutlined';
import { StyledMenuItem } from './styled'; import { StyledMenuItem } from '../styled';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
export type ActionType = 'open' | 'share' | 'delete' | 'info' | 'duplicate' | 'export' | 'rename' | 'print' | 'info' | 'publish' | undefined; export type ActionType = 'open' | 'share' | 'delete' | 'info' | 'duplicate' | 'export' | 'rename' | 'print' | 'info' | 'publish' | undefined;
@ -19,7 +19,7 @@ interface MapActionProps {
anchor: undefined | HTMLElement; anchor: undefined | HTMLElement;
} }
const MapActionDialog = (props: MapActionProps) => { const ActionChooser = (props: MapActionProps) => {
const { anchor, onClose } = props; const { anchor, onClose } = props;
const handleOnClose = (action: ActionType): ((event: React.MouseEvent<HTMLLIElement>) => void) => { const handleOnClose = (action: ActionType): ((event: React.MouseEvent<HTMLLIElement>) => void) => {
@ -73,4 +73,4 @@ const MapActionDialog = (props: MapActionProps) => {
</Menu>); </Menu>);
} }
export default MapActionDialog; export default ActionChooser;

View File

@ -1,8 +1,9 @@
import React from "react"; import React from "react";
import { Button, Dialog as DialogUI, DialogActions, DialogContent, DialogContentText, DialogTitle } from "@material-ui/core"; import { DialogActions, DialogContentText, DialogTitle } from "@material-ui/core";
import { FormattedMessage, MessageDescriptor, useIntl } from "react-intl"; import { FormattedMessage, MessageDescriptor, useIntl } from "react-intl";
import GlobalError from "../../form/global-error"; import { ErrorInfo } from "../../../../services/Service";
import { ErrorInfo } from "../../../services/Service"; import { ButtonStyled, StyledDialog, StyledDialogActions, StyledDialogContent, StyledDialogTitle } from "./style";
import GlobalError from "../../../form/global-error";
export type DialogProps = { export type DialogProps = {
onClose: () => void; onClose: () => void;
@ -16,7 +17,7 @@ export type DialogProps = {
submitButton: MessageDescriptor; submitButton: MessageDescriptor;
} }
const Dialog = (props: DialogProps) => { const BaseDialog = (props: DialogProps) => {
const intl = useIntl(); const intl = useIntl();
const handleOnClose = props.onClose; const handleOnClose = props.onClose;
const isOpen = props.open; const isOpen = props.open;
@ -26,33 +27,35 @@ const Dialog = (props: DialogProps) => {
return ( return (
<div> <div>
<DialogUI <StyledDialog
open={isOpen} open={isOpen}
onClose={handleOnClose} > onClose={handleOnClose}
maxWidth="sm"
fullWidth={true}>
<form autoComplete="off" onSubmit={handleOnSubmit}> <form autoComplete="off" onSubmit={handleOnSubmit}>
<DialogTitle> <StyledDialogTitle>
{intl.formatMessage(props.title)} {intl.formatMessage(props.title)}
</DialogTitle> </StyledDialogTitle>
<DialogContent> <StyledDialogContent>
{description} {description}
<GlobalError error={props.error} /> <GlobalError error={props.error} />
{props.children} {props.children}
</DialogContent> </StyledDialogContent>
<DialogActions> <StyledDialogActions>
<Button color="primary" variant="outlined" type="submit"> <ButtonStyled color="primary" size="medium" variant="outlined" type="submit">
{intl.formatMessage(props.title)} {intl.formatMessage(props.title)}
</Button> </ButtonStyled>
<Button color="secondary" variant="outlined" autoFocus onClick={handleOnClose}> <ButtonStyled color="secondary" size="medium" variant="outlined" autoFocus onClick={handleOnClose}>
<FormattedMessage id="action.cancel-button" defaultMessage="Cancel" /> <FormattedMessage id="action.cancel-button" defaultMessage="Cancel" />
</Button> </ButtonStyled>
</DialogActions> </StyledDialogActions>
</form> </form>
</DialogUI> </StyledDialog>
</div> </div>
); );
} }
export default Dialog; export default BaseDialog;

View File

@ -0,0 +1,58 @@
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, TableCell, withStyles } from "@material-ui/core";
export const StyledDialogContent = withStyles({
root: {
padding: '0px 39px'
}
})(DialogContent);
export const StyledDialogTitle = withStyles({
root: {
padding: '39px 39px 10px 39px'
}
})(DialogTitle);
export const StyledDialogActions = withStyles({
root: {
padding: '39px 39px 39px 39px'
}
})(DialogActions);
export const ButtonStyled = withStyles({
root: {
textTransform: 'none',
fontSize: '15px',
fontWeight: 600,
width: '196px',
padding: '7px 64px 8px 64px',
'&:hover': {
border: '0'
},
borderRadius: '9px'
},
outlinedPrimary: {
border: '0',
background: '#ffa800',
color: 'white',
'&:hover': {
border: '0',
background: 'rgba(249, 168, 38, 0.91)'
}
},
outlinedSecondary: {
background: '#white',
color: '#ffa800',
border: '1px solid #ffa800',
'&:hover': {
border: '1px solid rgba(249, 168, 38, 0.91)',
background: 'white'
}
}
})(Button)
export const StyledDialog = withStyles({
root: {
borderRadius: '9px'
}
})(Dialog)

View File

@ -1,13 +1,12 @@
import { Button, DialogActions, DialogContent, DialogTitle } from "@material-ui/core";
import { Alert, AlertTitle } from "@material-ui/lab"; import { Alert, AlertTitle } from "@material-ui/lab";
import React from "react"; import React from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { useMutation, useQueryClient } from "react-query"; import { useMutation, useQueryClient } from "react-query";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { Service } from "../../../services/Service"; import { Service } from "../../../../services/Service";
import { activeInstance } from '../../../reducers/serviceSlice'; import { activeInstance } from '../../../../reducers/serviceSlice';
import { DialogProps, fetchMapById, handleOnMutationSuccess } from "./DialogCommon"; import { DialogProps, fetchMapById, handleOnMutationSuccess } from "../DialogCommon";
import Dialog from "./Dialog"; import BaseDialog from "../action-dialog";
const DeleteDialog = (props: DialogProps) => { const DeleteDialog = (props: DialogProps) => {
@ -32,7 +31,7 @@ const DeleteDialog = (props: DialogProps) => {
const { map } = fetchMapById(mapId); const { map } = fetchMapById(mapId);
return ( return (
<div> <div>
<Dialog <BaseDialog
open={props.open} onClose={handleOnClose} onSubmit={handleOnSubmit} open={props.open} onClose={handleOnClose} onSubmit={handleOnSubmit}
title={{ id: "action.delete-title", defaultMessage: "Delete" }} title={{ id: "action.delete-title", defaultMessage: "Delete" }}
submitButton={{ id: "action.delete-title", defaultMessage: "Delete" }} > submitButton={{ id: "action.delete-title", defaultMessage: "Delete" }} >
@ -41,7 +40,7 @@ const DeleteDialog = (props: DialogProps) => {
<AlertTitle>Delete '{map?.name}'</AlertTitle> <AlertTitle>Delete '{map?.name}'</AlertTitle>
<FormattedMessage id="action.delete-description" defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?." /> <FormattedMessage id="action.delete-description" defaultMessage="Deleted mindmap can not be recovered. Do you want to continue ?." />
</Alert> </Alert>
</Dialog> </BaseDialog>
</div> </div>
); );
} }

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import RenameDialog from './RenameDialog'; import RenameDialog from './rename';
import DeleteDialog from './DeleteDialog'; import DeleteDialog from './delete';
import { ActionType } from '../action-chooser';
export type BasicMapInfo = { export type BasicMapInfo = {
@ -8,15 +9,13 @@ export type BasicMapInfo = {
description: string | undefined; description: string | undefined;
} }
export type DialogType = 'share' | 'delete' | 'info' | 'duplicate' | 'export' | 'rename' | 'publish';
type ActionDialogProps = { type ActionDialogProps = {
action?: DialogType, action?: ActionType,
mapId: number, mapId: number,
onClose: () => void onClose: () => void
} }
const ActionDialog = (props: ActionDialogProps) => { const ActionDialogDispatcher = (props: ActionDialogProps) => {
const handleOnClose = (): void => { const handleOnClose = (): void => {
props.onClose(); props.onClose();
} }
@ -32,4 +31,4 @@ const ActionDialog = (props: ActionDialogProps) => {
); );
} }
export default ActionDialog; export default ActionDialogDispatcher;

View File

@ -2,11 +2,12 @@ import React, { useEffect } from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import { useMutation, useQueryClient } from "react-query"; import { useMutation, useQueryClient } from "react-query";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { BasicMapInfo, ErrorInfo, Service } from "../../../services/Service"; import { BasicMapInfo, ErrorInfo, Service } from "../../../../services/Service";
import { activeInstance } from '../../../reducers/serviceSlice'; import { activeInstance } from '../../../../reducers/serviceSlice';
import { DialogProps, fetchMapById, handleOnMutationSuccess } from "./DialogCommon"; import { DialogProps, fetchMapById, handleOnMutationSuccess } from "./../DialogCommon";
import Dialog from "./Dialog"; import Input from "../../../form/input";
import Input from "../../form/input"; import { FormControl } from "@material-ui/core";
import BaseDialog from "../action-dialog";
export type RenameModel = { export type RenameModel = {
id: number; id: number;
@ -69,17 +70,19 @@ const RenameDialog = (props: DialogProps) => {
return ( return (
<div> <div>
<Dialog open={open} onClose={handleOnClose} onSubmit={handleOnSubmit} error={error} <BaseDialog open={open} onClose={handleOnClose} onSubmit={handleOnSubmit} error={error}
title={{ id: 'rename.title', defaultMessage: 'Rename' }} title={{ id: 'rename.title', defaultMessage: 'Rename' }}
description={{ id: 'rename.description', defaultMessage: 'Rename' }} description={{ id: 'rename.description', defaultMessage: 'Rename' }}
submitButton={{ id: 'rename.title', defaultMessage: 'Rename Description' }}> submitButton={{ id: 'rename.title', defaultMessage: 'Rename Description' }}>
<FormControl fullWidth={true}>
<Input name="name" type="text" label={{ id: "action.rename-name-placeholder", defaultMessage: "Name" }} <Input name="name" type="text" label={{ id: "action.rename-name-placeholder", defaultMessage: "Name" }}
value={model.name} onChange={handleOnChange} error={error} /> value={model.name} onChange={handleOnChange} error={error} fullWidth={true} />
<Input name="description" type="text" label={{ id: "action.rename-description-placeholder", defaultMessage: "Description" }} <Input name="description" type="text" label={{ id: "action.rename-description-placeholder", defaultMessage: "Description" }}
value={model.description} onChange={handleOnChange} required={false} /> value={model.description} onChange={handleOnChange} required={false} fullWidth={true} />
</Dialog> </FormControl>
</BaseDialog>
</div> </div>
); );
} }

View File

@ -1,7 +1,7 @@
import React, { useEffect } from 'react' import React, { useEffect } from 'react'
import { PageContainer, MapsListArea, NavArea, HeaderArea, StyledTableCell } from './styled'; import { PageContainer, MapsListArea, NavArea, HeaderArea, StyledTableCell } from './styled';
import { createStyles, makeStyles, Theme } from '@material-ui/core/styles'; import { createStyles, makeStyles, Theme, ThemeProvider } from '@material-ui/core/styles';
import Table from '@material-ui/core/Table'; import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody'; import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell'; import TableCell from '@material-ui/core/TableCell';
@ -21,12 +21,14 @@ import FilterListIcon from '@material-ui/icons/FilterList';
import StarRateRoundedIcon from '@material-ui/icons/StarRateRounded'; import StarRateRoundedIcon from '@material-ui/icons/StarRateRounded';
import MoreHorizIcon from '@material-ui/icons/MoreHoriz'; import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
import { CSSProperties } from 'react'; import { CSSProperties } from 'react';
import MapActionMenu, { ActionType } from './MapActionMenu';
import ActionDialog, { DialogType } from './dialogs/ActionDialog';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { activeInstance } from '../../reducers/serviceSlice'; import { activeInstance } from '../../reducers/serviceSlice';
import { useQuery } from 'react-query'; import { useQuery } from 'react-query';
import { ErrorInfo, MapInfo, Service } from '../../services/Service'; import { ErrorInfo, MapInfo, Service } from '../../services/Service';
import { theme } from '../../theme/global-style';
import { CssBaseline } from '@material-ui/core';
import ActionChooser, { ActionType } from './action-chooser';
import ActionDialogDispatcher from './action-dialog-dispatcher';
@ -234,7 +236,7 @@ const EnhancedTable = () => {
const [activeRowAction, setActiveRowAction] = React.useState<ActionPanelState | undefined>(undefined); const [activeRowAction, setActiveRowAction] = React.useState<ActionPanelState | undefined>(undefined);
type ActiveDialog = { type ActiveDialog = {
actionType: DialogType; actionType: ActionType;
mapId: number mapId: number
}; };
@ -301,7 +303,7 @@ const EnhancedTable = () => {
setActiveRowAction(undefined); setActiveRowAction(undefined);
setActiveDialog({ setActiveDialog({
actionType: action as DialogType, actionType: action as ActionType,
mapId: mapId as number mapId: mapId as number
}); });
} }
@ -377,7 +379,7 @@ const EnhancedTable = () => {
<MoreHorizIcon color="action" /> <MoreHorizIcon color="action" />
</IconButton> </IconButton>
</Tooltip> </Tooltip>
<MapActionMenu anchor={activeRowAction?.el} onClose={handleActionMenuClose} /> <ActionChooser anchor={activeRowAction?.el} onClose={handleActionMenuClose} />
</StyledTableCell> </StyledTableCell>
</TableRow> </TableRow>
); );
@ -402,7 +404,7 @@ const EnhancedTable = () => {
</Paper> </Paper>
{/* Action Dialog */} {/* Action Dialog */}
<ActionDialog action={activeDialog?.actionType} onClose={() => setActiveDialog(undefined)} mapId={activeDialog ? activeDialog.mapId : -1} /> <ActionDialogDispatcher action={activeDialog?.actionType} onClose={() => setActiveDialog(undefined)} mapId={activeDialog ? activeDialog.mapId : -1} />
</div> </div>
); );
} }
@ -416,6 +418,8 @@ const MapsPage = () => {
}, []); }, []);
return ( return (
<ThemeProvider theme={theme}>
<CssBaseline />
<PageContainer> <PageContainer>
<HeaderArea> <HeaderArea>
<h2>Header</h2> <h2>Header</h2>
@ -427,6 +431,7 @@ const MapsPage = () => {
<EnhancedTable /> <EnhancedTable />
</MapsListArea> </MapsListArea>
</PageContainer> </PageContainer>
</ThemeProvider>
); );
} }
export default MapsPage; export default MapsPage;

View File

@ -1,4 +1,4 @@
import { MenuItem, TableCell } from '@material-ui/core'; import { Button, Dialog, MenuItem, TableCell } from '@material-ui/core';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import styled from 'styled-components'; import styled from 'styled-components';
@ -28,7 +28,6 @@ grid-area: header;
background-color: blue; background-color: blue;
` `
export const StyledTableCell = withStyles({ export const StyledTableCell = withStyles({
root: { root: {
color: 'black', color: 'black',

View File

@ -8,8 +8,8 @@ import Header from '../layout/header';
import Footer from '../layout/footer'; import Footer from '../layout/footer';
import { StyledReCAPTCHA } from './styled'; import { StyledReCAPTCHA } from './styled';
import { PageContent } from '../../theme/global-style'; import { PageContent, theme } from '../../theme/global-style';
import { FormControl } from '@material-ui/core'; import { CssBaseline, FormControl, ThemeProvider } from '@material-ui/core';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useMutation } from 'react-query'; import { useMutation } from 'react-query';
import { activeInstance } from '../../reducers/serviceSlice'; import { activeInstance } from '../../reducers/serviceSlice';
@ -58,9 +58,10 @@ const RegistrationForm = () => {
return ( return (
<PageContent> <PageContent>
<h1><FormattedMessage id="registration.title" defaultMessage="Become a member of our comunity" /></h1> <h1><FormattedMessage id="registration.title" defaultMessage="Become a member" /></h1>
<p><FormattedMessage id="registration.desc" defaultMessage="Signing up is free and just take a moment " /></p> <p><FormattedMessage id="registration.desc" defaultMessage="Signing up is free and just take a moment " /></p>
<FormControl>
<form onSubmit={handleOnSubmit}> <form onSubmit={handleOnSubmit}>
<GlobalError error={error} /> <GlobalError error={error} />
@ -77,21 +78,20 @@ const RegistrationForm = () => {
<Input name="password" type="password" onChange={handleOnChange} label={{ id: "registration.password", defaultMessage: "Password" }} <Input name="password" type="password" onChange={handleOnChange} label={{ id: "registration.password", defaultMessage: "Password" }}
autoComplete="new-password" /> autoComplete="new-password" />
<FormControl>
<StyledReCAPTCHA> <StyledReCAPTCHA>
<ReCAPTCHA <ReCAPTCHA
sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI" sitekey="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI"
onChange={(value: string) => { model.recaptcha = value; setModel(model) }} /> onChange={(value: string) => { model.recaptcha = value; setModel(model) }} />
</StyledReCAPTCHA> </StyledReCAPTCHA>
</FormControl>
<div style={{ width: "300px", textAlign: "center", fontSize: "12px", margin: "auto" }}> <div style={{ fontSize: "12px", padding: "5px 0px" }}>
<FormattedMessage id="registration.termandconditions" defaultMessage="Terms of Service: Please check the WiseMapping Account information you've entered above, and review the Terms of Service here. By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy" /> <FormattedMessage id="registration.termandconditions" defaultMessage="Terms of Service: Please check the WiseMapping Account information you've entered above, and review the Terms of Service here. By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy" />
</div> </div>
<input type="submit" value={intl.formatMessage({ id: "registration.register", defaultMessage: "Register" })} /> <input type="submit" value={intl.formatMessage({ id: "registration.register", defaultMessage: "Register" })} />
</form> </form>
</FormControl>
</PageContent > </PageContent >
); );
} }

View File

@ -1,4 +1,4 @@
import { TextField, withStyles } from '@material-ui/core'; import { createMuiTheme, TextField, withStyles } from '@material-ui/core';
import { Alert } from '@material-ui/lab'; import { Alert } from '@material-ui/lab';
import styled, { createGlobalStyle } from 'styled-components'; import styled, { createGlobalStyle } from 'styled-components';
@ -78,11 +78,11 @@ a {
border: solid 1px #ffa800; border: solid 1px #ffa800;
font-weight: 600; font-weight: 600;
} }
`; `;
const PageContent = styled.div` const PageContent = styled.div`
max-width: 800px; max-width: 350px;
min-height: 400px; min-height: 350px;
margin: 10px auto; margin: 10px auto;
text-align:center; text-align:center;
padding: 20px 10px 20px 10px; padding: 20px 10px 20px 10px;
@ -96,20 +96,21 @@ padding: 20px 10px 20px 10px;
& input[type=submit], & input[type=submit],
& input[type=button] { & input[type=button] {
width: 300px; width: 330px;
height: 53px; height: 53px;
padding: 0px 20px; padding: 0px 20px;
margin: 10px 20px; margin: 7px 0px;
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
border-radius: 9px; border-radius: 9px;
border: 0px; border: 0px;
background-color: rgba(255, 168, 0, 0.6); background-color: #ffa800;
color: white; color: white;
} }
& input[type=submit]:hover { & input[type=submit]:hover {
background-color: #f9a826; background-color: rgba(249, 168, 38, 0.91);
cursor: pointer
} }
& label { & label {
@ -144,5 +145,19 @@ padding: 20px 10px 20px 10px;
} }
`; `;
const theme = createMuiTheme({
typography: {
fontFamily: [
'Montserrat'
].join(','),
}
});
theme.typography.h6 = {
fontSize: '25px',
fontWeight: 'bold'
};
export { GlobalStyle, PageContent, theme };
export { GlobalStyle, PageContent };