use react portals to move Embeds out of ChatMessages into parent

add barebone for window route
This commit is contained in:
HF 2022-08-12 20:51:17 +02:00
parent cccb49df43
commit ae1e259bab
9 changed files with 353 additions and 261 deletions

View File

@ -28,40 +28,40 @@ msgstr ""
msgid "You don't have access to this channel"
msgstr ""
#: src/core/ChatProvider.js:431
#: src/core/ChatProvider.js:433
msgid "Your mail has to be verified in order to chat"
msgstr ""
#: src/core/ChatProvider.js:436
#: src/core/ChatProvider.js:438
msgid "You are permanently muted, join our guilded to apppeal the mute"
msgstr ""
#: src/core/ChatProvider.js:441
#: src/core/ChatProvider.js:443
#, javascript-format
msgid "You are muted for another ${ timeMin } minutes"
msgstr ""
#: src/core/ChatProvider.js:443
#: src/core/ChatProvider.js:445
msgid "You are muted for another ${ muted } seconds"
msgstr ""
#: src/core/ChatProvider.js:451
#: src/core/ChatProvider.js:453
msgid "Ow no! Spam protection decided to mute you"
msgstr ""
#: src/core/ChatProvider.js:462
#: src/core/ChatProvider.js:464
msgid "You can't send a message this long :("
msgstr ""
#: src/core/ChatProvider.js:466
#: src/core/ChatProvider.js:468
msgid "Please use int channel"
msgstr ""
#: src/core/ChatProvider.js:472
#: src/core/ChatProvider.js:475
msgid "Your country is temporary muted from this chat channel"
msgstr ""
#: src/core/ChatProvider.js:480
#: src/core/ChatProvider.js:483
msgid "Stop flooding."
msgstr ""
@ -236,33 +236,6 @@ msgstr ""
msgid "Submit"
msgstr ""
#: src/routes/api/captcha.js:20
msgid "No captcha text given"
msgstr ""
#: src/routes/api/captcha.js:25
msgid "No captcha id given"
msgstr ""
#: src/routes/api/auth/register.js:54
#: src/routes/api/captcha.js:44
msgid "You took too long, try again."
msgstr ""
#: src/routes/api/auth/register.js:57
#: src/routes/api/captcha.js:50
msgid "You failed your captcha"
msgstr ""
#: src/routes/api/auth/register.js:60
#: src/routes/api/captcha.js:56
msgid "Unknown Captcha Error"
msgstr ""
#: src/routes/api/captcha.js:63
msgid "Server error occured"
msgstr ""
#: src/utils/validation.js:17
msgid "Email can't be empty."
msgstr ""
@ -311,6 +284,33 @@ msgstr ""
msgid "Password must be shorter than 60 characters."
msgstr ""
#: src/routes/api/captcha.js:20
msgid "No captcha text given"
msgstr ""
#: src/routes/api/captcha.js:25
msgid "No captcha id given"
msgstr ""
#: src/routes/api/auth/register.js:54
#: src/routes/api/captcha.js:44
msgid "You took too long, try again."
msgstr ""
#: src/routes/api/auth/register.js:57
#: src/routes/api/captcha.js:50
msgid "You failed your captcha"
msgstr ""
#: src/routes/api/auth/register.js:60
#: src/routes/api/captcha.js:56
msgid "Unknown Captcha Error"
msgstr ""
#: src/routes/api/captcha.js:63
msgid "Server error occured"
msgstr ""
#: src/routes/api/modtools.js:53
msgid "You are not logged in"
msgstr ""

View File

