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

Cleanup templates & pin deck.gl 8.4.10 #212

Merged
merged 4 commits into from
Mar 11, 2021
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
Expand Up @@ -11,6 +11,7 @@
- Adapt to new **multi-package** structure for carto-react libs [#206](https://github.com/CartoDB/carto-react-lib/pull/206)
- Fix layer generator with second layer [#204](https://github.com/CartoDB/carto-react-template/pull/204)
- Fix bug in formatter applied to histogram [#211](https://github.com/CartoDB/carto-react-template/pull/211)
- Cleanup templates & pin deck.gl 8.4.10 [#212](https://github.com/CartoDB/carto-react-template/pull/212)

## 1.0.0-beta12 (2021-02-08)
- Refactor on basic JSX & JS stuff [#170](https://github.com/CartoDB/carto-react-template/pull/170)
Expand Down
2 changes: 1 addition & 1 deletion template-sample-app/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"cypress": "^6.3.0",
"deck.gl": "^8.4.9",
"deck.gl": "8.4.10",
"echarts": "^4.9.0",
"echarts-for-react": "^2.0.16",
"eslint-config-prettier": "^7.2.0",
Expand Down
2 changes: 1 addition & 1 deletion template-sample-app/template/package.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"cypress": "^6.3.0",
"deck.gl": "^8.4.9",
"deck.gl": "8.4.10",
"echarts": "^4.9.0",
"echarts-for-react": "^2.0.16",
"history": "^5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ function Stores() {

useEffect(() => {
dispatch(addSource(storesSource));

dispatch(
addLayer({
id: STORES_LAYER_ID,
source: storesSource.id,
})
);

dispatch(addLayer({ id: STORES_LAYER_ID, source: storesSource.id }));

return () => {
Expand Down
2 changes: 1 addition & 1 deletion template-skeleton/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"cypress": "^6.3.0",
"deck.gl": "^8.4.9",
"deck.gl": "8.4.10",
"echarts": "^4.9.0",
"echarts-for-react": "^2.0.16",
"eslint-config-prettier": "^7.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ describe('Home Page', () => {
cy.visit(HOME_PAGE);

cy.findByRole('tab', { name: /Home/i }).should('exist');
cy.findByRole('button', { name: /Login/i }).should('exist');
});

it('main elements are visible', () => {
Expand All @@ -23,8 +22,5 @@ describe('Home Page', () => {
// Zoom controls
cy.findByRole('button', { name: /Increase zoom/i }).should('exist');
cy.findByRole('button', { name: /Decrease zoom/i }).should('exist');

// Geocoder
cy.findByPlaceholderText('Search address').should('exist');
});
});
2 changes: 1 addition & 1 deletion template-skeleton/template/package.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@turf/bbox-polygon": "^6.3.0",
"@turf/boolean-intersects": "^6.3.0",
"cypress": "^6.3.0",
"deck.gl": "^8.4.9",
"deck.gl": "8.4.10",
"echarts": "^4.9.0",
"echarts-for-react": "^2.0.16",
"history": "^5.0.0",
Expand Down
32 changes: 0 additions & 32 deletions template-skeleton/template/src/components/layers/GeocoderLayer.js

This file was deleted.

2 changes: 0 additions & 2 deletions template-skeleton/template/src/components/layers/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import GeocoderLayer from './GeocoderLayer';
// [hygen] Import layers

export const getLayers = () => {
return [
GeocoderLayer(),
// [hygen] Add layer
];
};
18 changes: 0 additions & 18 deletions template-skeleton/template/src/components/views/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
import { makeStyles } from '@material-ui/core/styles';
import { Alert } from '@material-ui/lab';
import ExpandLessIcon from '@material-ui/icons/ExpandLess';
import { GeocoderWidget } from '@carto/react-widgets';
import { BASEMAPS } from '@carto/react-basemaps';
import Map from 'components/common/Map';
import ZoomControl from 'components/common/ZoomControl';
Expand Down Expand Up @@ -110,18 +109,6 @@ const useStyles = makeStyles((theme) => ({
},
},
},
geocoder: {
position: 'absolute',
top: theme.spacing(4),
left: theme.spacing(4),
zIndex: 1,

[theme.breakpoints.down('xs')]: {
top: theme.spacing(2),
left: theme.spacing(2),
width: `calc(100% - ${theme.spacing(4)}px)`,
},
},
zoomControl: {
position: 'absolute',
bottom: theme.spacing(4),
Expand Down Expand Up @@ -176,10 +163,6 @@ function Main() {
dispatch(setBottomSheetOpen(!bottomSheetOpen));
};

const onGeocoderWidgetError = (error) => {
dispatch(setError(`Geocoding error: ${error.message}`));
};

return (
<Grid container direction='row' alignItems='stretch' item xs>
<nav className={classes.drawer}>
Expand Down Expand Up @@ -235,7 +218,6 @@ function Main() {

<Grid item className={`${classes.mapWrapper} ${isGmaps ? classes.gmaps : ''}`}>
<Map layers={getLayers()} />
<GeocoderWidget className={classes.geocoder} onError={onGeocoderWidgetError} />
<Hidden xsDown>
<ZoomControl className={classes.zoomControl} />
</Hidden>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
Typography,
} from '@material-ui/core';
import { logout } from '@carto/react-redux';
import UserMenuLogin from './UserMenuLogin';

const useStyles = makeStyles((theme) => ({
avatar: {
Expand All @@ -34,12 +33,12 @@ function UserMenu() {
return null;
}

// User is NOT logged in, so display Login with CARTO
// User is NOT logged in, so display nothing
if (!user) {
return <UserMenuLogin />;
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return; is fine?

Copy link
Contributor Author

@VictorVelarde VictorVelarde Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AdriSolid I don't have a preference. Is there any official recommendation on that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that we return null in several components, for me we can leave it like this 👍

}

// At this point, there is an oauthApp and the user has logged in.
// At this point, there is an oauthApp and the user has logged in (forceOAuthLogin mode).
const open = Boolean(anchorEl);

const handleMenu = (event) => {
Expand Down
5 changes: 0 additions & 5 deletions template-skeleton/template/src/store/appSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ const slice = createSlice({
name: 'app',
initialState: {
error: null,
isolineResult: null,
bottomSheetOpen: false,
forceOAuthLogin: false, // enable for an initial Login screen
},
reducers: {
setIsolineResult: (state, action) => {
state.isolineResult = action.payload;
},
setError: (state, action) => {
state.error = action.payload;
},
Expand All @@ -23,7 +19,6 @@ const slice = createSlice({

export default slice.reducer;

export const setIsolineResult = (payload) => ({ type: 'app/setIsolineResult', payload });
export const setError = (payload) => ({ type: 'app/setError', payload });
export const setBottomSheetOpen = (payload) => ({
type: 'app/setBottomSheetOpen',
Expand Down
2 changes: 0 additions & 2 deletions template-skeleton/template/src/store/initialStateSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export const oauthInitialState = {
clientId: 'TYPE HERE YOUR OAUTH CLIENT ID',
scopes: [
'user:profile', // to load avatar photo
'dataservices:geocoding', // to use geocoding through Data Services API
'dataservices:isolines', // to launch isochrones or isodistances through Data Services API
],
authorizeEndPoint: 'https://carto.com/oauth2/authorize', // only valid if keeping https://localhost:3000/oauthCallback
},
Expand Down