finalize retiring canvases

This commit is contained in:
HF 2024-01-05 00:48:29 +01:00
parent 75485ac140
commit 1cdd9ba5cc
7 changed files with 377 additions and 346 deletions

View File

@ -98,14 +98,6 @@ msgstr ""
msgid "Loading..." msgid "Loading..."
msgstr "" msgstr ""
#: src/ssr/Main.jsx:55
msgid "PixelPlanet.Fun"
msgstr ""
#: src/ssr/Main.jsx:56
msgid "Place color pixels on an map styled canvas with other players online"
msgstr ""
#: src/ssr/PopUp.jsx:47 #: src/ssr/PopUp.jsx:47
msgid "ppfun" msgid "ppfun"
msgstr "" msgstr ""
@ -114,6 +106,14 @@ msgstr ""
msgid "PixelPlanet.Fun PopUp" msgid "PixelPlanet.Fun PopUp"
msgstr "" msgstr ""
#: src/ssr/Main.jsx:55
msgid "PixelPlanet.Fun"
msgstr ""
#: src/ssr/Main.jsx:56
msgid "Place color pixels on an map styled canvas with other players online"
msgstr ""
#: src/utils/validation.js:17 #: src/utils/validation.js:17
msgid "Email can't be empty." msgid "Email can't be empty."
msgstr "" msgstr ""
@ -204,10 +204,6 @@ msgstr ""
msgid "Submit" msgid "Submit"
msgstr "" msgstr ""
#: src/routes/api/baninfo.js:32
msgid "You are not banned"
msgstr ""
#: src/routes/api/modtools.js:53 #: src/routes/api/modtools.js:53
msgid "You are not logged in" msgid "You are not logged in"
msgstr "" msgstr ""
@ -220,44 +216,8 @@ msgstr ""
msgid "Just admins can do that" msgid "Just admins can do that"
msgstr "" msgstr ""
#: src/routes/api/auth/logout.js:11 #: src/routes/api/baninfo.js:32
msgid "You are not even logged in." msgid "You are not banned"
msgstr ""
#: src/routes/api/auth/delete_account.js:65
#: src/routes/api/auth/logout.js:20
msgid "Server error when logging out."
msgstr ""
#: src/routes/api/auth/verify.js:26
#: src/routes/api/auth/verify.js:35
msgid "Mail verification"
msgstr ""
#: src/routes/api/auth/verify.js:27
msgid "You are now verified :)"
msgstr ""
#: src/routes/api/auth/verify.js:35
msgid ""
"Your mail verification code is invalid or already expired :(, please "
"request a new one."
msgstr ""
#: src/routes/api/auth/change_mail.js:44
#: src/routes/api/auth/change_passwd.js:34
#: src/routes/api/auth/delete_account.js:36
msgid "You are not authenticated."
msgstr ""
#: src/routes/api/auth/change_mail.js:53
#: src/routes/api/auth/change_passwd.js:43
#: src/routes/api/auth/delete_account.js:55
msgid "Incorrect password!"
msgstr ""
#: src/routes/api/auth/delete_account.js:46
msgid "Muted users can not delete their account."
msgstr "" msgstr ""
#: src/routes/api/auth/change_mail.js:22 #: src/routes/api/auth/change_mail.js:22
@ -265,23 +225,6 @@ msgstr ""
msgid "This email provider is not allowed" msgid "This email provider is not allowed"
msgstr "" msgstr ""
#: src/routes/api/auth/change_mail.js:62
msgid "Muted users can not do this."
msgstr ""
#: src/ssr/RedirectionPage.jsx:19
msgid "PixelPlanet.fun Accounts"
msgstr ""
#: src/ssr/RedirectionPage.jsx:29
msgid "You will be automatically redirected after 15s"
msgstr ""
#: src/ssr/RedirectionPage.jsx:30
#, javascript-format
msgid "Or ${ clickHere } to go back to pixelplanet"
msgstr ""
#: src/routes/api/auth/register.js:31 #: src/routes/api/auth/register.js:31
msgid "No Captcha given" msgid "No Captcha given"
msgstr "" msgstr ""
@ -314,6 +257,50 @@ msgstr ""
msgid "Failed to establish session after register :(" msgid "Failed to establish session after register :("
msgstr "" msgstr ""
#: src/routes/api/auth/verify.js:26
#: src/routes/api/auth/verify.js:35
msgid "Mail verification"
msgstr ""
#: src/routes/api/auth/verify.js:27
msgid "You are now verified :)"
msgstr ""
#: src/routes/api/auth/verify.js:35
msgid ""
"Your mail verification code is invalid or already expired :(, please "
"request a new one."
msgstr ""
#: src/routes/api/auth/logout.js:11
msgid "You are not even logged in."
msgstr ""
#: src/routes/api/auth/delete_account.js:65
#: src/routes/api/auth/logout.js:20
msgid "Server error when logging out."
msgstr ""
#: src/routes/api/auth/change_mail.js:44
#: src/routes/api/auth/change_passwd.js:34
#: src/routes/api/auth/delete_account.js:36
msgid "You are not authenticated."
msgstr ""
#: src/routes/api/auth/change_mail.js:53
#: src/routes/api/auth/change_passwd.js:43
#: src/routes/api/auth/delete_account.js:55
msgid "Incorrect password!"
msgstr ""
#: src/routes/api/auth/delete_account.js:46
msgid "Muted users can not delete their account."
msgstr ""
#: src/routes/api/auth/change_mail.js:62
msgid "Muted users can not do this."
msgstr ""
#: src/canvasesDesc.js:20 #: src/canvasesDesc.js:20
msgid "Earth" msgid "Earth"
msgstr "" msgstr ""
@ -392,6 +379,19 @@ msgid ""
"old world and all it entails." "old world and all it entails."
msgstr "" msgstr ""
#: src/ssr/RedirectionPage.jsx:19
msgid "PixelPlanet.fun Accounts"
msgstr ""
#: src/ssr/RedirectionPage.jsx:29
msgid "You will be automatically redirected after 15s"
msgstr ""
#: src/ssr/RedirectionPage.jsx:30
#, javascript-format
msgid "Or ${ clickHere } to go back to pixelplanet"
msgstr ""
#: src/core/MailProvider.js:66 #: src/core/MailProvider.js:66
#, javascript-format #, javascript-format
msgid "Welcome ${ name } to PixelPlanet, please verify your mail" msgid "Welcome ${ name } to PixelPlanet, please verify your mail"

