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

QA mobile - CARTO for React #141

Merged
merged 4 commits into from
Dec 3, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# CHANGELOG

## Not released
- Improve layout for mobile (specially for iOS) [#141](https://github.com/CartoDB/carto-react-template/pull/141)
- Fix selected store state in sample-app [#142](https://github.com/CartoDB/carto-react-template/pull/142)

## 1.0.0-beta5 (2020-11-27)
Expand Down
5 changes: 3 additions & 2 deletions template-sample-app/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"package": {
"dependencies": {
"@carto/react": "^1.0.0-beta6",
"@formatjs/intl-numberformat": "^6.0.0",
"@formatjs/intl-locale": "^2.4.8",
"@formatjs/intl-getcanonicallocales": "^1.5.2",
"@formatjs/intl-locale": "^2.4.8",
"@formatjs/intl-numberformat": "^6.0.0",
"@formatjs/intl-pluralrules": "^4.0.0",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
Expand Down
22 changes: 6 additions & 16 deletions template-sample-app/template/package.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"private": true,
"dependencies": {
"@carto/react": "^1.0.0-beta6",
"@formatjs/intl-numberformat": "^6.0.0",
"@formatjs/intl-locale": "^2.4.8",
"@formatjs/intl-getcanonicallocales": "^1.5.2",
"@formatjs/intl-locale": "^2.4.8",
"@formatjs/intl-numberformat": "^6.0.0",
"@formatjs/intl-pluralrules": "^4.0.0",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.56",
Expand Down Expand Up @@ -59,12 +60,7 @@
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all",
"not explorer 11"
],
"production": [">0.2%", "not dead", "not op_mini all", "not explorer 11"],
"development": [
"last 1 chrome version",
"last 1 firefox version",
Expand All @@ -77,13 +73,7 @@
}
},
"lint-staged": {
"*.+(js|jsx)": [
"yarn lint:fix",
"git add"
],
"*.+(js|jsx|json|css|md)": [
"prettier --write",
"git add"
]
"*.+(js|jsx)": ["yarn lint:fix", "git add"],
"*.+(js|jsx|json|css|md)": ["prettier --write", "git add"]
}
}
21 changes: 20 additions & 1 deletion template-sample-app/template/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="description" content="CARTO for React - Sample Location Intelligence Application" />

<link rel="apple-touch-icon" sizes="180x180" href="%PUBLIC_URL%/favicon/apple-touch-icon.png">
Expand Down Expand Up @@ -37,6 +37,25 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->

<!-- Fix height for iOS devices as long as Material-UI's makeStyles doesn't allow defining the same CSS property twice as a fallback -->
<style>
html {
height: 100vh;
height: -webkit-fill-available;
}
body {
height: 100%;
height: -webkit-fill-available;
display: flex;
flex-direction: column
}
body > #root {
flex: 1;
display: flex;
flex-direction: column
}
</style>
<title>CARTO for React Sample App</title>
</head>
<body>
Expand Down
4 changes: 2 additions & 2 deletions template-sample-app/template/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ theme = responsiveFontSizes(theme, {

const useStyles = makeStyles(() => ({
root: {
width: '100vw',
height: '100vh',
flex: 1,
overflow: 'hidden',
},
}));

Expand Down
18 changes: 7 additions & 11 deletions template-sample-app/template/src/components/common/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Typography,
} from '@material-ui/core';
import MenuIcon from '@material-ui/icons/Menu';
import CloseIcon from '@material-ui/icons/Close';
import UserMenu from 'components/views/UserMenu';
import { NavLink, useLocation } from 'react-router-dom';

Expand Down Expand Up @@ -52,8 +53,8 @@ const useStyles = makeStyles((theme) => ({
display: 'inline-block',
height: '1em',
marginRight: theme.spacing(2),
verticalAlign: 'text-bottom'
}
verticalAlign: 'text-bottom',
},
},
},
}));
Expand Down Expand Up @@ -109,7 +110,7 @@ export function Header() {
aria-label='menu'
onClick={handleDrawerToggle}
>
<MenuIcon />
{drawerOpen ? <CloseIcon /> : <MenuIcon />}
</IconButton>
</Hidden>
<Link component={NavLink} to='/' className={classes.title}>
Expand All @@ -119,14 +120,14 @@ export function Header() {
</Hidden>
<Hidden smUp>
<img src='/logo-xs.svg' alt='CARTO ' />
<Divider orientation="vertical" light />
<Divider orientation='vertical' light />
</Hidden>
<strong>React</strong> Demo
</Typography>
</Link>
<Hidden xsDown>
<Divider orientation='vertical' className={classes.divider} light></Divider>
<NavigationMenu location={location}/>
<NavigationMenu location={location} />
</Hidden>
<Hidden smUp>
<Drawer
Expand All @@ -147,12 +148,7 @@ export function Header() {
</Grid>
</Drawer>
</Hidden>
<Grid
container
item
xs
justify='flex-end'
>
<Grid container item xs justify='flex-end'>
<UserMenu />
</Grid>
</Toolbar>
Expand Down
4 changes: 4 additions & 0 deletions template-sample-app/template/src/components/legends/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const useStyles = makeStyles((theme) => ({
...theme.typography.caption,
padding: theme.spacing(1.5),
backgroundColor: theme.palette.common.white,

'&:empty': {
display: 'none',
},
},
}));

Expand Down
23 changes: 20 additions & 3 deletions template-sample-app/template/src/components/views/Kpi.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { setError } from 'config/appSlice';
import { setBottomSheetOpen, setError } from 'config/appSlice';

import { Divider } from '@material-ui/core';
import { Divider, Typography, makeStyles } from '@material-ui/core';

import {
addLayer,
Expand All @@ -15,7 +15,14 @@ import { AggregationTypes, CategoryWidget, FormulaWidget } from '@carto/react/wi

import { currencyFormatter } from 'utils/formatter';

const useStyles = makeStyles((theme) => ({
title: {
padding: theme.spacing(3, 3, 1.5),
},
}));

export default function Kpi() {
const classes = useStyles();
const dispatch = useDispatch();

useEffect(() => {
Expand Down Expand Up @@ -44,9 +51,11 @@ export default function Kpi() {
addLayer({
id: 'kpiLayer',
source: 'kpiSource',
selectedStore: null,
})
);
// Close bottom panel
dispatch(setBottomSheetOpen(false));

// Clean up when leave
return function cleanup() {
dispatch(removeLayer('kpiLayer'));
Expand All @@ -64,6 +73,12 @@ export default function Kpi() {

return (
<div>
<Typography variant='h5' gutterBottom className={classes.title}>
Store Analysis
</Typography>

<Divider />

<FormulaWidget
title='Total revenue'
dataSource='kpiSource'
Expand All @@ -85,6 +100,8 @@ export default function Kpi() {
viewportFilter
onError={onRevenueByStateWidgetError}
/>

<Divider />
</div>
);
}
Loading