@ -54,113 +54,109 @@ msgstr ""
msgid "Didn't get an answer from pixelplanet. Maybe try to refresh?"
msgstr ""
#: src/ui/placePixel.js:195
#: src/ui/placePixel.js:196
msgid "Invalid Canvas"
msgstr ""
#: src/ui/placePixel.js:196
#: src/ui/placePixel.js:197
msgid "This canvas doesn't exist"
msgstr ""
#: src/ui/placePixel.js:199
#: src/ui/placePixel.js:203
#: src/ui/placePixel.js:207
#: src/ui/placePixel.js:200
#: src/ui/placePixel.js:204
#: src/ui/placePixel.js:208
msgid "Invalid Coordinates"
msgstr ""
#: src/ui/placePixel.js:200
#: src/ui/placePixel.js:201
msgid "x out of bounds"
msgstr ""
#: src/ui/placePixel.js:204
#: src/ui/placePixel.js:205
msgid "y out of bounds"
msgstr ""
#: src/ui/placePixel.js:208
#: src/ui/placePixel.js:209
msgid "z out of bounds"
msgstr ""
#: src/ui/placePixel.js:211
#: src/ui/placePixel.js:212
msgid "Wrong Color"
msgstr ""
#: src/ui/placePixel.js:212
#: src/ui/placePixel.js:213
msgid "Invalid color selected"
msgstr ""
#: src/ui/placePixel.js:215
#: src/ui/placePixel.js:216
msgid "Just for registered Users"
msgstr ""
#: src/ui/placePixel.js:216
#: src/ui/placePixel.js:217
msgid "You have to be logged in to place on this canvas"
msgstr ""
#: src/ui/placePixel.js:219
#: src/ui/placePixel.js:220
msgid "Place more :)"
msgstr ""
#: src/ui/placePixel.js:221
#: src/ui/placePixel.js:222
msgid "You can not access this canvas yet. You need to place more pixels"
msgstr ""
#: src/ui/placePixel.js:224
#: src/ui/placePixel.js:225
msgid "Pixel protected!"
msgstr ""
#: src/ui/placePixel.js:232
#: src/ui/placePixel.js:233
msgid "Please prove that you are human"
msgstr ""
#: src/ui/placePixel.js:236
#: src/ui/placePixel.js:237
msgid "No Proxies Allowed :("
msgstr ""
#: src/ui/placePixel.js:237
#: src/ui/placePixel.js:238
msgid "You are using a Proxy."
msgstr ""
#: src/ui/placePixel.js:240
#: src/ui/placePixel.js:241
msgid "Not allowed"
msgstr ""
#: src/ui/placePixel.js:241
#: src/ui/placePixel.js:242
msgid "Just the Top10 of yesterday can place here"
msgstr ""
#: src/ui/placePixel.js:244
#: src/ui/placePixel.js:245
msgid "You are weird"
msgstr ""
#: src/ui/placePixel.js:246
#: src/ui/placePixel.js:247
msgid "Server got confused by your pixels. Are you playing on multiple devices?"
msgstr ""
#: src/ui/placePixel.js:249
#: src/ui/placePixel.js:250
msgid "Banned"
msgstr ""
#: src/ui/placePixel.js:250
msgid "ban"
msgstr ""
#: src/ui/placePixel.js:253
#: src/ui/placePixel.js:254
msgid "Range Banned"
msgstr ""
#: src/ui/placePixel.js:254
#: src/ui/placePixel.js:255
msgid "Your Internet Provider is banned from playing this game"
msgstr ""
#: src/ui/placePixel.js:257
#: src/ui/placePixel.js:258
msgid "Weird"
msgstr ""
#: src/ui/placePixel.js:258
#: src/ui/placePixel.js:259
msgid "Couldn't set Pixel"
msgstr ""
#: src/ui/placePixel.js:263
#: src/ui/placePixel.js:264
#, javascript-format
msgid "Error ${ retCode }"
msgstr ""
@ -173,28 +169,28 @@ msgstr ""
msgid "Can't render 3D canvas, do you have WebGL2 disabled?"
msgstr ""
#: src/components/BanInfo.jsx:135
#: src/components/BanInfo.jsx:137
#: src/store/actions/index.js:16
msgid "OK"
msgstr ""
#: src/store/actions/index.js:626
#: src/store/actions/index.js:663
msgid "Register New Account"
msgstr ""
#: src/store/actions/index.js:633
#: src/store/actions/index.js:670
msgid "Restore my Password"
msgstr ""
#: src/store/actions/index.js:640
#: src/store/actions/index.js:677
msgid "Welcome to PixelPlanet.fun"
msgstr ""
#: src/store/actions/index.js:646
#: src/store/actions/index.js:683
msgid "Look at past Canvases"
msgstr ""
#: src/components/Converter.jsx:559
#: src/components/Converter.jsx:561
#: src/components/CoordinatesBox.jsx:31
#: src/components/ModWatchtools.jsx:355
msgid "Copy to Clipboard"
@ -225,11 +221,6 @@ msgstr ""
msgid "Restore"
msgstr ""
#: src/components/buttons/CanvasSwitchButton.jsx:22
#: src/components/windows/index.js:19
msgid "Canvas Selection"
msgstr ""
#: src/store/actions/fetch.js:39
msgid "You made too many requests"
msgstr ""
@ -275,6 +266,19 @@ msgstr ""
msgid "Open Menu"
msgstr ""
#: src/components/buttons/CanvasSwitchButton.jsx:22
#: src/components/windows/index.js:19
msgid "Canvas Selection"
msgstr ""
#: src/components/HistorySelect.jsx:144
msgid "Loading"
msgstr ""
#: src/components/HistorySelect.jsx:145
msgid "Select Date above"
msgstr ""
#: src/components/Window.jsx:118
msgid "Clone"
msgstr ""
@ -291,12 +295,16 @@ msgstr ""
msgid "Resize"
msgstr ""
#: src/components/HistorySelect.jsx:143
msgid "Loading"
#: src/components/buttons/GlobeButton.jsx:34
msgid "Globe View"
msgstr ""
#: src/components/HistorySelect.jsx:144
msgid "Select Date above"
#: src/components/buttons/PalselButton.jsx:30
msgid "Close Palette"
msgstr ""
#: src/components/buttons/PalselButton.jsx:30
msgid "Open Palette"
msgstr ""
#: src/components/BanInfo.jsx:76
@ -319,18 +327,6 @@ msgstr ""
msgid "Make Screenshot"
msgstr ""
#: src/components/buttons/GlobeButton.jsx:34
msgid "Globe View"
msgstr ""
#: src/components/buttons/PalselButton.jsx:30
msgid "Close Palette"
msgstr ""
#: src/components/buttons/PalselButton.jsx:30
msgid "Open Palette"
msgstr ""
#: src/components/windows/index.js:16
msgid "Registration"
msgstr ""
@ -347,6 +343,14 @@ msgstr ""
msgid "Canvas Archive"
msgstr ""
#: src/components/BanInfo.jsx:67
msgid "You are banned. You think it is unjustifed? Check out the "
msgstr ""
#: src/components/BanInfo.jsx:77
msgid " on how to appeal."
msgstr ""
#: src/components/BanInfo.jsx:81
#: src/components/Captcha.jsx:77
#: src/components/ChangeMail.jsx:72
@ -360,28 +364,6 @@ msgstr ""
msgid "Error"
msgstr ""
#: src/components/ChangeMail.jsx:93
#: src/components/ChangeName.jsx:70
#: src/components/ChangePassword.jsx:115
#: src/components/DeleteAccount.jsx:68
#: src/components/GlobalCaptcha.jsx:48
#: src/components/windows/ForgotPassword.jsx:88
#: src/components/windows/Register.jsx:130
msgid "Cancel"
msgstr ""
#: src/components/GlobalCaptcha.jsx:55
msgid "Send"
msgstr ""
#: src/components/BanInfo.jsx:67
msgid "You are banned. You think it is unjustifed? Check out the "
msgstr ""
#: src/components/BanInfo.jsx:77
msgid " on how to appeal."
msgstr ""
#: src/components/BanInfo.jsx:86
#: src/components/ModIIDtools.jsx:72
msgid "Reason"
@ -412,10 +394,40 @@ msgstr ""
msgid "Now that you have seen this message, you are no longer banned."
msgstr ""
#: src/components/BanInfo.jsx:125
#: src/components/BanInfo.jsx:128
msgid "Why?"
msgstr ""
#: src/components/ChangeMail.jsx:93
#: src/components/ChangeName.jsx:70
#: src/components/ChangePassword.jsx:115
#: src/components/DeleteAccount.jsx:68
#: src/components/GlobalCaptcha.jsx:47
#: src/components/windows/ForgotPassword.jsx:88
#: src/components/windows/Register.jsx:130
msgid "Cancel"
msgstr ""
#: src/components/GlobalCaptcha.jsx:53
msgid "Send"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:56
msgid "Ping"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:83
msgid "DM"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:93
msgid "Block"
msgstr ""
#: src/components/contextmenus/ChannelContextMenu.jsx:54
msgid "Mute"
msgstr ""
#: src/components/windows/Help.jsx:42
msgid "Place color pixels on a large canvas with other players online!"
msgstr ""
@ -653,7 +665,7 @@ msgstr ""
msgid "For when you are playing on a potato."
msgstr ""
#: src/components/Converter.jsx:374
#: src/components/Converter.jsx:376
#: src/components/windows/Settings.jsx:196
msgid "Light Grid"
msgstr ""
@ -682,27 +694,28 @@ msgstr ""
msgid "Select Language"
msgstr ""
#: src/components/windows/UserArea.jsx:36
#: src/components/windows/UserArea.jsx:29
#: src/components/windows/UserArea.jsx:48
msgid "Profile"
msgstr ""
#: src/components/windows/UserArea.jsx:39
#: src/components/windows/UserArea.jsx:51
msgid "Ranking"
msgstr ""
#: src/components/windows/UserArea.jsx:42
#: src/components/windows/UserArea.jsx:54
msgid "Converter"
msgstr ""
#: src/components/windows/UserArea.jsx:48
#: src/components/windows/UserArea.jsx:60
msgid "Modtools"
msgstr ""
#: src/components/windows/UserArea.jsx:49
#: src/components/windows/UserArea.jsx:61
msgid "Loading..."
msgstr ""
#: src/components/windows/UserArea.jsx:56
#: src/components/windows/UserArea.jsx:68
msgid "Consider joining us on Guilded:"
msgstr ""
@ -740,10 +753,10 @@ msgstr ""
#: src/components/Admintools.jsx:152
#: src/components/Admintools.jsx:236
#: src/components/ModCanvastools.jsx:313
#: src/components/ModCanvastools.jsx:394
#: src/components/ModCanvastools.jsx:469
#: src/components/ModCanvastools.jsx:561
#: src/components/ModCanvastools.jsx:314
#: src/components/ModCanvastools.jsx:396
#: src/components/ModCanvastools.jsx:471
#: src/components/ModCanvastools.jsx:564
#: src/components/ModIIDtools.jsx:134
#: src/components/windows/ForgotPassword.jsx:86
#: src/components/windows/Register.jsx:124
@ -794,19 +807,19 @@ msgid ""
"how the canvas was at that time."
msgstr ""
#: src/components/windows/Chat.jsx:134
#: src/components/windows/Chat.jsx:146
msgid "Channel settings"
msgstr ""
#: src/components/windows/Chat.jsx:151
#: src/components/windows/Chat.jsx:163
msgid "Start chatting here"
msgstr ""
#: src/components/windows/Chat.jsx:193
#: src/components/windows/Chat.jsx:203
msgid "Chat here"
msgstr ""
#: src/components/windows/Chat.jsx:215
#: src/components/windows/Chat.jsx:225
msgid "You must be logged in to chat"
msgstr ""
@ -818,22 +831,6 @@ msgstr ""
msgid "Enter your mail address and we will send you a new password:"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:56
msgid "Ping"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:81
msgid "DM"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:91
msgid "Block"
msgstr ""
#: src/components/contextmenus/ChannelContextMenu.jsx:54
msgid "Mute"
msgstr ""
#: src/components/Captcha.jsx:50
#: src/components/Captcha.jsx:105
msgid "Could not load captcha"
@ -999,15 +996,15 @@ msgstr ""
msgid "Social Settings"
msgstr ""
#: src/components/Rankings.jsx:27
#: src/components/Rankings.jsx:31
msgid "Total"
msgstr ""
#: src/components/Rankings.jsx:35
#: src/components/Rankings.jsx:40
msgid "Daily"
msgstr ""
#: src/components/Rankings.jsx:39
#: src/components/Rankings.jsx:85
msgid "Ranking updates every 5 min. Daily rankings get reset at midnight UTC."
msgstr ""
@ -1037,56 +1034,56 @@ msgstr ""
msgid "Choose Strategy"
msgstr ""
#: src/components/Converter.jsx:293
#: src/components/Converter.jsx:294
msgid "Serpentine"
msgstr ""
#: src/components/Converter.jsx:295
#: src/components/Converter.jsx:296
msgid "Minimum Color Distance"
msgstr ""
#: src/components/Converter.jsx:322
#: src/components/Converter.jsx:323
msgid "Calculate like GIMP"
msgstr ""
#: src/components/Converter.jsx:326
#: src/components/Converter.jsx:327
msgid "Choose Color Mode"
msgstr ""
#: src/components/Converter.jsx:354
#: src/components/Converter.jsx:356
msgid "Add Grid (uncheck if you need a 1:1 template)"
msgstr ""
#: src/components/Converter.jsx:376
#: src/components/Converter.jsx:392
#: src/components/Converter.jsx:378
#: src/components/Converter.jsx:394
msgid "Offset"
msgstr ""
#: src/components/Converter.jsx:421
#: src/components/Converter.jsx:423
msgid "Scale Image"
msgstr ""
#: src/components/Converter.jsx:432
#: src/components/Converter.jsx:434
msgid "Width"
msgstr ""
#: src/components/Converter.jsx:463
#: src/components/Converter.jsx:465
msgid "Height"
msgstr ""
#: src/components/Converter.jsx:502
#: src/components/Converter.jsx:504
msgid "Keep Ratio"
msgstr ""
#: src/components/Converter.jsx:515
#: src/components/Converter.jsx:517
msgid "Anti Aliasing"
msgstr ""
#: src/components/Converter.jsx:529
#: src/components/Converter.jsx:531
msgid "Reset"
msgstr ""
#: src/components/Converter.jsx:547
#: src/components/Converter.jsx:549
msgid "Download Template"
msgstr ""
@ -1143,6 +1140,70 @@ msgstr ""
msgid "LogIn"
msgstr ""
#: src/components/ChangePassword.jsx:21
msgid "Passwords do not match."
msgstr ""
#: src/components/ChangePassword.jsx:44
msgid "Changed Password successfully."
msgstr ""
#: src/components/ChangePassword.jsx:88
msgid "Old Password"
msgstr ""
#: src/components/ChangePassword.jsx:96
msgid "New Password"
msgstr ""
#: src/components/ChangePassword.jsx:103
msgid "Confirm New Password"
msgstr ""
#: src/components/UserMessages.jsx:28
msgid ""
"Please verify your mail address or your account could get deleted after a "
"few days."
msgstr ""
#: src/components/UserMessages.jsx:49
msgid "A new verification mail is getting sent to you."
msgstr ""
#: src/components/UserMessages.jsx:53
msgid "Click here to request a new verification mail."
msgstr ""
#: src/components/ChangeName.jsx:64
msgid "New Username"
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:37
msgid "Block all Private Messages"
msgstr ""
#: src/components/SocialSettings.jsx:55
msgid "Unblock Users"
msgstr ""
#: src/components/SocialSettings.jsx:80
msgid "You have no users blocked"
msgstr ""
#: src/components/ModCanvastools.jsx:174
msgid "Build image on canvas."
msgstr ""
@ -1188,51 +1249,51 @@ msgstr ""
msgid "File"
msgstr ""
#: src/components/ModCanvastools.jsx:278
#: src/components/ModCanvastools.jsx:279
msgid "Coordinates in X_Y format:"
msgstr ""
#: src/components/ModCanvastools.jsx:318
#: src/components/ModCanvastools.jsx:319
msgid "Pixel Protection"
msgstr ""
#: src/components/ModCanvastools.jsx:320
#: src/components/ModCanvastools.jsx:321
msgid ""
"Set protection of areas (if you need finer grained control, "
"use protect with image upload and alpha layers)"
msgstr ""
#: src/components/ModCanvastools.jsx:340
#: src/components/ModCanvastools.jsx:415
#: src/components/ModCanvastools.jsx:499
#: src/components/ModCanvastools.jsx:342
#: src/components/ModCanvastools.jsx:417
#: src/components/ModCanvastools.jsx:502
#: src/components/ModWatchtools.jsx:168
msgid "Top-left corner"
msgstr ""
#: src/components/ModCanvastools.jsx:358
#: src/components/ModCanvastools.jsx:433
#: src/components/ModCanvastools.jsx:517
#: src/components/ModCanvastools.jsx:360
#: src/components/ModCanvastools.jsx:435
#: src/components/ModCanvastools.jsx:520
#: src/components/ModWatchtools.jsx:186
msgid "Bottom-right corner"
msgstr ""
#: src/components/ModCanvastools.jsx:400
#: src/components/ModCanvastools.jsx:402
msgid "Rollback to Date"
msgstr ""
#: src/components/ModCanvastools.jsx:402
#: src/components/ModCanvastools.jsx:404
msgid "Rollback an area of the canvas to a set date (00:00 UTC)"
msgstr ""
#: src/components/ModCanvastools.jsx:475
#: src/components/ModCanvastools.jsx:477
msgid "Canvas Cleaner"
msgstr ""
#: src/components/ModCanvastools.jsx:477
#: src/components/ModCanvastools.jsx:479
msgid "Apply a filter to clean trash in large canvas areas."
msgstr ""
#: src/components/ModCanvastools.jsx:579
#: src/components/ModCanvastools.jsx:582
msgid "Stop Cleaner"
msgstr ""
@ -1268,23 +1329,6 @@ msgstr ""
msgid "User Name"
msgstr ""
#: src/components/ModIIDtools.jsx:19
#: src/components/ModIIDtools.jsx:23
msgid "You must enter an IID"
msgstr ""
#: src/components/ModIIDtools.jsx:52
msgid "IID Actions"
msgstr ""
#: src/components/ModIIDtools.jsx:79
msgid "Enter Reason"
msgstr ""
#: src/components/ModIIDtools.jsx:96
msgid "(0 = infinite)"
msgstr ""
#: src/components/ModWatchtools.jsx:45
msgid "Interval is invalid"
msgstr ""
@ -1313,68 +1357,24 @@ msgstr ""
msgid "Get Users"
msgstr ""
#: src/components/UserMessages.jsx:28
msgid ""
"Please verify your mail address or your account could get deleted after a "
"few days."
#: src/components/ModIIDtools.jsx:19
msgid "You must enter a duration"
msgstr ""
#: src/components/UserMessages.jsx:49
msgid "A new verification mail is getting sent to you."
#: src/components/ModIIDtools.jsx:23
msgid "You must enter an IID"
msgstr ""
#: src/components/UserMessages.jsx:53
msgid "Click here to request a new verification mail."
#: src/components/ModIIDtools.jsx:52
msgid "IID Actions"
msgstr ""
#: src/components/ChangeName.jsx:64
msgid "New Username"
#: src/components/ModIIDtools.jsx:79
msgid "Enter Reason"
msgstr ""
#: src/components/ChangePassword.jsx:21
msgid "Passwords do not match."
msgstr ""
#: src/components/ChangePassword.jsx:44
msgid "Changed Password successfully."
msgstr ""
#: src/components/ChangePassword.jsx:88
msgid "Old Password"
msgstr ""
#: src/components/ChangePassword.jsx:96
msgid "New Password"
msgstr ""
#: src/components/ChangePassword.jsx:103
msgid "Confirm New Password"
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:37
msgid "Block all Private Messages"
msgstr ""
#: src/components/SocialSettings.jsx:55
msgid "Unblock Users"
msgstr ""
#: src/components/SocialSettings.jsx:79
msgid "You have no users blocked"
#: src/components/ModIIDtools.jsx:96
msgid "(0 = infinite)"
msgstr ""
#: src/components/windows/Help.jsx:15

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useRef } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { showContextMenu } from '../store/actions';
@ -23,6 +23,7 @@ function ChatMessage({
const isDarkMode = useSelector(
(state) => state.gui.style.indexOf('dark') !== -1,
);
const refEmbed = useRef(null);
const isInfo = (name === 'info');
const isEvent = (name === 'event');
@ -43,7 +44,7 @@ function ChatMessage({
<li className="chatmsg">
{(!isInfo && !isEvent)
&& (
<div className="chathead">
<div className="chathead" key="ch">
<span className="chatname">
<img
alt=""
@ -82,9 +83,10 @@ function ChatMessage({
</span>
</div>
)}
<div className={className}>
<MarkdownParagraph pArray={pArray} />
<div className={className} key="cm">
<MarkdownParagraph refEmbed={refEmbed} pArray={pArray} />
</div>
<div className="chatembed" ref={refEmbed} key="ce" />
</li>
);
}

View File

@ -7,7 +7,7 @@ import MdLink from './MdLink';
import MdMention from './MdMention';
// eslint-disable-next-line max-len
export const MarkdownParagraph = React.memo(({ pArray }) => pArray.map((part) => {
export const MarkdownParagraph = React.memo(({ pArray, refEmbed }) => pArray.map((part) => {
if (!Array.isArray(part)) {
return part;
}
@ -42,7 +42,7 @@ export const MarkdownParagraph = React.memo(({ pArray }) => pArray.map((part) =>
case 'img':
case 'l': {
return (
<MdLink href={part[2]} title={part[1]} />
<MdLink refEmbed={refEmbed} href={part[2]} title={part[1]} />
);
}
case '@': {

View File

@ -4,6 +4,7 @@
* Links are assumed to start with protocol (http:// etc.)
*/
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
import { HiArrowsExpand, HiStop } from 'react-icons/hi';
import { getLinkDesc } from '../core/utils';
@ -18,7 +19,7 @@ const titleAllowed = [
't.me',
];
const MdLink = ({ href, title }) => {
const MdLink = ({ href, title, refEmbed }) => {
const [showEmbed, setShowEmbed] = useState(false);
const desc = getLinkDesc(href);
@ -87,7 +88,15 @@ const MdLink = ({ href, title }) => {
</span>
</>
)}
{(showEmbed && embedAvailable) && <Embed url={href} />}
{showEmbed && embedAvailable && (
(refEmbed)
? ReactDOM.createPortal(
<Embed url={href} />,
refEmbed.current,
) : (
<Embed url={href} />
)
)}
</>
);
};

View File

@ -19,6 +19,7 @@ import api from './api';
import assets from './assets.json'; // eslint-disable-line import/no-unresolved
import { expressTTag } from '../core/ttag';
import generateGlobePage from '../ssr/Globe';
import generateWinPage from '../ssr/Win';
import generateMainPage from '../ssr/Main';
import { MONTH } from '../core/constants';
@ -105,7 +106,7 @@ const globeEtag = etag(
assets.globe.js.join('_'),
{ weak: true },
);
router.get('/globe', async (req, res) => {
router.get('/globe', (req, res) => {
res.set({
'Cache-Control': `private, max-age=${15 * 60}`, // seconds
'Content-Type': 'text/html; charset=utf-8',
@ -120,6 +121,28 @@ router.get('/globe', async (req, res) => {
res.status(200).send(generateGlobePage(req.lang));
});
//
// Windows (like chat pop-up etc.)
// -----------------------------------------------------------------------------
const winEtag = etag(
assets.win.js,
{ weak: true },
);
router.get('/win', async (req, res) => {
res.set({
'Cache-Control': `private, max-age=${15 * 60}`, // seconds
'Content-Type': 'text/html; charset=utf-8',
ETag: globeEtag,
});
if (req.headers['if-none-match'] === winEtag) {
res.status(304).end();
return;
}
res.status(200).send(generateWinPage(req.lang));
});
//
// Main Page (react generated)
// -----------------------------------------------------------------------------
@ -128,7 +151,7 @@ const indexEtag = etag(
{ weak: true },
);
router.get('/', async (req, res) => {
router.get('/', (req, res) => {
res.set({
'Cache-Control': `private, max-age=${15 * 60}`, // seconds
'Content-Type': 'text/html; charset=utf-8',

51
src/ssr/Win.jsx Normal file
View File

@ -0,0 +1,51 @@
/*
* create html for Window page
*
*/
/* eslint-disable max-len */
import { getTTag } from '../core/ttag';
/* this will be set by webpack */
// eslint-disable-next-line import/no-unresolved
import assets from './assets.json';
import { ASSET_SERVER } from '../core/config';
/*
* generates string with html of globe page
* @param lang language code
* @return html of mainpage
*/
function generateWinPage(lang) {
const script = (assets[`win-${lang}`])
? assets[`win-${lang}`].js
: assets.win.js;
const { t } = getTTag(lang);
const html = `
<!doctype html>
<html lang="${lang}">
<head>
<meta charset="UTF-8" />
<title>${t`PixelPlanet.Fun Window`}</title>
<meta name="description" content="${t`PixelPlanet.Fun Windows`}" />
<meta name="google" content="nopagereadaloud" />
<meta name="theme-color" content="#cae3ff" />
<meta name="viewport"
content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"
/>
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="apple-touch-icon.png" />
</head>
<body>
<script src="${ASSET_SERVER + script}"></script>
</body>
</html>
`;
return html;
}
export default generateWinPage;

5
src/win.js Normal file
View File

@ -0,0 +1,5 @@
/*
* Main Script for windows (pop-ups and stuff)
*/
console.log('hello');

View File

@ -64,6 +64,8 @@ export function buildWebpackClientConfig(
[path.resolve(__dirname, 'src', 'client.js')],
[(locale !== 'default') ? `globe-${locale}` : 'globe']:
[path.resolve(__dirname, 'src', 'globe.js')],
[(locale !== 'default') ? `win-${locale}` : 'win']:
[path.resolve(__dirname, 'src', 'win.js')],
},
output: {