);
-export default ChatModal;
+const data = {
+ content: ChatModal,
+ title: 'Chat',
+};
+
+export default data;
diff --git a/src/components/CoordinatesBox.jsx b/src/components/CoordinatesBox.jsx
index 3151572..74d028a 100644
--- a/src/components/CoordinatesBox.jsx
+++ b/src/components/CoordinatesBox.jsx
@@ -19,8 +19,7 @@ function renderCoordinates(cell): string {
const CoordinatesBox = ({ view, hover, notifyCopy }) => (
{ copy(location.hash); notifyCopy(); }}
+ onClick={() => { copy(window.location.hash); notifyCopy(); }}
role="button"
title="Copy to Clipboard"
tabIndex="0"
diff --git a/src/components/ForgotPasswordModal.jsx b/src/components/ForgotPasswordModal.jsx
index 7a6a255..2defaca 100644
--- a/src/components/ForgotPasswordModal.jsx
+++ b/src/components/ForgotPasswordModal.jsx
@@ -6,24 +6,20 @@
import React from 'react';
import { connect } from 'react-redux';
-import Modal from './Modal';
-
import { showUserAreaModal } from '../actions';
import NewPasswordForm from './NewPasswordForm';
const ForgotPasswordModal = ({ login }) => (
-
-
-
- Enter your mail adress and we will send you a new password:
-
-
-
-
Also join our Discord:
- pixelplanet.fun/discord
-
+
+
+ Enter your mail adress and we will send you a new password:
+
+
+
+
Also join our Discord:
+ pixelplanet.fun/discord
-
+
);
function mapDispatchToProps(dispatch) {
@@ -34,5 +30,9 @@ function mapDispatchToProps(dispatch) {
};
}
+const data = {
+ content: connect(null, mapDispatchToProps)(ForgotPasswordModal),
+ title: 'Restore my Password',
+};
-export default connect(null, mapDispatchToProps)(ForgotPasswordModal);
+export default data;
diff --git a/src/components/HelpModal.jsx b/src/components/HelpModal.jsx
index d6abed9..21eaf74 100644
--- a/src/components/HelpModal.jsx
+++ b/src/components/HelpModal.jsx
@@ -10,59 +10,60 @@ import React from 'react';
/* eslint-disable max-len */
-import Modal from './Modal';
-
const HelpModal = () => (
-
-
-
Place color pixels on a large canvas with other players online!
- Our main canvas is a huge worldmap, you can place wherever you like, but you will have to wait a specific
- Cooldown between pixels. You can check out the cooldown and requiremnts on the Canvas Selection menu (globe button on top).
- Some canvases have a different cooldown for replacing a user-set pixels than placing on a unset pixel. i.e. 4s/7s means 4s on fresh
- pixels and 7s on already set pixels.
- Higher zoomlevels take some time to update, the 3D globe gets updated at least once per day.
- Have fun!
- Discord: pixelplanet.fun/discord
- Source on github
- Reddit: r/PixelPlanetFun
- Map Data
- The bare map data that we use, together with converted OpenStreetMap tiles for orientation,
- can be downloaded from mega.nz here: pixelplanetmap.zip (422MB)
- Detected as Proxy?
- If you got detected as proxy, but you are none, please send us an e-mail with your IP to pixelplanetdev@gmail.com . Do not post your IP anywhere else. We are sorry for the inconvenience.
- 2D Controls
- Click a color in palette to select
- Press G to toggle grid
- Press X to toggle showing of pixel activity
- Press R to copy coordinates
- Press Q or E to zoom
- Press W ,A ,S , D to move
- Press ↑ ,← ,↓ , → to move
- Drag mouse to move
- Scroll mouse wheel to zoom
- Click middle mouse button to current hovering color
- Pinch to zoom (on touch devices)
- Pan to move (on touch devices)
- Click or tap to place a pixel
- 3D Controls
- Press W ,A ,S , D to move
- Press ↑ ,← ,↓ , → to move
- Scroll mouse wheel to zoom
- Left click and drag mouse to rotate
- Middle click and drag mouse to zoom
- Right click and drag mouse to pan
- Left Click or tap to place a pixel
- Right Click of double tap to remove a pixel
- Partners: crazygames.com
-
- This site is protected by reCAPTCHA and the Google
- Privacy Policy and
- Terms of Service apply.
-
-
+
+
Place color pixels on a large canvas with other players online!
+ Our main canvas is a huge worldmap, you can place wherever you like, but you will have to wait a specific
+ Cooldown between pixels. You can check out the cooldown and requiremnts on the Canvas Selection menu (globe button on top).
+ Some canvases have a different cooldown for replacing a user-set pixels than placing on a unset pixel. i.e. 4s/7s means 4s on fresh
+ pixels and 7s on already set pixels.
+ Higher zoomlevels take some time to update, the 3D globe gets updated at least once per day.
+ Have fun!
+ Discord: pixelplanet.fun/discord
+ Source on github
+ Reddit: r/PixelPlanetFun
+ Map Data
+ The bare map data that we use, together with converted OpenStreetMap tiles for orientation,
+ can be downloaded from mega.nz here: pixelplanetmap.zip (422MB)
+ Detected as Proxy?
+ If you got detected as proxy, but you are none, please send us an e-mail with your IP to pixelplanetdev@gmail.com . Do not post your IP anywhere else. We are sorry for the inconvenience.
+ 2D Controls
+ Click a color in palette to select
+ Press G to toggle grid
+ Press X to toggle showing of pixel activity
+ Press R to copy coordinates
+ Press Q or E to zoom
+ Press W ,A ,S , D to move
+ Press ↑ ,← ,↓ , → to move
+ Drag mouse to move
+ Scroll mouse wheel to zoom
+ Click middle mouse button to current hovering color
+ Pinch to zoom (on touch devices)
+ Pan to move (on touch devices)
+ Click or tap to place a pixel
+ 3D Controls
+ Press W ,A ,S , D to move
+ Press ↑ ,← ,↓ , → to move
+ Scroll mouse wheel to zoom
+ Left click and drag mouse to rotate
+ Middle click and drag mouse to zoom
+ Right click and drag mouse to pan
+ Left Click or tap to place a pixel
+ Right Click of double tap to remove a pixel
+ Partners: crazygames.com
+
+ This site is protected by reCAPTCHA and the Google
+ Privacy Policy and
+ Terms of Service apply.
+
-
+
);
-export default HelpModal;
+const data = {
+ content: HelpModal,
+ title: 'Welcome to PixelPlanet.fun',
+};
+
+export default data;
diff --git a/src/components/Menu.jsx b/src/components/Menu.jsx
index c402c9b..5342a49 100644
--- a/src/components/Menu.jsx
+++ b/src/components/Menu.jsx
@@ -4,7 +4,7 @@
* @flow
*/
-import React from 'react';
+import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import HelpButton from './HelpButton';
@@ -13,15 +13,36 @@ import LogInButton from './LogInButton';
import DownloadButton from './DownloadButton';
import MinecraftButton from './MinecraftButton';
-const Menu = ({ menuOpen }) => (
-
-
-
-
-
-
-
-);
+function Menu({
+ menuOpen,
+}) {
+ const [render, setRender] = useState(false);
+
+ useEffect(() => {
+ window.setTimeout(() => {
+ if (menuOpen) setRender(true);
+ }, 10);
+ }, [menuOpen]);
+
+ const onTransitionEnd = () => {
+ if (!menuOpen) setRender(false);
+ };
+
+ return (
+ (render || menuOpen) && (
+
+
+
+
+
+
+
+ )
+ );
+}
function mapStateToProps(state: State) {
const { menuOpen } = state.gui;
diff --git a/src/components/MinecraftModal.jsx b/src/components/MinecraftModal.jsx
index 3f875fe..544144c 100644
--- a/src/components/MinecraftModal.jsx
+++ b/src/components/MinecraftModal.jsx
@@ -6,17 +6,13 @@
import React from 'react';
import { connect } from 'react-redux';
-import Modal from './Modal';
-
const MinecraftModal = () => (
-
-
-
You can also place pixels from our Minecraft Server at
-
- Please Note that the Minecraft Server is down from time to time
-
-
+
+
You can also place pixels from our Minecraft Server at
+
+
Please Note that the Minecraft Server is down from time to time
+
);
function mapStateToProps(state: State) {
@@ -24,4 +20,9 @@ function mapStateToProps(state: State) {
return { center };
}
-export default connect(mapStateToProps)(MinecraftModal);
+const data = {
+ content: connect(mapStateToProps)(MinecraftModal),
+ title: 'PixelPlanet Minecraft Server',
+};
+
+export default data;
diff --git a/src/components/Modal.jsx b/src/components/Modal.jsx
deleted file mode 100644
index 642cf37..0000000
--- a/src/components/Modal.jsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- *
- * @flow
- */
-
-import React from 'react';
-import Modal from 'react-modal';
-import { connect } from 'react-redux';
-import { MdClose } from 'react-icons/md';
-
-import {
- hideModal,
-} from '../actions';
-
-
-function MyModal({ close, title, children }) {
- return (
-
- {title}
-
- {children}
-
- );
-}
-
-function mapDispatchToProps(dispatch) {
- return {
- close() {
- dispatch(hideModal());
- },
- };
-}
-
-export default connect(null, mapDispatchToProps)(MyModal);
diff --git a/src/components/ModalRoot.jsx b/src/components/ModalRoot.jsx
index b4e9f1a..d2f1da1 100644
--- a/src/components/ModalRoot.jsx
+++ b/src/components/ModalRoot.jsx
@@ -6,7 +6,13 @@
*/
import React from 'react';
+import Modal from 'react-modal';
import { connect } from 'react-redux';
+import { MdClose } from 'react-icons/md';
+
+import {
+ hideModal,
+} from '../actions';
import HelpModal from './HelpModal';
import SettingsModal from './SettingsModal';
@@ -19,6 +25,7 @@ import MinecraftModal from './MinecraftModal';
const MODAL_COMPONENTS = {
+ NONE: { content:
, title: '' },
HELP: HelpModal,
SETTINGS: SettingsModal,
USERAREA: UserAreaModal,
@@ -30,15 +37,43 @@ const MODAL_COMPONENTS = {
/* other modals */
};
-const ModalRoot = ({ modalType }) => {
- if (!modalType) {
- return null;
- }
-
- const SpecificModal = MODAL_COMPONENTS[modalType];
- return
;
+const ModalRoot = ({ modalType, modalOpen, close }) => {
+ const choice = MODAL_COMPONENTS[modalType || 'NONE'];
+ const { content: SpecificModal, title } = choice;
+ return (
+
+ {title}
+
+
+
+ );
};
-export default connect(
- (state) => state.modal,
-)(ModalRoot);
+function mapStateToProps(state: State) {
+ const { modalType, modalOpen } = state.modal;
+ return { modalType, modalOpen };
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ close() {
+ dispatch(hideModal());
+ },
+ };
+}
+
+export default connect(mapStateToProps, mapDispatchToProps)(ModalRoot);
diff --git a/src/components/Palette.jsx b/src/components/Palette.jsx
index b009fd4..74f03be 100644
--- a/src/components/Palette.jsx
+++ b/src/components/Palette.jsx
@@ -7,8 +7,8 @@ import React, { useState, useEffect } from 'react';
import { connect } from 'react-redux';
import { selectColor } from '../actions';
-
import type { State } from '../reducers';
+import useWindowSize from '../utils/reactHookResize';
/*
@@ -90,27 +90,6 @@ function getStylesByWindowSize(
}];
}
-function useWindowSize() {
- const [windowSize, setWindowSize] = useState({
- width: window.innerWidth,
- height: window.innerHeight,
- });
-
- useEffect(() => {
- function handleResize() {
- setWindowSize({
- width: window.innerWidth,
- height: window.innerHeight,
- });
- }
-
- window.addEventListener('resize', handleResize);
- return () => window.removeEventListener('resize', handleResize);
- }, []);
-
- return windowSize;
-}
-
function Palette({
colors,
selectedColor,
@@ -119,8 +98,20 @@ function Palette({
select,
clrIgnore,
}) {
+ const [render, setRender] = useState(false);
+
+ useEffect(() => {
+ window.setTimeout(() => {
+ if (paletteOpen) setRender(true);
+ }, 10);
+ }, [paletteOpen]);
+
+ const onTransitionEnd = () => {
+ if (!paletteOpen) setRender(false);
+ };
+
const [paletteStyle, spanStyle] = getStylesByWindowSize(
- paletteOpen,
+ (render && paletteOpen),
useWindowSize(),
colors,
clrIgnore,
@@ -128,28 +119,31 @@ function Palette({
);
return (
-
- {colors.slice(2).map((color, index) => (
- select(index + clrIgnore)}
- />
- ))}
-
+ (render || paletteOpen) && (
+
+ {colors.slice(2).map((color, index) => (
+ select(index + clrIgnore)}
+ />
+ ))}
+
+ )
);
}
diff --git a/src/components/RegisterModal.jsx b/src/components/RegisterModal.jsx
index c66a67e..4aac298 100644
--- a/src/components/RegisterModal.jsx
+++ b/src/components/RegisterModal.jsx
@@ -6,8 +6,6 @@
import React from 'react';
import { connect } from 'react-redux';
-import Modal from './Modal';
-
import { showUserAreaModal } from '../actions';
// import { send_registration } from '../ui/register';
@@ -15,17 +13,15 @@ import SignUpForm from './SignUpForm';
const RegisterModal = ({ login }) => (
-
-
-
Register new account here
-
-
-
Also join our Discord:
- pixelplanet.fun/discord
-
+
+
Register new account here
+
+
+
Also join our Discord:
+ pixelplanet.fun/discord
-
+
);
function mapDispatchToProps(dispatch) {
@@ -36,4 +32,9 @@ function mapDispatchToProps(dispatch) {
};
}
-export default connect(null, mapDispatchToProps)(RegisterModal);
+const data = {
+ content: connect(null, mapDispatchToProps)(RegisterModal),
+ title: 'Register New Account',
+};
+
+export default data;
diff --git a/src/components/SettingsModal.jsx b/src/components/SettingsModal.jsx
index 4529e5d..643cf27 100644
--- a/src/components/SettingsModal.jsx
+++ b/src/components/SettingsModal.jsx
@@ -6,7 +6,6 @@
import React from 'react';
import { connect } from 'react-redux';
-import Modal from './Modal';
import MdToggleButtonHover from './MdToggleButtonHover';
import {
toggleGrid,
@@ -118,82 +117,80 @@ function SettingsModal({
chatNotify,
}) {
return (
-
-
-
-
-
-
-
-
-
-
- { (window.backupurl)
- ? (
-
- ) : null }
- {(typeof window.availableStyles !== 'undefined') && (
-
+
+
+
+
+
+
+
+
+ { (window.backupurl)
+ ? (
+
- )}
-
-
+ ) : null }
+ {(typeof window.availableStyles !== 'undefined') && (
+
+ )}
+
);
}
@@ -263,4 +260,9 @@ function mapDispatchToProps(dispatch) {
};
}
-export default connect(mapStateToProps, mapDispatchToProps)(SettingsModal);
+const data = {
+ content: connect(mapStateToProps, mapDispatchToProps)(SettingsModal),
+ title: 'Settings',
+};
+
+export default data;
diff --git a/src/components/UserAreaModal.jsx b/src/components/UserAreaModal.jsx
index 218c933..303f6d1 100644
--- a/src/components/UserAreaModal.jsx
+++ b/src/components/UserAreaModal.jsx
@@ -6,8 +6,6 @@
import React, { Suspense } from 'react';
import { connect } from 'react-redux';
-import Modal from './Modal';
-
import type { State } from '../reducers';
@@ -86,40 +84,38 @@ const LogInArea = ({ register, forgotPassword, me }) => (
const UserAreaModal = ({
name, register, forgotPassword, doMe, logout, setUserName, setUserMailreg,
}) => (
-
-
- {(name === null)
- ? (
-
- )
- : (
-
-
-
-
-
-
-
-
- Loading...
}>
-
-
-