View File

@ -46,14 +46,6 @@ msgstr ""
msgid "Hide Hidden Canvases" msgid "Hide Hidden Canvases"
msgstr "" msgstr ""
#: src/ui/rendererFactory.js:30
msgid "Canvas Error"
msgstr ""
#: src/ui/rendererFactory.js:31
msgid "Can't render 3D canvas, do you have WebGL2 disabled?"
msgstr ""
#: src/ui/PixelTransferController.js:70 #: src/ui/PixelTransferController.js:70
msgid "Error :(" msgid "Error :("
msgstr "" msgstr ""
@ -179,6 +171,14 @@ msgstr ""
msgid "Error ${ retCode }" msgid "Error ${ retCode }"
msgstr "" msgstr ""
#: src/ui/rendererFactory.js:30
msgid "Canvas Error"
msgstr ""
#: src/ui/rendererFactory.js:31
msgid "Can't render 3D canvas, do you have WebGL2 disabled?"
msgstr ""
#: src/components/BanInfo.jsx:136 #: src/components/BanInfo.jsx:136
#: src/store/actions/index.js:7 #: src/store/actions/index.js:7
msgid "OK" msgid "OK"
@ -250,6 +250,14 @@ msgstr ""
msgid "Pixels placed" msgid "Pixels placed"
msgstr "" msgstr ""
#: src/components/buttons/ChatButton.jsx:88
msgid "Close Chat"
msgstr ""
#: src/components/buttons/ChatButton.jsx:88
msgid "Open Chat"
msgstr ""
#: src/components/buttons/CanvasSwitchButton.jsx:20 #: src/components/buttons/CanvasSwitchButton.jsx:20
#: src/components/windows/index.js:19 #: src/components/windows/index.js:19
msgid "Canvas Selection" msgid "Canvas Selection"
@ -263,14 +271,6 @@ msgstr ""
msgid "Open Menu" msgid "Open Menu"
msgstr "" msgstr ""
#: src/components/buttons/ChatButton.jsx:88
msgid "Close Chat"
msgstr ""
#: src/components/buttons/ChatButton.jsx:88
msgid "Open Chat"
msgstr ""
#: src/components/HistorySelect.jsx:146 #: src/components/HistorySelect.jsx:146
msgid "Loading" msgid "Loading"
msgstr "" msgstr ""
@ -449,54 +449,6 @@ msgstr ""
msgid "Why?" msgid "Why?"
msgstr "" msgstr ""
#: src/components/windows/CanvasSelect.jsx:29
msgid ""
"Select the canvas you want to use.\n"
"Every canvas is unique and has different palettes, cooldown and "
"requirements.\n"
"Archive of closed canvases can be accessed here:"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:37
msgid "Archive"
msgstr ""
#: src/components/windows/Archive.jsx:29
msgid ""
"While we tend to not delete canvases, some canvases are started for fun or "
"as a request by users who currently like a meme. Those canvases can get "
"boring after a while and after weeks of no major change and if they really "
"aren't worth being kept active. And Some other canvases might outlive their "
"welcome and become useless."
msgstr ""
#: src/components/windows/Archive.jsx:30
msgid "Here we collect removed canvases to archive them in a proper way."
msgstr ""
#: src/components/windows/Archive.jsx:35
msgid "Removed Canvases with history available"
msgstr ""
#: src/components/windows/Archive.jsx:53
msgid "Political Compass Canvas"
msgstr ""
#: src/components/windows/Archive.jsx:60
msgid ""
"This canvas got requested during a time of political conflicts on the main "
"Earth canvas. It was a 1024x1024 representation of the political compass "
"with a 5s cooldown and 60s stacking. It got launched on May 11th and "
"remained active for months till it got shut down on November 30th."
msgstr ""
#: src/components/windows/Archive.jsx:61
msgid ""
"We decided to archive it as a timelapse with lossless encoded webm. Taking "
"a screenshot from the timelapse results in a perfect 1:1 representation of "
"how the canvas was at that time."
msgstr ""
#: src/components/windows/Help.jsx:42 #: src/components/windows/Help.jsx:42
msgid "Place color pixels on a large canvas with other players online!" msgid "Place color pixels on a large canvas with other players online!"
msgstr "" msgstr ""
@ -840,6 +792,55 @@ msgstr ""
msgid "Submit" msgid "Submit"
msgstr "" msgstr ""
#: src/components/windows/CanvasSelect.jsx:29
msgid ""
"Select the canvas you want to use.\n"
"Every canvas is unique and has different palettes, cooldown and "
"requirements.\n"
"Archive of removed canvases can be accessed here:"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:37
msgid "Archive"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:59
msgid "Retired Canvases (history only)"
msgstr ""
#: src/components/windows/Archive.jsx:16
msgid ""
"While we tend to not delete canvases, some canvases are started for fun or "
"as a request by users who currently like a meme. Those canvases can get "
"boring after a while and after weeks of no major change and if they really "
"aren't worth being kept active."
msgstr ""
#: src/components/windows/Archive.jsx:17
msgid ""
"Here we collect removed canvases to archive them in a proper way. Which is "
"currently only one."
msgstr ""
#: src/components/windows/Archive.jsx:19
msgid "Political Compass Canvas"
msgstr ""
#: src/components/windows/Archive.jsx:26
msgid ""
"This canvas got requested during a time of political conflicts on the main "
"Earth canvas. It was a 1024x1024 representation of the political compass "
"with a 5s cooldown and 60s stacking. It got launched on May 11th and "
"remained active for months till it got shut down on November 30th."
msgstr ""
#: src/components/windows/Archive.jsx:27
msgid ""
"We decided to archive it as a timelapse with lossless encoded webm. Taking "
"a screenshot from the timelapse results in a perfect 1:1 representation of "
"how the canvas was at that time."
msgstr ""
#: src/components/windows/Chat.jsx:180 #: src/components/windows/Chat.jsx:180
msgid "Start chatting here" msgid "Start chatting here"
msgstr "" msgstr ""
@ -953,6 +954,13 @@ msgstr ""
msgid "Copy" msgid "Copy"
msgstr "" msgstr ""
#: src/components/ChangeMail.jsx:91
#: src/components/ChangeName.jsx:68
#: src/components/ChangePassword.jsx:109
#: src/components/LanguageSelect.jsx:80
msgid "Save"
msgstr ""
#: src/components/LogInArea.jsx:19 #: src/components/LogInArea.jsx:19
msgid "Login to access more features and stats." msgid "Login to access more features and stats."
msgstr "" msgstr ""
@ -977,58 +985,6 @@ msgstr ""
msgid "Register" msgid "Register"
msgstr "" msgstr ""
#: src/components/CanvasItem.jsx:29
msgid "Online Users"
msgstr ""
#: src/components/CanvasItem.jsx:34
msgid "Cooldown"
msgstr ""
#: src/components/CanvasItem.jsx:40
msgid "Stacking till"
msgstr ""
#: src/components/CanvasItem.jsx:42
msgid "Ranked"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "Yes"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "No"
msgstr ""
#: src/components/CanvasItem.jsx:50
msgid "Requirements"
msgstr ""
#: src/components/CanvasItem.jsx:53
msgid "User Account"
msgstr ""
#: src/components/CanvasItem.jsx:55
#, javascript-format
msgid "and ${ canvas.req } Pixels set"
msgstr ""
#: src/components/CanvasItem.jsx:58
msgid "Top 10 Daily Ranking"
msgstr ""
#: src/components/CanvasItem.jsx:64
msgid "Dimensions"
msgstr ""
#: src/components/ChangeMail.jsx:91
#: src/components/ChangeName.jsx:68
#: src/components/ChangePassword.jsx:109
#: src/components/LanguageSelect.jsx:80
msgid "Save"
msgstr ""
#: src/components/UserAreaContent.jsx:62 #: src/components/UserAreaContent.jsx:62
msgid "Today Placed Pixels" msgid "Today Placed Pixels"
msgstr "" msgstr ""
@ -1187,6 +1143,79 @@ msgstr ""
msgid "Ranking updates every 5 min. Daily rankings get reset at midnight UTC." msgid "Ranking updates every 5 min. Daily rankings get reset at midnight UTC."
msgstr "" msgstr ""
#: src/components/CanvasItem.jsx:29
msgid "Online Users"
msgstr ""
#: src/components/CanvasItem.jsx:34
msgid "Cooldown"
msgstr ""
#: src/components/CanvasItem.jsx:40
msgid "Stacking till"
msgstr ""
#: src/components/CanvasItem.jsx:42
msgid "Ranked"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "Yes"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "No"
msgstr ""
#: src/components/CanvasItem.jsx:50
msgid "Requirements"
msgstr ""
#: src/components/CanvasItem.jsx:53
msgid "User Account"
msgstr ""
#: src/components/CanvasItem.jsx:55
#, javascript-format
msgid "and ${ canvas.req } Pixels set"
msgstr ""
#: src/components/CanvasItem.jsx:58
msgid "Top 10 Daily Ranking"
msgstr ""
#: src/components/CanvasItem.jsx:64
msgid "Dimensions"
msgstr ""
#: src/core/chartSettings.js:30
msgid "Top 10 Countries [pxls / day]"
msgstr ""
#: src/core/chartSettings.js:127
msgid "Players and Pixels per hour"
msgstr ""
#: src/core/chartSettings.js:221
msgid "Top 10 Players [pxls / day]"
msgstr ""
#: src/core/chartSettings.js:294
msgid "Countries by Pixels Today"
msgstr ""
#: src/core/chartSettings.js:351
msgid "Total Pixels placed per day"
msgstr ""
#: src/components/LogInForm.jsx:77
msgid "Name or Email"
msgstr ""
#: src/components/LogInForm.jsx:88
msgid "LogIn"
msgstr ""
#: src/components/UserMessages.jsx:28 #: src/components/UserMessages.jsx:28
msgid "" msgid ""
"Please verify your mail address or your account could get deleted after a " "Please verify your mail address or your account could get deleted after a "
@ -1205,10 +1234,6 @@ msgstr ""
msgid "New Username" msgid "New Username"
msgstr "" msgstr ""
#: src/components/DeleteAccount.jsx:66
msgid "Yes, Delete My Account!"
msgstr ""
#: src/components/ChangePassword.jsx:21 #: src/components/ChangePassword.jsx:21
msgid "Passwords do not match." msgid "Passwords do not match."
msgstr "" msgstr ""
@ -1229,6 +1254,20 @@ msgstr ""
msgid "Confirm New Password" msgid "Confirm New Password"
msgstr "" msgstr ""
#: src/components/ChangeMail.jsx:59
msgid ""
"Changed Mail successfully. We sent you a verification mail, "
"please verify your new mail address."
msgstr ""
#: src/components/ChangeMail.jsx:87
msgid "New Mail"
msgstr ""
#: src/components/DeleteAccount.jsx:66
msgid "Yes, Delete My Account!"
msgstr ""
#: src/components/SocialSettings.jsx:35 #: src/components/SocialSettings.jsx:35
msgid "Block DMs" msgid "Block DMs"
msgstr "" msgstr ""
@ -1253,14 +1292,6 @@ msgstr ""
msgid "You have no users blocked" msgid "You have no users blocked"
msgstr "" msgstr ""
#: src/components/LogInForm.jsx:77
msgid "Name or Email"
msgstr ""
#: src/components/LogInForm.jsx:88
msgid "LogIn"
msgstr ""
#: src/components/ModCanvastools.jsx:168 #: src/components/ModCanvastools.jsx:168
msgid "Build image on canvas." msgid "Build image on canvas."
msgstr "" msgstr ""
@ -1386,16 +1417,6 @@ msgstr ""
msgid "User Name" msgid "User Name"
msgstr "" msgstr ""
#: src/components/ChangeMail.jsx:59
msgid ""
"Changed Mail successfully. We sent you a verification mail, "
"please verify your new mail address."
msgstr ""
#: src/components/ChangeMail.jsx:87
msgid "New Mail"
msgstr ""
#: src/components/ModWatchtools.jsx:48 #: src/components/ModWatchtools.jsx:48
msgid "Interval is invalid" msgid "Interval is invalid"
msgstr "" msgstr ""
@ -1444,26 +1465,6 @@ msgstr ""
msgid "(0 = infinite)" msgid "(0 = infinite)"
msgstr "" msgstr ""
#: src/core/chartSettings.js:30
msgid "Top 10 Countries [pxls / day]"
msgstr ""
#: src/core/chartSettings.js:127
msgid "Players and Pixels per hour"
msgstr ""
#: src/core/chartSettings.js:221
msgid "Top 10 Players [pxls / day]"
msgstr ""
#: src/core/chartSettings.js:294
msgid "Countries by Pixels Today"
msgstr ""
#: src/core/chartSettings.js:351
msgid "Total Pixels placed per day"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:49 #: src/components/contextmenus/UserContextMenu.jsx:49
msgid "Ping" msgid "Ping"
msgstr "" msgstr ""

