Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Website] Add 2020 Survey (#1154)

Giuseppe Macrì0bc3203d35cf
diff --git a/examples/demo-app/src/app.js b/examples/demo-app/src/app.js
index 0715fb0db..02aef9e12 100644
--- a/examples/demo-app/src/app.js
+++ b/examples/demo-app/src/app.js
@@ -25,7 +25,7 @@ import window from 'global/window';
import {connect} from 'react-redux';
import {theme} from 'kepler.gl/styles';
import Banner from './components/banner';
-import Announcement from './components/announcement';
+import Announcement, {FormLink} from './components/announcement';
import {replaceLoadDataModal} from './factories/load-data-modal';
import {replaceMapControl} from './factories/map-control';
import {replacePanelHeader} from './factories/panel-header';
@@ -61,8 +61,8 @@ import {addDataToMap, addNotification} from 'kepler.gl/actions';
import {processCsvData, processGeojson} from 'kepler.gl/processors';
/* eslint-enable no-unused-vars */
-const BannerHeight = 30;
-const BannerKey = 'kgHideBanner-iiba';
+const BannerHeight = 48;
+const BannerKey = `banner-${FormLink}`;
const keplerGlGetState = state => state.demo.keplerGl;
const GlobalStyle = styled.div`
@@ -130,9 +130,9 @@ class App extends Component {
}
// delay zs to show the banner
- // if (!window.localStorage.getItem(BannerKey)) {
- // window.setTimeout(this._showBanner, 3000);
- // }
+ if (!window.localStorage.getItem(BannerKey)) {
+ window.setTimeout(this._showBanner, 3000);
+ }
// load sample data
// this._loadSampleData();
@@ -356,7 +356,6 @@ class App extends Component {
};
render() {
- const {showBanner} = this.state;
return (
<ThemeProvider theme={theme}>
<GlobalStyle
@@ -370,7 +369,7 @@ class App extends Component {
<Banner
show={this.state.showBanner}
height={BannerHeight}
- bgColor="#82368c"
+ bgColor="#2E7CF6"
onClose={this._hideBanner}
>
<Announcement onDisable={this._disableBanner} />
@@ -380,9 +379,9 @@ class App extends Component {
transition: 'margin 1s, height 1s',
position: 'absolute',
width: '100%',
- height: showBanner ? `calc(100% - ${BannerHeight}px)` : '100%',
- minHeight: `calc(100% - ${BannerHeight}px)`,
- marginTop: showBanner ? `${BannerHeight}px` : 0
+ height: '100%',
+ left: 0,
+ top: 0
}}
>
<AutoSizer>
@@ -395,7 +394,7 @@ class App extends Component {
*/
getState={keplerGlGetState}
width={width}
- height={height - (showBanner ? BannerHeight : 0)}
+ height={height}
cloudProviders={CLOUD_PROVIDERS}
onExportToCloudSuccess={onExportFileSuccess}
onLoadCloudMapSuccess={onLoadCloudMapSuccess}
diff --git a/examples/demo-app/src/components/announcement.js b/examples/demo-app/src/components/announcement.js
index 190a78ca0..081644ede 100644
--- a/examples/demo-app/src/components/announcement.js
+++ b/examples/demo-app/src/components/announcement.js
@@ -27,8 +27,9 @@ const StyledText = styled.div`
const StyledLink = styled.a`
text-decoration: underline !important;
- color: white;
+ color: white !important;
font-weight: 500;
+ margin-left: 8px;
:hover {
cursor: pointer;
@@ -39,18 +40,23 @@ const DisableBanner = styled.div`
display: inline-block;
margin-left: 20px;
`;
-const FormLink = 'https://www.informationisbeautifulawards.com/showcase/3082-kepler-gl';
+
+// We are using the link to make sure users who have seen
+// previous banners can see this one because we check localstorage key
+export const FormLink = 'https://shan990829.typeform.com/to/RbCAXt';
const Announcement = ({onDisable}) => (
<StyledText>
- <span>Kepler.gl is shortlisted in the Information is Beautiful Award. </span>
+ <span>
+ Kepler.gl turns two years old!. Help our oepn source community by taking this 5-minute-survey
+ and win a <b>$100 Amazon gift card</b>. Make your answers count!
+ </span>
<StyledLink target="_blank" href={FormLink}>
- Vote for us
+ Take the survey
</StyledLink>
- <span> before Fri 19th Oct!</span>
{onDisable ? (
<DisableBanner>
- <StyledLink onClick={onDisable}>Already Voted!</StyledLink>
+ <StyledLink onClick={onDisable}>Already provided my feedback!</StyledLink>
</DisableBanner>
) : null}
</StyledText>
diff --git a/examples/demo-app/src/components/banner.js b/examples/demo-app/src/components/banner.js
index 24c239fcb..4aed50d6a 100644
--- a/examples/demo-app/src/components/banner.js
+++ b/examples/demo-app/src/components/banner.js
@@ -38,6 +38,8 @@ const StyledBanner = styled.div`
svg:hover {
cursor: pointer;
}
+
+ top: ${props => (props.visible ? 0 : -100)}px;
`;
const Banner = ({
@@ -53,7 +55,7 @@ const Banner = ({
bgColor={bgColor}
fontColor={fontColor}
height={height}
- style={{top: show ? 0 : `-100px`}}
+ visible={show}
>
<div>{children}</div>
<Icons.Delete height="14px" onClick={onClose} />
diff --git a/test/browser/layer-tests/trip-layer-specs.js b/test/browser/layer-tests/trip-layer-specs.js
index 1c5f949a9..551ea561d 100644
--- a/test/browser/layer-tests/trip-layer-specs.js
+++ b/test/browser/layer-tests/trip-layer-specs.js
@@ -419,6 +419,6 @@ test('#TripLayer -> parseTripGeoJsonTimestamp', t => {
const result = parseTripGeoJsonTimestamp(dataToFeature1);
- t.deepEqual(result.animationDomain, [1565577261, 1565578836], 'should filter out illugal value')
+ t.deepEqual(result.animationDomain, [1565577261, 1565578836], 'should filter out illugal value');
t.end();
});
diff --git a/website/src/components/home.js b/website/src/components/home.js
index 407851d8a..d19be176f 100644
--- a/website/src/components/home.js
+++ b/website/src/components/home.js
@@ -38,7 +38,7 @@ import Announcement from '../../../examples/demo-app/src/components/announcement
const BannerKey = 'kgHideBanner-iiba';
const BannerHeight = 30;
-const BACKGROUND_COLOR = '#82368c';
+const BACKGROUND_COLOR = '#2E7CF6';
const SECTION_CONTENT = {
showcase: Showcase,
@@ -55,9 +55,9 @@ export default class Home extends PureComponent {
componentDidMount() {
// delay 2s to show the banner
- // if (!window.localStorage.getItem(BannerKey)) {
- // window.setTimeout(this._showBanner, 3000);
- // }
+ if (!window.localStorage.getItem(BannerKey)) {
+ window.setTimeout(this._showBanner, 3000);
+ }
}
_showBanner = () => {