View File

@ -197,7 +197,7 @@ function Converter() {
> >
{ {
Object.keys(canvases).map((canvas) => ( Object.keys(canvases).map((canvas) => (
(canvases[canvas].v || canvases[canvas].ed (canvases[canvas].v
|| (canvases[canvas].hid && !showHiddenCanvases)) || (canvases[canvas].hid && !showHiddenCanvases))
? null ? null
: ( : (

View File

@ -1,12 +1,8 @@
/* eslint-disable max-len */ /* eslint-disable max-len */
import React, { useCallback } from 'react'; import React from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { t } from 'ttag'; import { t } from 'ttag';
import CanvasItem from '../CanvasItem';
import { selectCanvas } from '../../store/actions';
const imageStyle = { const imageStyle = {
maxWidth: '20%', maxWidth: '20%',
padding: 2, padding: 2,
@ -14,65 +10,34 @@ const imageStyle = {
verticalAlign: 'middle', verticalAlign: 'middle',
}; };
const Archive = () => { const Archive = () => (
const [canvases, online] = useSelector((state) => [ <div className="content">
state.canvas.canvases, <p>
state.ranks.online, {t`While we tend to not delete canvases, some canvases are started for fun or as a request by users who currently like a meme. Those canvases can get boring after a while and after weeks of no major change and if they really aren't worth being kept active.`}<br />
], shallowEqual); {t`Here we collect removed canvases to archive them in a proper way. Which is currently only one.`}
const dispatch = useDispatch(); </p>
const selCanvas = useCallback((canvasId) => dispatch(selectCanvas(canvasId)), <h3>{t`Political Compass Canvas`}</h3>
[dispatch]); <img
style={imageStyle}
return ( alt="political-compass"
<div className="content"> src="https://storage.pixelplanet.fun/compass-preview.png"
<p> />
{t`While we tend to not delete canvases, some canvases are started for fun or as a request by users who currently like a meme. Those canvases can get boring after a while and after weeks of no major change and if they really aren't worth being kept active. And Some other canvases might outlive their welcome and become useless.`}<br /> <p>
{t`Here we collect removed canvases to archive them in a proper way.`} {t`This canvas got requested during a time of political conflicts on the main Earth canvas. It was a 1024x1024 representation of the political compass with a 5s cooldown and 60s stacking. It got launched on May 11th and remained active for months till it got shut down on November 30th.`}<br />
</p> {t`We decided to archive it as a timelapse with lossless encoded webm. Taking a screenshot from the timelapse results in a perfect 1:1 representation of how the canvas was at that time.`}
{ </p>
(window.ssv?.backupurl) && ( <p className="modalinfo">
<> Timelapse:
<h3>{t`Removed Canvases with history available`}</h3> <a href="https://storage.pixelplanet.fun/compass-timelapse.webm">
{ Download
Object.keys(canvases).map((canvasId) => ( </a>
canvases[canvasId].ed </p>
&& ( <img
<CanvasItem style={{ padding: 2, maxWidth: '80%', verticalAlign: 'middle' }}
key={canvasId} alt="political-compass"
online={online[canvasId]} src="https://storage.pixelplanet.fun/compass-final.png"
canvasId={canvasId} />
canvas={canvases[canvasId]} </div>
selCanvas={selCanvas} );
/>
)
))
}
</>
)
}
<h3>{t`Political Compass Canvas`}</h3>
<img
style={imageStyle}
alt="political-compass"
src="https://storage.pixelplanet.fun/compass-preview.png"
/>
<p>
{t`This canvas got requested during a time of political conflicts on the main Earth canvas. It was a 1024x1024 representation of the political compass with a 5s cooldown and 60s stacking. It got launched on May 11th and remained active for months till it got shut down on November 30th.`}<br />
{t`We decided to archive it as a timelapse with lossless encoded webm. Taking a screenshot from the timelapse results in a perfect 1:1 representation of how the canvas was at that time.`}
</p>
<p className="modalinfo">
Timelapse:
<a href="https://storage.pixelplanet.fun/compass-timelapse.webm">
Download
</a>
</p>
<img
style={{ padding: 2, maxWidth: '80%', verticalAlign: 'middle' }}
alt="political-compass"
src="https://storage.pixelplanet.fun/compass-final.png"
/>
</div>
);
};
export default Archive; export default Archive;

View File

@ -28,7 +28,7 @@ const CanvasSelect = () => {
<p> <p>
{t`Select the canvas you want to use. {t`Select the canvas you want to use.
Every canvas is unique and has different palettes, cooldown and requirements. Every canvas is unique and has different palettes, cooldown and requirements.
Archive of closed canvases can be accessed here:`}&nbsp; Archive of removed canvases can be accessed here:`}&nbsp;
<span <span
role="button" role="button"
tabIndex={0} tabIndex={0}
@ -51,6 +51,29 @@ Archive of closed canvases can be accessed here:`}&nbsp;
) )
)) ))
} }
{
(window.ssv?.backupurl
&& Object.keys(canvases).some((i) => canvases[i].ed))
&& (
<>
<h3>{t`Retired Canvases (history only)`}</h3>
{
Object.keys(canvases).map((canvasId) => (
canvases[canvasId].ed
&& (
<CanvasItem
key={canvasId}
online={online[canvasId]}
canvasId={canvasId}
canvas={canvases[canvasId]}
selCanvas={selCanvas}
/>
)
))
}
</>
)
}
</div> </div>
); );
}; };

View File

@ -58,6 +58,20 @@ export default (store) => (next) => (action) => {
} else { } else {
initRenderer(store, is3D); initRenderer(store, is3D);
} }
if (state.canvas.isHistoricalView) {
const {
historicalDate,
historicalTime,
historicalCanvasSize,
} = state.canvas;
renderer.updateHistoricalTime(
historicalDate,
historicalTime,
historicalCanvasSize,
);
}
break; break;
} }

View File

@ -4,6 +4,7 @@ import {
getIdFromObject, getIdFromObject,
getHistoricalCanvasSize, getHistoricalCanvasSize,
getMaxTiledZoom, getMaxTiledZoom,
dateToString,
} from '../../core/utils'; } from '../../core/utils';
@ -45,6 +46,51 @@ export type CanvasState = {
}; };
*/ */
/*
* checks if toggling historical view is neccessary
* in given state or if properties have to change.
* Changes the state inplace.
* @param state
* @return same state with fixed historical view
*/
function fixHistoryIfNeccessary(state, doClamp = true) {
const {
canvasEndDate,
isHistoricalView,
is3D,
} = state;
if (is3D && isHistoricalView) {
state.isHistoricalView = false;
} else if (canvasEndDate && !isHistoricalView) {
state.isHistoricalView = true;
if (!state.historicalDate) {
state.historicalDate = dateToString(canvasEndDate);
state.historicalTime = '0000';
}
}
if (state.isHistoricalView) {
const {
historicalDate,
canvasId,
canvasSize,
canvases,
scale,
viewscale,
} = state;
state.historicalCanvasSize = getHistoricalCanvasSize(
historicalDate,
canvasSize,
canvases[canvasId]?.historicalSizes,
);
if (doClamp && (scale < 0.7 || viewscale < 0.7)) {
state.scale = 0.7;
state.viewscale = 0.7;
}
}
return state;
}
/* /*
* parse url hash and sets view to coordinates * parse url hash and sets view to coordinates
* @param canvases Object with all canvas information * @param canvases Object with all canvas information
@ -74,7 +120,6 @@ function getViewFromURL(canvases) {
size: canvasSize, size: canvasSize,
} = canvas; } = canvas;
const is3D = !!canvas.v; const is3D = !!canvas.v;
const isHistoricalView = !!canvasEndDate;
const x = parseInt(almost[1], 10); const x = parseInt(almost[1], 10);
const y = parseInt(almost[2], 10); const y = parseInt(almost[2], 10);
@ -95,12 +140,12 @@ function getViewFromURL(canvases) {
} }
if (!is3D && canvasId !== null) { if (!is3D && canvasId !== null) {
const minScale = (isHistoricalView) ? 0.7 : TILE_SIZE / canvasSize; const minScale = TILE_SIZE / canvasSize;
scale = clamp(scale, minScale, MAX_SCALE); scale = clamp(scale, minScale, MAX_SCALE);
view.length = 2; view.length = 2;
} }
return { return fixHistoryIfNeccessary({
canvasId, canvasId,
canvasIdent, canvasIdent,
canvasSize, canvasSize,
@ -114,20 +159,21 @@ function getViewFromURL(canvases) {
selectedColor: clrIgnore, selectedColor: clrIgnore,
view, view,
viewscale: scale, viewscale: scale,
isHistoricalView, isHistoricalView: false,
historicalDate: null,
scale, scale,
canvases, canvases,
}; }, canvasId !== null);
} catch (error) { } catch (error) {
const canvasd = canvases[DEFAULT_CANVAS_ID]; const canvasd = canvases[DEFAULT_CANVAS_ID];
return { return fixHistoryIfNeccessary({
canvasId: DEFAULT_CANVAS_ID, canvasId: DEFAULT_CANVAS_ID,
canvasIdent: canvasd.ident, canvasIdent: canvasd.ident,
canvasSize: canvasd.size, canvasSize: canvasd.size,
historicalCanvasSize: canvasd.size, historicalCanvasSize: canvasd.size,
is3D: !!canvasd.v, is3D: !!canvasd.v,
canvasStartDate: null, canvasStartDate: canvasd.sd,
canvasEndDate: null, canvasEndDate: canvasd.ed,
canvasMaxTiledZoom: getMaxTiledZoom(canvasd.size), canvasMaxTiledZoom: getMaxTiledZoom(canvasd.size),
palette: new Palette(canvasd.colors, 0), palette: new Palette(canvasd.colors, 0),
clrIgnore: canvasd.cli || 0, clrIgnore: canvasd.cli || 0,
@ -135,22 +181,21 @@ function getViewFromURL(canvases) {
view: [0, 0, 0], view: [0, 0, 0],
viewscale: DEFAULT_SCALE, viewscale: DEFAULT_SCALE,
isHistoricalView: false, isHistoricalView: false,
historicalDate: null,
scale: DEFAULT_SCALE, scale: DEFAULT_SCALE,
canvases, canvases,
}; });
} }
} }
const initialState = { const initialState = {
...getViewFromURL(DEFAULT_CANVASES), ...getViewFromURL(DEFAULT_CANVASES),
historicalDate: null,
historicalTime: null, historicalTime: null,
showHiddenCanvases: false, showHiddenCanvases: false,
hover: null, hover: null,
prevCanvasCoords: {}, prevCanvasCoords: {},
}; };
export default function canvasReducer( export default function canvasReducer(
state = initialState, state = initialState,
action, action,
@ -203,36 +248,21 @@ export default function canvasReducer(
date, date,
time, time,
} = action; } = action;
const { return fixHistoryIfNeccessary({
canvasSize,
canvases,
canvasId,
} = state;
const historicalCanvasSize = getHistoricalCanvasSize(
date, canvasSize, canvases[canvasId].historicalSizes,
);
return {
...state, ...state,
historicalCanvasSize,
historicalDate: date, historicalDate: date,
historicalTime: time, historicalTime: time,
}; });
} }
case 's/TGL_HISTORICAL_VIEW': { case 's/TGL_HISTORICAL_VIEW': {
const { if (state.is3D || state.canvasEndDate) {
scale, return state;
viewscale, }
} = state; return fixHistoryIfNeccessary({
return {
...state, ...state,
scale: (scale < 0.7) ? 0.7 : scale, isHistoricalView: !state.isHistoricalView,
viewscale: (viewscale < 0.7) ? 0.7 : viewscale, });
isHistoricalView: !state.is3D && (
!state.isHistoricalView || state.canvasEndDate
),
};
} }
case 's/TGL_HIDDEN_CANVASES': { case 's/TGL_HIDDEN_CANVASES': {
@ -289,7 +319,11 @@ export default function canvasReducer(
case 's/SELECT_CANVAS': { case 's/SELECT_CANVAS': {
let { canvasId } = action; let { canvasId } = action;
const { canvases, prevCanvasCoords, canvasId: prevCanvasId } = state; const {
canvases,
prevCanvasCoords,
canvasId: prevCanvasId,
} = state;
let canvas = canvases[canvasId]; let canvas = canvases[canvasId];
if (!canvas) { if (!canvas) {
canvasId = DEFAULT_CANVAS_ID; canvasId = DEFAULT_CANVAS_ID;
@ -315,20 +349,13 @@ export default function canvasReducer(
scale = prevCanvasCoords[canvasId].scale; scale = prevCanvasCoords[canvasId].scale;
selectedColor = prevCanvasCoords[canvasId].selectedColor; selectedColor = prevCanvasCoords[canvasId].selectedColor;
} }
//---
const isHistoricalView = !is3D && (
state.isHistoricalView || !!canvasEndDate
);
const historicalCanvasSize = getHistoricalCanvasSize(
state.historicalDate,
canvasSize,
canvas.historicalSizes,
);
const palette = new Palette(colors, 0); const palette = new Palette(colors, 0);
if (!is3D) { if (!is3D) {
view.length = 2; view.length = 2;
} }
return {
return fixHistoryIfNeccessary({
...state, ...state,
canvasId, canvasId,
canvasIdent, canvasIdent,
@ -342,8 +369,6 @@ export default function canvasReducer(
view, view,
viewscale, viewscale,
scale, scale,
isHistoricalView,
historicalCanvasSize,
// remember view, scale and viewscale // remember view, scale and viewscale
prevCanvasCoords: { prevCanvasCoords: {
...state.prevCanvasCoords, ...state.prevCanvasCoords,
@ -354,12 +379,16 @@ export default function canvasReducer(
selectedColor: state.selectedColor, selectedColor: state.selectedColor,
}, },
}, },
}; });
} }
case 's/REC_ME': { case 's/REC_ME': {
const { canvases } = action; const { canvases } = action;
let { canvasIdent, scale, view } = state; let {
canvasIdent,
scale,
view,
} = state;
let canvasId = getIdFromObject(canvases, canvasIdent); let canvasId = getIdFromObject(canvases, canvasIdent);
if (canvasId === null || ( if (canvasId === null || (
@ -378,29 +407,28 @@ export default function canvasReducer(
colors, colors,
} = canvas; } = canvas;
const palette = new Palette(colors, 0); const palette = new Palette(colors, 0);
const isHistoricalView = !!canvasEndDate;
if (!is3D) { if (!is3D) {
const minScale = (isHistoricalView) ? 0.7 : TILE_SIZE / canvasSize; const minScale = TILE_SIZE / canvasSize;
scale = clamp(scale, minScale, MAX_SCALE); scale = clamp(scale, minScale, MAX_SCALE);
view = [view[0], view[1]]; view = [view[0], view[1]];
} }
return { return fixHistoryIfNeccessary({
...state, ...state,
canvasId, canvasId,
canvasIdent, canvasIdent,
canvasSize, canvasSize,
is3D, is3D,
canvasStartDate, canvasStartDate,
canvasEndDate,
palette, palette,
clrIgnore, clrIgnore,
canvases, canvases,
viewscale: scale, viewscale: scale,
scale, scale,
isHistoricalView,
view, view,
}; });
} }
default: default: