Merge pull request #4 from Re-Ignited-Development/feature/twitter
[feature] twitter
No files matched your search
@@ -27,5 +27,6 @@ files {
|
||||
'resources/html/*.js',
|
||||
'resources/html/media/frames/*.png',
|
||||
'resources/html/media/backgrounds/*.png',
|
||||
'resources/html/media/backgrounds/*.jpg'
|
||||
'resources/html/media/backgrounds/*.jpg',
|
||||
'resources/html/media/twitter/*'
|
||||
}
|
||||
@@ -6,10 +6,12 @@
|
||||
"@babel/polyfill": "^7.4.4",
|
||||
"@material-ui/core": "^4.11.0",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "^4.0.0-alpha.56",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.5.0",
|
||||
"@testing-library/user-event": "^7.2.1",
|
||||
"core-js": "^3.6.5",
|
||||
"emoji-mart": "^3.0.0",
|
||||
"husky": "^4.2.5",
|
||||
"i18next": "^19.7.0",
|
||||
"prettier": "^2.0.5",
|
||||
@@ -20,7 +22,8 @@
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "3.4.3",
|
||||
"recoil": "^0.0.10",
|
||||
"styled-components": "^5.1.1"
|
||||
"styled-components": "^5.1.1",
|
||||
"uuid": "^8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.4.4",
|
||||
|
||||
@@ -17,6 +17,7 @@ import { usePhoneService } from "./os/phone/hooks/usePhoneService";
|
||||
import { useApps } from "./os/apps/hooks/useApps";
|
||||
|
||||
import { useContactsService } from "./apps/contacts/hooks/useContactsService";
|
||||
import { useTwitterService } from "./apps/twitter/hooks/useTwitterService";
|
||||
|
||||
//These events are just for testing. Comment it out before building.
|
||||
setTimeout(() => {
|
||||
@@ -73,6 +74,7 @@ function Phone() {
|
||||
const { allApps } = useApps();
|
||||
useSimcardService();
|
||||
useContactsService();
|
||||
useTwitterService();
|
||||
useInitKeyboard();
|
||||
|
||||
if (visibility === false) {
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Button } from "@material-ui/core";
|
||||
import CloseIcon from "@material-ui/icons/Close";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import Modal from "../../../ui/components/Modal";
|
||||
import { IMAGE_DELIMITER } from "../utils/images";
|
||||
import { withValidImage } from "../utils/images";
|
||||
import { useModal } from "../hooks/useModal";
|
||||
import EmojiSelect from "./EmojiSelect";
|
||||
import ImageDisplay from "./images/ImageDisplay";
|
||||
import ImagePrompt from "./images/ImagePrompt";
|
||||
import TweetMessage from "./tweet/TweetMessage";
|
||||
import ControlButtons from "./buttons/ControlButtons";
|
||||
import IconButtons from "./buttons/IconButtons";
|
||||
import { usePhone } from "../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
zIndex: 10,
|
||||
background: "#424242",
|
||||
marginTop: "15px",
|
||||
width: "90%",
|
||||
display: "flex",
|
||||
flexFlow: "column nowrap",
|
||||
position: "absolute",
|
||||
top: "80px",
|
||||
},
|
||||
button: {
|
||||
margin: 5,
|
||||
marginTop: 20,
|
||||
},
|
||||
close: {
|
||||
position: "absolute",
|
||||
top: "12px",
|
||||
right: "4px",
|
||||
zIndex: 2,
|
||||
},
|
||||
buttonsContainer: {
|
||||
paddingBottom: "8px",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "space-between",
|
||||
flex: "1 0 45px",
|
||||
},
|
||||
emojiPicker: {
|
||||
background: "none",
|
||||
border: "none",
|
||||
boxShadow: "none",
|
||||
},
|
||||
}));
|
||||
|
||||
export const AddTweetModal = () => {
|
||||
const classes = useStyles();
|
||||
const { message, setMessage, modalVisible, setModalVisible } = useModal();
|
||||
const { config } = usePhone();
|
||||
|
||||
const [showEmoji, setShowEmoji] = useState(false);
|
||||
const [showImagePrompt, setShowImagePrompt] = useState(false);
|
||||
const [link, setLink] = useState("");
|
||||
|
||||
const [images, setImages] = useState([]);
|
||||
|
||||
const reset = () => {
|
||||
setShowImagePrompt(null);
|
||||
setShowEmoji(false);
|
||||
|
||||
setLink("");
|
||||
setImages([]);
|
||||
setMessage("");
|
||||
};
|
||||
|
||||
const _handleClose = () => {
|
||||
reset();
|
||||
setModalVisible(false);
|
||||
};
|
||||
|
||||
// when the user presses escape we should close the modal
|
||||
const _handleEscape = (e) => {
|
||||
const isEscapeKey = e.key == "Escape" || e.key == "Esc";
|
||||
if (isEscapeKey) {
|
||||
e.preventDefault();
|
||||
_handleClose();
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
const listener = window.addEventListener("keydown", _handleEscape, true);
|
||||
return () => window.removeEventListener("keydown", listener);
|
||||
}, []);
|
||||
|
||||
const submitTweet = () => {
|
||||
const cleanedMessage = message.trim();
|
||||
if (cleanedMessage.length === 0) return;
|
||||
if (cleanedMessage.length > config.twitter.characterLimit) return;
|
||||
|
||||
const data = {
|
||||
message,
|
||||
images:
|
||||
images && images.length > 0
|
||||
? images.map((image) => image.link).join(IMAGE_DELIMITER)
|
||||
: "",
|
||||
realUser: "testUser",
|
||||
};
|
||||
Nui.send("phone:createTweet", data);
|
||||
_handleClose();
|
||||
};
|
||||
|
||||
const handleMessageChange = (e) => setMessage(e.target.value);
|
||||
|
||||
const addImage = () => {
|
||||
// strip any whitespace from the link in case the user
|
||||
// added some spaces/returns accidentally
|
||||
const cleanedLink = link.replace("/ /g", "");
|
||||
// because we're only storing strings in the database we need
|
||||
// to give this an arbirtrary (but unique) id so that we can
|
||||
// correctly filter an array of images when the user wants to
|
||||
// delete them. This handles an edge case where the user adds
|
||||
// two of the same image.
|
||||
const image = { id: uuidv4(), link: cleanedLink };
|
||||
// it's worth noting that we only perform this validation on
|
||||
// the client of the user who is submitting the image. When
|
||||
// other users see this image on their TweetList it will be
|
||||
// from the database and should already have passed through
|
||||
// this logic
|
||||
withValidImage(cleanedLink, () => setImages([...images, image]));
|
||||
|
||||
setShowImagePrompt(false);
|
||||
setLink('')
|
||||
};
|
||||
const removeImage = (id) =>
|
||||
setImages(images.filter((image) => id !== image.id));
|
||||
const handleimageChange = (e) => setLink(e.target.value);
|
||||
|
||||
const toggleShowImagePrompt = () => {
|
||||
setShowEmoji(false); // clear the emoji so we can switch between emoji/images
|
||||
setShowImagePrompt(!showImagePrompt);
|
||||
};
|
||||
const toggleShowEmoji = () => {
|
||||
// clear the images so we can seemlessly toggle between emoji/images
|
||||
setShowImagePrompt(false);
|
||||
setImages("");
|
||||
setShowEmoji(!showEmoji);
|
||||
};
|
||||
|
||||
// this is when a user clicks on an emoji icon itself (i.e. a smiley face)
|
||||
// not the emoji icon on the UI
|
||||
const handleSelectEmoji = (emojiObject, e) => {
|
||||
setMessage(message.concat(emojiObject.native));
|
||||
};
|
||||
|
||||
if (!config) return null;
|
||||
|
||||
return (
|
||||
<Modal visible={modalVisible} handleClose={_handleClose}>
|
||||
<Button className={classes.close} onClick={_handleClose}>
|
||||
<CloseIcon color="action" />
|
||||
</Button>
|
||||
<TweetMessage message={message} handleChange={handleMessageChange} />
|
||||
<ImagePrompt
|
||||
visible={showImagePrompt}
|
||||
value={link}
|
||||
handleChange={handleimageChange}
|
||||
/>
|
||||
<EmojiSelect visible={showEmoji} onEmojiClick={handleSelectEmoji} />
|
||||
<ImageDisplay
|
||||
visible={!showEmoji && images.length > 0}
|
||||
images={images}
|
||||
removeImage={removeImage}
|
||||
/>
|
||||
<div className={classes.buttonsContainer}>
|
||||
<IconButtons
|
||||
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
|
||||
onEmojiClick={toggleShowEmoji}
|
||||
/>
|
||||
<ControlButtons
|
||||
showImagePrompt={showImagePrompt}
|
||||
showEmoji={showEmoji}
|
||||
onPrimaryClick={showImagePrompt ? addImage : submitTweet}
|
||||
onCloseClick={showEmoji ? toggleShowEmoji : toggleShowImagePrompt}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default AddTweetModal;
|
||||
@@ -0,0 +1,56 @@
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
|
||||
import { usePhone } from "../../../os/phone/hooks/usePhone";
|
||||
import { IMG_DEFAULT_AVATAR, IMG_INVALID_AVATAR } from "../utils/constants";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
width: "100%",
|
||||
},
|
||||
img: {
|
||||
borderRadius: "50%",
|
||||
objectFit: "cover",
|
||||
},
|
||||
});
|
||||
|
||||
function Avatar({ avatarUrl, showInvalidImage, height, width }) {
|
||||
const classes = useStyles();
|
||||
const [showImageError, setShowImageError] = useState(false);
|
||||
const { config } = usePhone();
|
||||
|
||||
const handleImageError = () => setShowImageError(true);
|
||||
const handleImageLoad = () => setShowImageError(false);
|
||||
|
||||
if (!config || !config.twitter.enableAvatars) return null;
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
{showImageError && (
|
||||
<img
|
||||
className={classes.img}
|
||||
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
|
||||
alt="Invalid avatar image"
|
||||
style={{ height, width }}
|
||||
/>
|
||||
)}
|
||||
<img
|
||||
className={classes.img}
|
||||
src={avatarUrl || IMG_DEFAULT_AVATAR}
|
||||
alt="Your profile avatar"
|
||||
onError={handleImageError}
|
||||
onLoad={handleImageLoad}
|
||||
style={{ display: showImageError ? "none" : "block", height, width }}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Avatar.defaultProps = {
|
||||
avatarUrl: null,
|
||||
showInvalidImage: false,
|
||||
height: "125px",
|
||||
width: "125px",
|
||||
};
|
||||
|
||||
export default Avatar;
|
||||
@@ -0,0 +1,43 @@
|
||||
import React from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { BottomNavigation, BottomNavigationAction } from "@material-ui/core";
|
||||
import HomeIcon from "@material-ui/icons/Home";
|
||||
import SearchIcon from "@material-ui/icons/Search";
|
||||
import ProfileIcon from "@material-ui/icons/Person";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
width: "100%",
|
||||
},
|
||||
});
|
||||
|
||||
export function TwitterBottomNavigation({ activePage, handleChange }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<BottomNavigation
|
||||
value={activePage}
|
||||
onChange={handleChange}
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to="/twitter"
|
||||
icon={<HomeIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to="/twitter/search"
|
||||
icon={<SearchIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
to="/twitter/profile"
|
||||
icon={<ProfileIcon />}
|
||||
/>
|
||||
</BottomNavigation>
|
||||
);
|
||||
}
|
||||
|
||||
export default TwitterBottomNavigation;
|
||||
@@ -0,0 +1,17 @@
|
||||
import React, { memo } from "react";
|
||||
import { Picker } from "emoji-mart";
|
||||
|
||||
export const EmojiSelect = ({ visible, onEmojiClick }) => {
|
||||
if (!visible) return null;
|
||||
|
||||
return (
|
||||
<Picker
|
||||
onClick={onEmojiClick}
|
||||
set="google"
|
||||
theme="dark"
|
||||
showPreview={false}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default memo(EmojiSelect); // The picker is an expensive render
|
||||
@@ -0,0 +1,96 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Switch, Route } from "react-router-dom";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import { AppWrapper } from "../../../ui/components";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import TweetListContainer from "./tweet/TweetListContainer";
|
||||
import AddTweetModal from "./AddTweetModal";
|
||||
import { useModal } from "../hooks/useModal";
|
||||
import TweetButton from "./buttons/TweetButton";
|
||||
import TwitterTitle from "./TwitterTitle";
|
||||
import BottomNavigation from "./BottomNavigation";
|
||||
import TwitterProfile from "./profile/Profile";
|
||||
import AlertBar from "./alerts/AlertBar";
|
||||
import TwitterSearch from "./TwitterSearch";
|
||||
|
||||
import "./twitter.css";
|
||||
import "emoji-mart/css/emoji-mart.css";
|
||||
import { useProfile } from "../hooks/useProfile";
|
||||
import ProfilePrompt from "./profile/ProfilePrompt";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
backgroundModal: {
|
||||
background: "black",
|
||||
opacity: "0.6",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
zIndex: 5,
|
||||
},
|
||||
}));
|
||||
|
||||
const TWEETS_REFRESH_RATE = 15000; // TODO move this to twitter config
|
||||
|
||||
export const TwitterApp = () => {
|
||||
const classes = useStyles();
|
||||
const { modalVisible, setModalVisible } = useModal();
|
||||
const [activePage, setActivePage] = useState(0);
|
||||
const { profile } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
Nui.send("phone:getOrCreateTwitterProfile", {});
|
||||
Nui.send("phone:fetchTweets", {});
|
||||
|
||||
// this is a polling implementation. It is possible that
|
||||
// there is some interaction where, on a new tweet, all
|
||||
// clients are sent the updated query data. Until that can
|
||||
// be accomplished this is naive but robust.
|
||||
//
|
||||
// TODO don't call fetchTweets - implement a function that only
|
||||
// returns tweets that we don't already have
|
||||
const timeout = window.setTimeout(() => {
|
||||
Nui.send("phone:fetchTweets", {});
|
||||
}, TWEETS_REFRESH_RATE);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, []);
|
||||
|
||||
// before any other action can be taken by the user we force
|
||||
// them have a profile name
|
||||
const promptProfileName =
|
||||
profile && (!profile.profile_name || !profile.profile_name.trim());
|
||||
|
||||
const openModal = () => setModalVisible(true);
|
||||
const handlePageChange = (e, page) => setActivePage(page);
|
||||
const showTweetButton = !promptProfileName && activePage === 0;
|
||||
|
||||
return (
|
||||
<AppWrapper id="twitter-app">
|
||||
<AddTweetModal />
|
||||
<div className={modalVisible ? classes.backgroundModal : null} />
|
||||
<TwitterTitle />
|
||||
<AppContent>
|
||||
{promptProfileName ? (
|
||||
<ProfilePrompt />
|
||||
) : (
|
||||
<Switch>
|
||||
<Route path="/twitter" exact component={TweetListContainer} />
|
||||
<Route path="/twitter/search" component={TwitterSearch} />
|
||||
<Route path="/twitter/profile" component={TwitterProfile} />
|
||||
</Switch>
|
||||
)}
|
||||
</AppContent>
|
||||
{showTweetButton && <TweetButton openModal={openModal} />}
|
||||
<AlertBar />
|
||||
{!promptProfileName && (
|
||||
<BottomNavigation
|
||||
activePage={activePage}
|
||||
handleChange={handlePageChange}
|
||||
/>
|
||||
)}
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
import TweetList from "./tweet/TweetList";
|
||||
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import SearchButton from "./buttons/SearchButton";
|
||||
import { useFilteredTweets } from "../hooks/useFilteredTweets";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
width: "100%",
|
||||
},
|
||||
searchContainer: {
|
||||
padding: "15px",
|
||||
},
|
||||
search: {
|
||||
width: "100%",
|
||||
},
|
||||
});
|
||||
|
||||
function TwitterSearch() {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
const { tweets, setTweets } = useFilteredTweets();
|
||||
|
||||
const handleChange = (e) => setSearchValue(e.target.value);
|
||||
|
||||
const handleSubmit = () => {
|
||||
const cleanedSearchValue = searchValue.trim();
|
||||
if (!cleanedSearchValue) return;
|
||||
|
||||
Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={classes.root}>
|
||||
<div className={classes.searchContainer}>
|
||||
<TextField
|
||||
className={classes.search}
|
||||
placeholder={t("APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER")}
|
||||
label={t("APPS_TWITTER_SEARCH_TWEETS")}
|
||||
value={searchValue}
|
||||
onChange={handleChange}
|
||||
size="medium"
|
||||
inputRef={(input) => input && input.focus()}
|
||||
/>
|
||||
</div>
|
||||
{tweets && tweets.length > 0 && <TweetList tweets={tweets} />}
|
||||
</div>
|
||||
<SearchButton handleClick={handleSubmit} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default TwitterSearch;
|
||||
@@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import { makeStyles } from "@material-ui/core";
|
||||
import TwitterIcon from "@material-ui/icons/Twitter";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: "60px",
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
background: "#424242",
|
||||
},
|
||||
icon: {
|
||||
color: "#00acee",
|
||||
fontSize: 30,
|
||||
},
|
||||
}));
|
||||
|
||||
export function TwitterTitle() {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper elevation={24} variant="outlined" square className={classes.root}>
|
||||
<TwitterIcon className={classes.icon} />
|
||||
</Paper>
|
||||
);
|
||||
}
|
||||
|
||||
export default TwitterTitle;
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from "react";
|
||||
import MuiAlert from "@material-ui/lab/Alert";
|
||||
|
||||
export function Alert(props) {
|
||||
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
||||
}
|
||||
|
||||
export default Alert;
|
||||
@@ -0,0 +1,66 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Snackbar } from "@material-ui/core";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
import { useTweetStatus } from "../../hooks/useTweetStatus";
|
||||
import Alert from "./Alert";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
bottom: "60px",
|
||||
},
|
||||
}));
|
||||
|
||||
const ALERT_TIMEOUT = 4000;
|
||||
|
||||
export default function AlertBar() {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { updateProfileSuccessful, setUpdateProfileSuccessful } = useProfile();
|
||||
const { createTweetSuccessful, setCreateTweetSuccessful } = useTweetStatus();
|
||||
const [severity, setSeverity] = useState(null);
|
||||
const [open, setOpen] = useState(null);
|
||||
const [message, setMessage] = useState(null);
|
||||
|
||||
const handleClose = () => {
|
||||
setOpen(false);
|
||||
setUpdateProfileSuccessful(null);
|
||||
setCreateTweetSuccessful(null);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (createTweetSuccessful === true) {
|
||||
setOpen(true);
|
||||
setSeverity("success");
|
||||
setMessage(t("APPS_TWITTER_CREATE_SUCCESS"));
|
||||
} else if (createTweetSuccessful === false) {
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setMessage(t("APPS_TWITTER_CREATE_FAILED"));
|
||||
} else if (updateProfileSuccessful === true) {
|
||||
setOpen(true);
|
||||
setSeverity("success");
|
||||
setMessage(t("APPS_TWITTER_EDIT_PROFILE_SUCCESS"));
|
||||
} else if (updateProfileSuccessful === false) {
|
||||
setOpen(true);
|
||||
setSeverity("error");
|
||||
setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE"));
|
||||
}
|
||||
}, [updateProfileSuccessful, createTweetSuccessful]);
|
||||
|
||||
return (
|
||||
<Snackbar
|
||||
autoHideDuration={ALERT_TIMEOUT}
|
||||
className={classes.root}
|
||||
open={open}
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Alert onClose={handleClose} severity={severity}>
|
||||
{message}
|
||||
</Alert>
|
||||
</Snackbar>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Button } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
buttons: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "flex-end",
|
||||
alignItems: "justify-content",
|
||||
marginRight: "15px",
|
||||
},
|
||||
close: {
|
||||
marginLeft: "8px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const ControlButtons = ({
|
||||
showImagePrompt,
|
||||
showEmoji,
|
||||
onCloseClick,
|
||||
onPrimaryClick,
|
||||
}) => {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const imagePromptVisible = showImagePrompt && !showEmoji;
|
||||
const primaryButtonText = imagePromptVisible
|
||||
? t("APPS_TWITTER_SUBMIT_IMAGE")
|
||||
: t("APPS_TWITTER_TWEET");
|
||||
const showCloseButton = showImagePrompt || showEmoji;
|
||||
|
||||
return (
|
||||
<div className={classes.buttons}>
|
||||
<Button variant="contained" color="primary" onClick={onPrimaryClick}>
|
||||
{primaryButtonText}
|
||||
</Button>
|
||||
{showCloseButton && (
|
||||
<Button
|
||||
className={classes.close}
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
onClick={onCloseClick}
|
||||
>
|
||||
{t("APPS_TWITTER_CLOSE_IMAGE")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ControlButtons;
|
||||
@@ -0,0 +1,40 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Button } from "@material-ui/core";
|
||||
import InsertPhotoIcon from "@material-ui/icons/InsertPhoto";
|
||||
import EmojiIcon from "@material-ui/icons/SentimentSatisfied";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
buttons: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "flex-start",
|
||||
paddingLeft: "5px", // re-align left buttons after overriding material-ui spacing
|
||||
},
|
||||
button: {
|
||||
background: "transparent",
|
||||
minWidth: "45px", // override default material-ui spacing between buttons
|
||||
},
|
||||
}));
|
||||
|
||||
export const IconButtons = ({ onImageClick, onEmojiClick }) => {
|
||||
const classes = useStyles();
|
||||
const { config } = usePhone();
|
||||
|
||||
if (!config) return null;
|
||||
const { enableImages, enableEmojis } = config.twitter;
|
||||
|
||||
return (
|
||||
<div className={classes.buttons}>
|
||||
{enableImages && (<Button className={classes.button} onClick={onImageClick}>
|
||||
<InsertPhotoIcon color="action" />
|
||||
</Button>)}
|
||||
{enableEmojis && (<Button className={classes.button} onClick={onEmojiClick}>
|
||||
<EmojiIcon color="action" />
|
||||
</Button>)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default IconButtons;
|
||||
@@ -0,0 +1,50 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import PublishIcon from "@material-ui/icons/Publish";
|
||||
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: "absolute",
|
||||
bottom: "15px",
|
||||
right: "15px",
|
||||
},
|
||||
button: {
|
||||
background: "#00acee",
|
||||
},
|
||||
}));
|
||||
|
||||
const MINIMUM_LOAD_TIME = 750;
|
||||
|
||||
export function ProfileUpdateButton({ handleClick }) {
|
||||
const classes = useStyles();
|
||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(true);
|
||||
const { updateProfileLoading } = useProfile();
|
||||
|
||||
useEffect(() => {
|
||||
setMimimumLoadPassed(false);
|
||||
const timeout = window.setTimeout(() => {
|
||||
setMimimumLoadPassed(true);
|
||||
}, MINIMUM_LOAD_TIME);
|
||||
return () => window.clearTimeout(timeout);
|
||||
}, [updateProfileLoading]);
|
||||
|
||||
const isLoading = updateProfileLoading || !minimumLoadPassed;
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab
|
||||
className={classes.button}
|
||||
color="primary"
|
||||
onClick={handleClick}
|
||||
disabled={isLoading}
|
||||
>
|
||||
<PublishIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfileUpdateButton;
|
||||
@@ -0,0 +1,26 @@
|
||||
import React from "react";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { Button } from "@material-ui/core";
|
||||
import QuoteIcon from "@material-ui/icons/FormatQuote";
|
||||
|
||||
import { twitterState } from "../../hooks/state";
|
||||
|
||||
export const QuoteButton = ({ message }) => {
|
||||
const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal);
|
||||
const setMessage = useSetRecoilState(twitterState.modalMessage);
|
||||
|
||||
const handleClick = () => {
|
||||
setMessage(`> ${message}
|
||||
|
||||
`);
|
||||
setModalVisible(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick}>
|
||||
<QuoteIcon />
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default QuoteButton;
|
||||
@@ -0,0 +1,24 @@
|
||||
import React from "react";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { Button } from "@material-ui/core";
|
||||
import ReplyIcon from "@material-ui/icons/Reply";
|
||||
|
||||
import { twitterState } from "../../hooks/state";
|
||||
|
||||
export const ReplyButton = ({ profile_name }) => {
|
||||
const setModalVisible = useSetRecoilState(twitterState.showCreateTweetModal);
|
||||
const setMessage = useSetRecoilState(twitterState.modalMessage);
|
||||
|
||||
const handleClick = () => {
|
||||
setMessage(`@${profile_name} `);
|
||||
setModalVisible(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick}>
|
||||
<ReplyIcon />
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReplyButton;
|
||||
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import SearchIcon from "@material-ui/icons/Search";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: "absolute",
|
||||
bottom: "15px",
|
||||
right: "15px",
|
||||
},
|
||||
button: {
|
||||
background: "#00acee",
|
||||
},
|
||||
}));
|
||||
|
||||
export function ProfileUpdateButton({ handleClick }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color="primary" onClick={handleClick}>
|
||||
<SearchIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfileUpdateButton;
|
||||
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Fab } from "@material-ui/core";
|
||||
import CreateIcon from "@material-ui/icons/Create";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
position: "absolute",
|
||||
bottom: "75px",
|
||||
right: "15px",
|
||||
},
|
||||
button: {
|
||||
background: "#00acee",
|
||||
},
|
||||
}));
|
||||
|
||||
export function TweetButton({ openModal }) {
|
||||
const classes = useStyles();
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Fab className={classes.button} color="primary" onClick={openModal}>
|
||||
<CreateIcon />
|
||||
</Fab>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default TweetButton;
|
||||
@@ -0,0 +1,57 @@
|
||||
import React from "react";
|
||||
import { IconButton } from "@material-ui/core";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import CloseIcon from "@material-ui/icons/Close";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
margin: "2px 15px",
|
||||
},
|
||||
imageContainer: {
|
||||
// catch the close button here so it doesn't go all the way up to the modal
|
||||
position: "relative",
|
||||
display: "inline-block",
|
||||
},
|
||||
imgButton: {
|
||||
position: "absolute", // show the close button in the top right of the image
|
||||
top: "2px",
|
||||
right: "5px",
|
||||
backgroundColor: "#000",
|
||||
opacity: 0.7,
|
||||
"&:hover": {
|
||||
// fixes a bug where when the user closes one image material-ui puts
|
||||
// the hover status on the previous image
|
||||
backgroundColor: "#000",
|
||||
},
|
||||
},
|
||||
img: {
|
||||
maxHeight: "125px", // constrain images so we don't overwhelm the UI
|
||||
maxWidth: "300px",
|
||||
padding: "0px 3px 3px 0px",
|
||||
},
|
||||
imgSmall: {
|
||||
maxHeight: "200px", // constrain images so we don't overwhelm the UI
|
||||
maxWidth: "100%",
|
||||
padding: "0px 1px 1px 0px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const Image = ({ link, handleClick, small }) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.imageContainer}>
|
||||
{handleClick && (
|
||||
<IconButton
|
||||
className={classes.imgButton}
|
||||
onClick={handleClick}
|
||||
size="small"
|
||||
>
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img className={small ? classes.imgSmall : classes.img} src={link} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Image;
|
||||
@@ -0,0 +1,29 @@
|
||||
import React from "react";
|
||||
|
||||
import Image from "./Image";
|
||||
|
||||
export const ImageDisplay = ({ visible, images, removeImage, small }) => {
|
||||
if (!visible || !images || images.length === 0) return null;
|
||||
|
||||
const styles = { margin: small ? "2px 0px" : "2px 15px" };
|
||||
|
||||
return (
|
||||
<div style={styles}>
|
||||
{images.map((image) => (
|
||||
<Image
|
||||
key={image.id}
|
||||
link={image.link}
|
||||
handleClick={removeImage ? () => removeImage(image.id) : null}
|
||||
small={small}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
ImageDisplay.defaultProps = {
|
||||
removeImage: null,
|
||||
small: false,
|
||||
};
|
||||
|
||||
export default ImageDisplay;
|
||||
@@ -0,0 +1,36 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
textField: {
|
||||
flex: "1 1 100%",
|
||||
padding: "10px 15px",
|
||||
marginTop: "15px",
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: "22px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const ImagePrompt = ({ visible, value, handleChange }) => {
|
||||
const { t } = useTranslation();
|
||||
const classes = useStyles();
|
||||
|
||||
if (!visible) return null;
|
||||
return (
|
||||
<TextField
|
||||
value={value}
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
className={classes.textField}
|
||||
onChange={handleChange}
|
||||
multiline
|
||||
size="small"
|
||||
placeholder={t("APPS_TWITTER_IMAGE_PLACEHOLDER")}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default ImagePrompt;
|
||||
@@ -0,0 +1,95 @@
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
import Avatar from "../Avatar";
|
||||
import ProfileField from "./ProfileField";
|
||||
import ProfileUpdateButton from "../buttons/ProfileUpdateButton";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: "relative",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
padding: "15px",
|
||||
},
|
||||
spacer: {
|
||||
height: "8px",
|
||||
},
|
||||
}));
|
||||
|
||||
export function Profile() {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { profile } = useProfile();
|
||||
const { config } = usePhone();
|
||||
|
||||
|
||||
// note that this assumes we are defensively checking
|
||||
// that profile is not null in a parent above this component.
|
||||
// Annoyingling adding conditionals above this line to not render
|
||||
// when profile === null results in a react error that different
|
||||
// amounts of hooks are rendering
|
||||
const [avatarUrl, handleAvatarChange] = useState(profile.avatar_url);
|
||||
const [name, handleNameChange] = useState(profile.profile_name || "");
|
||||
const [bio, handleBioChange] = useState(profile.bio || "");
|
||||
const [location, handleLocationChange] = useState(profile.location || "");
|
||||
const [job, handleJobChange] = useState(profile.job || "");
|
||||
|
||||
const handleUpdate = () => {
|
||||
const data = {
|
||||
avatar_url: avatarUrl,
|
||||
profile_name: name,
|
||||
bio,
|
||||
location,
|
||||
job,
|
||||
};
|
||||
Nui.send("phone:updateTwitterProfile", data);
|
||||
};
|
||||
|
||||
// fetching the config is an asynchronous call so defend against it
|
||||
if (!config) return null;
|
||||
|
||||
const { enableAvatars, allowEdtiableProfileName } = config.twitter;
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
{enableAvatars && <Avatar avatarUrl={avatarUrl} showInvalidImage />}
|
||||
<div className={classes.spacer} />
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_AVATAR")}
|
||||
value={avatarUrl}
|
||||
handleChange={handleAvatarChange}
|
||||
allowChange={enableAvatars}
|
||||
/>
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_NAME")}
|
||||
value={name}
|
||||
handleChange={handleNameChange}
|
||||
allowChange={allowEdtiableProfileName}
|
||||
/>
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_BIO")}
|
||||
value={bio}
|
||||
handleChange={handleBioChange}
|
||||
multiline
|
||||
/>
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_LOCATION")}
|
||||
value={location}
|
||||
handleChange={handleLocationChange}
|
||||
/>
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_JOB")}
|
||||
value={job}
|
||||
handleChange={handleJobChange}
|
||||
/>
|
||||
<ProfileUpdateButton handleClick={handleUpdate} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Profile;
|
||||
@@ -0,0 +1,47 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
formContainer: {
|
||||
width: "100%",
|
||||
marginTop: "8px",
|
||||
},
|
||||
textField: {
|
||||
width: "100%",
|
||||
},
|
||||
});
|
||||
|
||||
function ProfileField({
|
||||
label,
|
||||
value,
|
||||
handleChange,
|
||||
allowChange,
|
||||
multiline,
|
||||
inputRef,
|
||||
}) {
|
||||
const classes = useStyles();
|
||||
const _handleChange = (e) => handleChange(e.target.value);
|
||||
|
||||
return (
|
||||
<div className={classes.formContainer}>
|
||||
<TextField
|
||||
className={classes.textField}
|
||||
label={label}
|
||||
value={value}
|
||||
onChange={_handleChange}
|
||||
disabled={!allowChange}
|
||||
multiline={multiline}
|
||||
inputRef={inputRef}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
ProfileField.defaultProps = {
|
||||
allowChange: true,
|
||||
multiline: false,
|
||||
inputRef: null,
|
||||
};
|
||||
|
||||
export default ProfileField;
|
||||
@@ -0,0 +1,49 @@
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import { useProfile } from "../../hooks/useProfile";
|
||||
import ProfileField from "./ProfileField";
|
||||
import ProfileUpdateButton from "../buttons/ProfileUpdateButton";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
position: "relative",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
padding: "15px",
|
||||
},
|
||||
spacer: {
|
||||
height: "8px",
|
||||
},
|
||||
}));
|
||||
|
||||
export function ProfilePrompt() {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { profile } = useProfile();
|
||||
const [name, handleNameChange] = useState(profile.profile_name || "");
|
||||
|
||||
const handleUpdate = () => {
|
||||
const data = {
|
||||
...profile,
|
||||
profile_name: name,
|
||||
};
|
||||
Nui.send("phone:updateTwitterProfile", data);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<ProfileField
|
||||
label={t("APPS_TWITTER_EDIT_PROFILE_NAME")}
|
||||
value={name}
|
||||
handleChange={handleNameChange}
|
||||
allowChange
|
||||
/>
|
||||
<ProfileUpdateButton handleClick={handleUpdate} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfilePrompt;
|
||||
@@ -0,0 +1,126 @@
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import {
|
||||
ListItemAvatar,
|
||||
Avatar as MuiAvatar,
|
||||
Button,
|
||||
Typography,
|
||||
} from "@material-ui/core";
|
||||
import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder";
|
||||
import MoreIcon from "@material-ui/icons/MoreVert";
|
||||
|
||||
import { ListItem } from "../../../../ui/components/ListItem";
|
||||
import { secondsToHumanReadable } from "../../utils/time";
|
||||
import ReplyButton from "../buttons/ReplyButton";
|
||||
import ImageDisplay from "../images/ImageDisplay";
|
||||
import Avatar from "../Avatar";
|
||||
import { QuoteButton } from "../buttons/QuoteButton";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles(() => ({
|
||||
root: {
|
||||
overflowX: "hidden",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
alignItems: "flex-start",
|
||||
width: "100%",
|
||||
marginTop: "3px",
|
||||
},
|
||||
content: {
|
||||
display: "flex",
|
||||
marginTop: "-10px", // easier to do this here than override the MUI styles
|
||||
flexFlow: "column nowrap",
|
||||
width: "100%",
|
||||
},
|
||||
primary: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
width: "100%",
|
||||
alignItems: "flex-end",
|
||||
},
|
||||
profile: {
|
||||
fontSize: "18px",
|
||||
fontWeight: "bold",
|
||||
},
|
||||
date: {
|
||||
marginLeft: "10px",
|
||||
fontSize: "14px",
|
||||
},
|
||||
message: {
|
||||
fontSize: "18px",
|
||||
color: "rgba(255, 255, 255, 0.7)",
|
||||
},
|
||||
buttonContainer: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "space-between",
|
||||
width: "100%",
|
||||
marginLeft: "-20px", // easier to do this here than override the MUI styles
|
||||
marginTop: "3px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const Tweet = (tweet) => {
|
||||
const {
|
||||
message,
|
||||
images,
|
||||
avatar_url,
|
||||
profile_name,
|
||||
seconds_since_tweet,
|
||||
} = tweet;
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const { config } = usePhone();
|
||||
|
||||
if (!config) return null;
|
||||
const { enableAvatars, enableImages } = config.twitter;
|
||||
|
||||
// this is a workaround to transfer string new lines and returns that
|
||||
// are stored into the database into html for the UI to render
|
||||
const formattedMessage = message.replace(/\n\r?/g, "<br />");
|
||||
|
||||
const profileName = profile_name ? `@${profile_name}` : "";
|
||||
|
||||
return (
|
||||
<ListItem className={classes.root} divider>
|
||||
{enableAvatars && (
|
||||
<ListItemAvatar>
|
||||
<MuiAvatar>
|
||||
<Avatar avatarUrl={avatar_url} height="40px" width="40px" />
|
||||
</MuiAvatar>
|
||||
</ListItemAvatar>
|
||||
)}
|
||||
<div className={classes.content}>
|
||||
<div className={classes.primary}>
|
||||
<div className={classes.profile}>{profileName}</div>
|
||||
<Typography
|
||||
className={classes.date}
|
||||
component="div"
|
||||
variant="body2"
|
||||
color="textSecondary"
|
||||
>
|
||||
{secondsToHumanReadable(t, seconds_since_tweet)}
|
||||
</Typography>
|
||||
</div>
|
||||
<div
|
||||
className={classes.message}
|
||||
dangerouslySetInnerHTML={{ __html: formattedMessage }}
|
||||
/>
|
||||
{enableImages && <ImageDisplay visible images={images} small />}
|
||||
<div className={classes.buttonContainer}>
|
||||
<ReplyButton profile_name={profile_name} />
|
||||
<Button>
|
||||
<FavoriteBorderIcon />
|
||||
</Button>
|
||||
<QuoteButton message={message} />
|
||||
<Button>
|
||||
<MoreIcon />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</ListItem>
|
||||
);
|
||||
};
|
||||
|
||||
export default Tweet;
|
||||
@@ -0,0 +1,34 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import { List } from "../../../../ui/components/List";
|
||||
import Tweet from "./Tweet";
|
||||
import TweetSkeletonList from "./TweetSkeletonList";
|
||||
|
||||
const MINIMUM_LOAD_TIME = 700;
|
||||
|
||||
export function TweetList({ tweets }) {
|
||||
const [minimumLoadPassed, setMimimumLoadPassed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const timeout = window.setTimeout(() => {
|
||||
setMimimumLoadPassed(true);
|
||||
}, MINIMUM_LOAD_TIME);
|
||||
return () => window.clearTimeout(timeout);
|
||||
});
|
||||
|
||||
// we add a minimum (but short) load time here so that
|
||||
// there isn't a quick flash of loading and immediately
|
||||
// another flash to the tweets screen.
|
||||
const hasLoaded = tweets && minimumLoadPassed;
|
||||
|
||||
if (!hasLoaded) return <TweetSkeletonList />;
|
||||
return (
|
||||
<List>
|
||||
{tweets.map((tweet) => (
|
||||
<Tweet key={tweet.id} {...tweet} />
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
}
|
||||
|
||||
export default TweetList;
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
|
||||
import { useTweets } from "../../hooks/useTweets";
|
||||
import TweetList from "./TweetList";
|
||||
|
||||
export function TweetListContainer() {
|
||||
const { tweets } = useTweets();
|
||||
return <TweetList tweets={tweets} />;
|
||||
}
|
||||
|
||||
export default TweetListContainer;
|
||||
@@ -0,0 +1,44 @@
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { TextField } from "@material-ui/core";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
textField: {
|
||||
flex: "1 1 100%",
|
||||
padding: "10px 15px",
|
||||
marginTop: "15px",
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: "22px",
|
||||
},
|
||||
display: {
|
||||
height: "200px",
|
||||
},
|
||||
}));
|
||||
|
||||
export const TweetMessage = ({ message, handleChange }) => {
|
||||
const classes = useStyles();
|
||||
const { config } = usePhone();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const overCharacterLimit = message.trim().length > config.twitter.characterLimit;
|
||||
const characterWarningPrompt = `${t("APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT")} (${config.twitter.characterLimit})`;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
value={message}
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
className={classes.textField}
|
||||
onChange={handleChange}
|
||||
multiline
|
||||
placeholder={t("APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER")}
|
||||
inputRef={(input) => input && input.focus()}
|
||||
error={overCharacterLimit}
|
||||
helperText={overCharacterLimit ? characterWarningPrompt : null}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default TweetMessage;
|
||||
@@ -0,0 +1,39 @@
|
||||
import React from "react";
|
||||
import Divider from "@material-ui/core/Divider";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import Skeleton from "@material-ui/lab/Skeleton";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
width: "100%",
|
||||
padding: "15px",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
marginTop: "3px",
|
||||
marginBottom: "3px",
|
||||
},
|
||||
left: {},
|
||||
right: {
|
||||
marginLeft: "15px",
|
||||
marginTop: "-5px",
|
||||
},
|
||||
});
|
||||
|
||||
export default function TweetSkeleton() {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<>
|
||||
<div className={classes.root}>
|
||||
<div className={classes.left}>
|
||||
<Skeleton variant="circle" width={60} height={60} />
|
||||
</div>
|
||||
<div className={classes.right}>
|
||||
<Skeleton variant="text" />
|
||||
<Skeleton variant="rect" width={250} height={118} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Divider />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import React from "react";
|
||||
|
||||
import { List } from "../../../../ui/components/List";
|
||||
import TweetSkeleton from "./TweetSkeleton";
|
||||
|
||||
export function TweetSkeletonList() {
|
||||
return (
|
||||
<List>
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
<TweetSkeleton />
|
||||
</List>
|
||||
);
|
||||
}
|
||||
|
||||
export default TweetSkeletonList;
|
||||
@@ -0,0 +1,42 @@
|
||||
/* 00acee is "twitter blue" and we want to use that to override
|
||||
some of the Material UI primary theme settings */
|
||||
|
||||
/* override buttons on the tweet modal */
|
||||
#twitter-app .MuiButton-containedPrimary {
|
||||
background: #00acee !important;
|
||||
}
|
||||
|
||||
/* override the bottom navigation active color */
|
||||
#twitter-app .Mui-selected {
|
||||
color: #00acee !important;
|
||||
}
|
||||
/* override the FAB (action buttons) background when selected */
|
||||
#twitter-app .MuiFab-primary {
|
||||
background: #00acee !important;
|
||||
}
|
||||
|
||||
/* override the labels on text fields */
|
||||
#twitter-app .MuiInputLabel-formControl.Mui-focused {
|
||||
color: #00acee !important;
|
||||
}
|
||||
|
||||
/* override the underlines of text fields */
|
||||
#twitter-app .Mui-focused:after {
|
||||
border-bottom-color: #00acee !important;
|
||||
}
|
||||
|
||||
/*
|
||||
override position of the snackbar so that it appears
|
||||
within the phone rather than on the game UI */
|
||||
#twitter-app .MuiSnackbar-root {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.emoji-mart {
|
||||
margin: 0px 15px 8px 15px !important;
|
||||
width: calc(100% - 30px) !important;
|
||||
}
|
||||
|
||||
.emoji-mart-bar {
|
||||
display: none;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const twitterState = {
|
||||
profile: atom({
|
||||
key: "profile",
|
||||
default: null,
|
||||
}),
|
||||
tweets: atom({
|
||||
key: "tweets",
|
||||
default: null,
|
||||
}),
|
||||
filteredTweets: atom({
|
||||
key: "filteredTweets",
|
||||
default: null,
|
||||
}),
|
||||
showCreateTweetModal: atom({
|
||||
key: "showCreateTweetModal",
|
||||
default: false,
|
||||
}),
|
||||
modalMessage: atom({
|
||||
key: "modalMessage",
|
||||
default: "",
|
||||
}),
|
||||
createTweetLoading: atom({
|
||||
key: "createTweetLoading",
|
||||
default: false,
|
||||
}),
|
||||
createTweetSuccessful: atom({
|
||||
key: "createTweetSuccessful",
|
||||
default: null,
|
||||
}),
|
||||
updateProfileLoading: atom({
|
||||
key: "updateProfileLoading",
|
||||
default: false,
|
||||
}),
|
||||
updateProfileSuccess: atom({
|
||||
key: "updateProfileSuccess",
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilState } from "recoil";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useFilteredTweets = () => {
|
||||
const [tweets, setTweets] = useRecoilState(twitterState.filteredTweets);
|
||||
return { tweets, setTweets };
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useRecoilState } from "recoil";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useModal = () => {
|
||||
const [modalVisible, setModalVisible] = useRecoilState(
|
||||
twitterState.showCreateTweetModal
|
||||
);
|
||||
const [message, setMessage] = useRecoilState(twitterState.modalMessage);
|
||||
return { modalVisible, setModalVisible, message, setMessage };
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
import { useRecoilValue, useRecoilState } from "recoil";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useProfile = () => {
|
||||
const profile = useRecoilValue(twitterState.profile);
|
||||
const updateProfileLoading = useRecoilValue(
|
||||
twitterState.updateProfileLoading
|
||||
);
|
||||
const [updateProfileSuccessful, setUpdateProfileSuccessful] = useRecoilState(
|
||||
twitterState.updateProfileSuccess
|
||||
);
|
||||
return {
|
||||
profile,
|
||||
updateProfileLoading,
|
||||
updateProfileSuccessful,
|
||||
setUpdateProfileSuccessful,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useRecoilValue, useRecoilState } from "recoil";
|
||||
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useTweetStatus = () => {
|
||||
const createTweetLoading = useRecoilValue(twitterState.createTweetLoading);
|
||||
const [createTweetSuccessful, setCreateTweetSuccessful] = useRecoilState(
|
||||
twitterState.createTweetSuccessful
|
||||
);
|
||||
return {
|
||||
createTweetLoading,
|
||||
createTweetSuccessful,
|
||||
setCreateTweetSuccessful,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilValue, useSetRecoilState } from "recoil";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useTweets = () => {
|
||||
const tweets = useRecoilValue(twitterState.tweets);
|
||||
return { tweets };
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
import { useSetRecoilState } from "recoil";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent";
|
||||
import { IMAGE_DELIMITER } from "../utils/images";
|
||||
import { APP_TWITTER } from "../utils/constants";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
/**
|
||||
* Perform all necessary processing/transforms from the raw database
|
||||
* data to what the frontend expects
|
||||
* @param {object} tweet - full JSON returned from the server/database
|
||||
*/
|
||||
function processTweet(tweet) {
|
||||
// we store images in the database as a varchar field with
|
||||
// comma separated links to images, so here we split them
|
||||
// back into their distinct members
|
||||
const imageLinks = tweet.images ? tweet.images.split(IMAGE_DELIMITER) : [];
|
||||
const images = imageLinks.map((link) => ({ id: uuidv4(), link }));
|
||||
return { ...tweet, images };
|
||||
}
|
||||
|
||||
/**
|
||||
* Service to handle all NUI <> client interactions. We take
|
||||
* this opportunity to act as a middleware layer between the
|
||||
* client and the react components. Because I'm terrible with lua
|
||||
* I have given up on parsing/cleaning database query results there
|
||||
* there and have moved that logic here instead.
|
||||
*/
|
||||
export const useTwitterService = () => {
|
||||
const setProfile = useSetRecoilState(twitterState.profile);
|
||||
const setUpdateProfileLoading = useSetRecoilState(
|
||||
twitterState.updateProfileLoading
|
||||
);
|
||||
const setUpdateProfileSuccess = useSetRecoilState(
|
||||
twitterState.updateProfileSuccess
|
||||
);
|
||||
const setTweets = useSetRecoilState(twitterState.tweets);
|
||||
const setFilteredTweets = useSetRecoilState(twitterState.filteredTweets);
|
||||
const setCreateLoading = useSetRecoilState(twitterState.createTweetLoading);
|
||||
const setCreateSuccess = useSetRecoilState(
|
||||
twitterState.createTweetSuccessful
|
||||
);
|
||||
|
||||
const _setProfile = (profile) => {
|
||||
setProfile(profile[0]); // server returns an array of 1 profile
|
||||
};
|
||||
const _setUpdateProfileSuccess = (isSuccessful) => {
|
||||
setUpdateProfileSuccess(isSuccessful);
|
||||
setUpdateProfileLoading(false); // on any result we should set loading to false
|
||||
};
|
||||
|
||||
const _setCreateSuccess = (isSuccessful) => {
|
||||
setCreateSuccess(isSuccessful);
|
||||
setCreateLoading(false);
|
||||
};
|
||||
|
||||
const _setTweets = (tweets) => {
|
||||
setTweets(tweets.map(processTweet));
|
||||
};
|
||||
const _setFilteredTweets = (tweets) => {
|
||||
setFilteredTweets(tweets.map(processTweet));
|
||||
};
|
||||
|
||||
useNuiEvent(APP_TWITTER, "getOrCreateTwitterProfile", _setProfile);
|
||||
useNuiEvent(APP_TWITTER, "updateProfileLoading", setUpdateProfileLoading);
|
||||
useNuiEvent(APP_TWITTER, "updateProfileResult", _setUpdateProfileSuccess);
|
||||
useNuiEvent(APP_TWITTER, "fetchTweets", _setTweets);
|
||||
useNuiEvent(APP_TWITTER, "fetchTweetsFiltered", _setFilteredTweets);
|
||||
useNuiEvent(APP_TWITTER, "createTweetLoading", setCreateLoading);
|
||||
useNuiEvent(APP_TWITTER, "createTweetResult", _setCreateSuccess);
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
export const IMG_DEFAULT_AVATAR = "./media/twitter/egg.png";
|
||||
export const IMG_INVALID_AVATAR = "./media/twitter/invalid.png";
|
||||
export const APP_TWITTER = "TWITTER";
|
||||
@@ -0,0 +1,20 @@
|
||||
// this is a hack. We are saving images in the database as
|
||||
// delimiter separated URLS, but most common delimiters (comma, pipe
|
||||
// hash, etc.) are often found in URLS (even though it's not technically
|
||||
// within specification). To get around this we have our own delimiter
|
||||
// here we'll use to join and split these strings
|
||||
export const IMAGE_DELIMITER = "||!||";
|
||||
|
||||
/**
|
||||
* Validate that the URL successfully loads in the browser
|
||||
* @param {string} link - a URL we are trying to validate
|
||||
* @param {func} onSuccess - callback if the link is valid
|
||||
*/
|
||||
export function withValidImage(link, onSuccess) {
|
||||
const image = new Image();
|
||||
image.onload = onSuccess;
|
||||
image.onerror = () => {
|
||||
console.warn(`Invalid image submitted: ${link}`);
|
||||
};
|
||||
image.src = link;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
const ONE_MINUTE = 60;
|
||||
const ONE_HOUR = 60 * ONE_MINUTE;
|
||||
const ONE_DAY = 24 * ONE_HOUR;
|
||||
|
||||
const JUST_NOW = "APPS_TWITTER_TIME_JUST_NOW";
|
||||
const MINUTES = "APPS_TWITTER_TIME_MINUTES";
|
||||
const HOURS = "APPS_TWITTER_TIME_HOURS";
|
||||
const DAYS = "APPS_TWITTER_TIME_DAYS";
|
||||
|
||||
/**
|
||||
* Convert seconds to a human readable format i.e. "Just Now", "2m", "3d"
|
||||
* @param {function} t - translation object passed from a component implementing the hook
|
||||
* @param {number} seconds - seconds to translate to a string
|
||||
*/
|
||||
export function secondsToHumanReadable(t, seconds) {
|
||||
if (seconds < 60) {
|
||||
return t(JUST_NOW);
|
||||
} else if (seconds < ONE_HOUR) {
|
||||
return `${Math.floor(seconds / ONE_MINUTE)}${t(MINUTES)}`;
|
||||
} else if (seconds < ONE_DAY) {
|
||||
return `${Math.floor(seconds / ONE_HOUR)}${t(HOURS)}`;
|
||||
} else {
|
||||
return `${Math.floor(seconds / ONE_DAY)}${t(DAYS)}`;
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,29 @@
|
||||
"APPS_BANK_WITHDRAW": "Withdraw",
|
||||
"APPS_BANK_TRANSFER": "Transfer",
|
||||
"APPS_SETTINGS_OPTIONS_WALLPAPER": "Wallpaper",
|
||||
"APPS_SETTINGS_OPTIONS_FRAME": "Frame"
|
||||
"APPS_SETTINGS_OPTIONS_FRAME": "Frame",
|
||||
"APPS_TWITTER": "Twitter",
|
||||
"APPS_TWITTER_TWEET": "Tweet",
|
||||
"APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER": "What's happening?",
|
||||
"APPS_TWITTER_IMAGE_PLACEHOLDER": "A link to your image or gif",
|
||||
"APPS_TWITTER_SUBMIT_IMAGE": "Add Media",
|
||||
"APPS_TWITTER_CLOSE_IMAGE": "Close",
|
||||
"APPS_TWITTER_CLOSE": "Close",
|
||||
"APPS_TWITTER_SEARCH_TWEETS": "Search for tweets",
|
||||
"APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Search by profile name or message",
|
||||
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Message is over the character limit",
|
||||
"APPS_TWITTER_CREATE_SUCCESS": "Successfully sent your tweet",
|
||||
"APPS_TWITTER_CREATE_FAILED": "Failed to send your tweet",
|
||||
"APPS_TWITTER_EDIT_PROFILE_AVATAR": "Avatar URL",
|
||||
"APPS_TWITTER_EDIT_PROFILE_NAME": "Profile name",
|
||||
"APPS_TWITTER_EDIT_PROFILE_BIO": "Bio",
|
||||
"APPS_TWITTER_EDIT_PROFILE_LOCATION": "Location",
|
||||
"APPS_TWITTER_EDIT_PROFILE_JOB": "Job",
|
||||
"APPS_TWITTER_EDIT_PROFILE_SUCCESS": "Successfully updated your profile",
|
||||
"APPS_TWITTER_EDIT_PROFILE_FAILURE": "Failed to update your profile",
|
||||
"APPS_TWITTER_TIME_JUST_NOW": "Just now",
|
||||
"APPS_TWITTER_TIME_MINUTES": "m",
|
||||
"APPS_TWITTER_TIME_HOURS": "h",
|
||||
"APPS_TWITTER_TIME_DAYS": "d"
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import React from "react";
|
||||
import { useConfig } from "../../../config/hooks/useConfig";
|
||||
import {
|
||||
blue,
|
||||
common,
|
||||
grey,
|
||||
green,
|
||||
orange,
|
||||
@@ -14,6 +15,7 @@ import PhoneIcon from "@material-ui/icons/Phone";
|
||||
import CalendarTodayIcon from "@material-ui/icons/CalendarToday";
|
||||
import AccountBalanceIcon from "@material-ui/icons/AccountBalance";
|
||||
import MessageIcon from "@material-ui/icons/Message";
|
||||
import TwitterIcon from "@material-ui/icons/Twitter";
|
||||
import { atom } from "recoil";
|
||||
import { CalculatorIcon } from "../../../apps/calculator/components/CalculatorIcon";
|
||||
import { Route } from "react-router-dom";
|
||||
@@ -23,6 +25,7 @@ import { CalculatorApp } from "../../../apps/calculator/components/CalculatorApp
|
||||
import { SettingsApp } from "../../../apps/settings/components/SettingsApp";
|
||||
import { BankApp } from "../../../apps/bank/components/BankApp";
|
||||
import { MessagesApp } from "../../../apps/messages/components/MessagesApp";
|
||||
import { TwitterApp } from "../../../apps/twitter/components/TwitterApp";
|
||||
import { ExampleApp } from "../../../apps/example/components/ExampleApp";
|
||||
|
||||
const appsState = atom({
|
||||
@@ -83,6 +86,15 @@ const appsState = atom({
|
||||
path: "/bank",
|
||||
Route: () => <Route path="/bank" component={BankApp} />,
|
||||
},
|
||||
{
|
||||
id: "TWITTER",
|
||||
nameLocale: "APPS_TWITTER",
|
||||
icon: <TwitterIcon />,
|
||||
backgroundColor: blue[600],
|
||||
color: common.white,
|
||||
path: "/twitter",
|
||||
Route: () => <Route path="/twitter" component={TwitterApp} />,
|
||||
},
|
||||
{
|
||||
id: "EXAMPLE",
|
||||
nameLocale: "APPS_EXAMPLE",
|
||||
|
||||
@@ -10,14 +10,15 @@ export const useNuiEvent = (app, method, handler, options = {}) => {
|
||||
}, [handler]);
|
||||
|
||||
useEffect(() => {
|
||||
const eventName = eventNameFactory(app, method);
|
||||
const eventListener = (event) => {
|
||||
if (savedHandler.current && savedHandler.current.call) {
|
||||
const { data } = event;
|
||||
console.log(eventName, data);
|
||||
savedHandler.current(data);
|
||||
}
|
||||
};
|
||||
const opts = { capture, passive, once };
|
||||
const eventName = eventNameFactory(app, method);
|
||||
window.addEventListener(eventName, eventListener, opts);
|
||||
return () => window.removeEventListener(eventName, eventListener, opts);
|
||||
}, [app, method, capture, passive, once]);
|
||||
|
||||
@@ -5,4 +5,8 @@ export const phoneState = {
|
||||
key: "phoneVisibility",
|
||||
default: false,
|
||||
}),
|
||||
phoneConfig: atom({
|
||||
key: "phoneConfig",
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -3,5 +3,6 @@ import { phoneState } from "./state";
|
||||
|
||||
export const usePhone = () => {
|
||||
const visibility = useRecoilValue(phoneState.visibility);
|
||||
return { visibility };
|
||||
const config = useRecoilValue(phoneState.phoneConfig);
|
||||
return { visibility, config };
|
||||
};
|
||||
@@ -5,6 +5,8 @@ import { usePhone } from "./usePhone";
|
||||
|
||||
export const usePhoneService = () => {
|
||||
const setVisibility = useSetRecoilState(phoneState.visibility);
|
||||
const setPhoneConfig = useSetRecoilState(phoneState.phoneConfig);
|
||||
useNuiEvent("PHONE", "setVisibility", setVisibility);
|
||||
useNuiEvent("PHONE", "phoneConfig", setPhoneConfig);
|
||||
return usePhone();
|
||||
};
|
||||
@@ -8,6 +8,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
},
|
||||
box: {
|
||||
width: "100%",
|
||||
height: "100%", // allow application to fill entireity of space
|
||||
position: "relative",
|
||||
overflow: "auto",
|
||||
},
|
||||
@@ -17,6 +18,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
},
|
||||
paper: {
|
||||
width: "100%",
|
||||
height: "100%", // allow application to fill entireity of space
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
import React, { useEffect } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Paper } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
zIndex: 10,
|
||||
background: "#424242",
|
||||
marginTop: "15px",
|
||||
width: "90%",
|
||||
display: "flex",
|
||||
flexFlow: "column nowrap",
|
||||
position: "absolute",
|
||||
top: "80px",
|
||||
},
|
||||
displayBlock: {
|
||||
/*Sets modal to center*/
|
||||
display: "flex",
|
||||
flexFlow: "column nowrap",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
position: "relative",
|
||||
},
|
||||
displayNone: {
|
||||
display: "none",
|
||||
},
|
||||
}));
|
||||
|
||||
export const Modal = ({ children, visible, handleClose }) => {
|
||||
const classes = useStyles();
|
||||
|
||||
// when the user presses escape we should close the modal
|
||||
const _handleEscape = (e) => {
|
||||
const isEscapeKey = e.key == "Escape" || e.key == "Esc";
|
||||
if (isEscapeKey) {
|
||||
e.preventDefault();
|
||||
handleClose();
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
const listener = window.addEventListener("keydown", _handleEscape, true);
|
||||
return () => window.removeEventListener("keydown", listener);
|
||||
}, []);
|
||||
|
||||
const showHideClassName = visible
|
||||
? classes.displayBlock
|
||||
: classes.displayNone;
|
||||
|
||||
return (
|
||||
<div className={showHideClassName}>
|
||||
<Paper className={classes.root}>{children}</Paper>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Modal;
|
||||
@@ -1470,6 +1470,17 @@
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.4"
|
||||
|
||||
"@material-ui/lab@^4.0.0-alpha.56":
|
||||
version "4.0.0-alpha.56"
|
||||
resolved "https://registry.yarnpkg.com/@material-ui/lab/-/lab-4.0.0-alpha.56.tgz#ff63080949b55b40625e056bbda05e130d216d34"
|
||||
integrity sha512-xPlkK+z/6y/24ka4gVJgwPfoCF4RCh8dXb1BNE7MtF9bXEBLN/lBxNTK8VAa0qm3V2oinA6xtUIdcRh0aeRtVw==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.4"
|
||||
"@material-ui/utils" "^4.10.2"
|
||||
clsx "^1.0.4"
|
||||
prop-types "^15.7.2"
|
||||
react-is "^16.8.0"
|
||||
|
||||
"@material-ui/styles@^4.10.0":
|
||||
version "4.10.0"
|
||||
resolved "https://registry.yarnpkg.com/@material-ui/styles/-/styles-4.10.0.tgz#2406dc23aa358217aa8cc772e6237bd7f0544071"
|
||||
@@ -4362,6 +4373,14 @@ elliptic@^6.5.3:
|
||||
minimalistic-assert "^1.0.0"
|
||||
minimalistic-crypto-utils "^1.0.0"
|
||||
|
||||
emoji-mart@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/emoji-mart/-/emoji-mart-3.0.0.tgz#eca24a04881e27752a6921e09f65a86ce8539a50"
|
||||
integrity sha512-r5DXyzOLJttdwRYfJmPq/XL3W5tiAE/VsRnS0Hqyn27SqPA/GOYwVUSx50px/dXdJyDSnvmoPbuJ/zzhwSaU4A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.0.0"
|
||||
prop-types "^15.6.0"
|
||||
|
||||
emoji-regex@^7.0.1, emoji-regex@^7.0.2:
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
|
||||
@@ -9304,7 +9323,7 @@ prompts@^2.0.1:
|
||||
kleur "^3.0.3"
|
||||
sisteransi "^1.0.4"
|
||||
|
||||
prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
|
||||
prop-types@^15.6.0, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2:
|
||||
version "15.7.2"
|
||||
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5"
|
||||
integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==
|
||||
@@ -11415,6 +11434,11 @@ uuid@^3.3.2, uuid@^3.4.0:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
||||
uuid@^8.3.0:
|
||||
version "8.3.0"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.0.tgz#ab738085ca22dc9a8c92725e459b1d507df5d6ea"
|
||||
integrity sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==
|
||||
|
||||
v8-compile-cache@^2.0.3, v8-compile-cache@^2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.1.tgz#54bc3cdd43317bca91e35dcaf305b1a7237de745"
|
||||
|
||||
@@ -149,6 +149,18 @@ function noPhone()
|
||||
ESX.ShowNotification('Oi Mate, No El Telephono')
|
||||
end
|
||||
|
||||
function sendPhoneConfig()
|
||||
ESX.TriggerServerCallback('phone:phoneConfig', function(config)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = "PHONE",
|
||||
method = "phoneConfig",
|
||||
data = config
|
||||
}
|
||||
)
|
||||
end)
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(0)
|
||||
@@ -158,6 +170,7 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
function Phone() --Open/close phone
|
||||
if Config.PhoneAsItem == true then
|
||||
--print("ConfigOn")
|
||||
@@ -178,6 +191,7 @@ function Phone() --Open/close phone
|
||||
data = true
|
||||
}
|
||||
)
|
||||
sendPhoneConfig()
|
||||
SetNuiFocus(true, true)
|
||||
else
|
||||
isPhoneOpen = false
|
||||
@@ -213,6 +227,7 @@ function Phone() --Open/close phone
|
||||
data = true
|
||||
}
|
||||
)
|
||||
sendPhoneConfig()
|
||||
SetNuiFocus(true, true)
|
||||
else
|
||||
isPhoneOpen = false
|
||||
@@ -234,7 +249,6 @@ RegisterCommand('phone', function(source) -- Toggles Phone
|
||||
Phone()
|
||||
end, false)
|
||||
|
||||
|
||||
RegisterNetEvent('phone:send')
|
||||
AddEventHandler('phone:send', function()
|
||||
TriggerEvent('phone:sendContacts')
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
ESX = nil
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while ESX == nil do
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
Citizen.Wait(0)
|
||||
end
|
||||
end)
|
||||
|
||||
local APP_NAME = 'TWITTER'
|
||||
|
||||
function sendTwitterMessage(method, data)
|
||||
SendNUIMessage(
|
||||
{
|
||||
app = APP_NAME,
|
||||
method = method,
|
||||
data = data
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
RegisterNetEvent('phone:fetchTweets')
|
||||
AddEventHandler('phone:fetchTweets', function()
|
||||
ESX.TriggerServerCallback('phone:fetchTweets', function(tweets)
|
||||
sendTwitterMessage('fetchTweets', tweets)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('phone:fetchTweetsFiltered')
|
||||
AddEventHandler('phone:fetchTweetsFiltered', function(searchValue)
|
||||
ESX.TriggerServerCallback('phone:fetchTweetsFiltered', function(tweets)
|
||||
sendTwitterMessage('fetchTweetsFiltered', tweets)
|
||||
end, searchValue)
|
||||
end)
|
||||
|
||||
|
||||
RegisterNUICallback('phone:fetchTweets', function()
|
||||
TriggerEvent('phone:fetchTweets')
|
||||
end)
|
||||
|
||||
|
||||
RegisterNUICallback('phone:fetchTweetsFiltered', function(searchValue)
|
||||
TriggerEvent('phone:fetchTweetsFiltered', searchValue)
|
||||
end)
|
||||
|
||||
|
||||
RegisterNUICallback('phone:createTweet', function(data)
|
||||
sendTwitterMessage('createTweetLoading', true)
|
||||
ESX.TriggerServerCallback('phone:createTweet', function(isSuccessful)
|
||||
sendTwitterMessage('createTweetResult', isSuccessful)
|
||||
TriggerEvent('phone:fetchTweets')
|
||||
end, data)
|
||||
end)
|
||||
|
||||
|
||||
function getOrCreateTwitterProfile()
|
||||
ESX.TriggerServerCallback('phone:getOrCreateTwitterProfile', function(profile)
|
||||
sendTwitterMessage('getOrCreateTwitterProfile', profile)
|
||||
end)
|
||||
end
|
||||
|
||||
-- called directly from the UI on app load
|
||||
RegisterNUICallback('phone:getOrCreateTwitterProfile', function()
|
||||
getOrCreateTwitterProfile()
|
||||
end)
|
||||
|
||||
-- called during subsequent updates
|
||||
RegisterNetEvent('phone:getOrCreateTwitterProfile')
|
||||
AddEventHandler('phone:getOrCreateTwitterProfile', function()
|
||||
getOrCreateTwitterProfile()
|
||||
end)
|
||||
|
||||
RegisterNUICallback('phone:updateTwitterProfile', function(data)
|
||||
sendTwitterMessage('updateProfileLoading', true)
|
||||
ESX.TriggerServerCallback('phone:updateTwitterProfile', function(result)
|
||||
sendTwitterMessage('updateProfileResult', result)
|
||||
TriggerEvent('phone:getOrCreateTwitterProfile')
|
||||
end, data)
|
||||
end)
|
||||
@@ -4,7 +4,7 @@ Config.Locale = 'en'
|
||||
|
||||
Config.KeyTogglePhone = 288 -- F1
|
||||
Config.KeyTakeCall = 38 -- E
|
||||
Config.PhoneAsItem = true
|
||||
Config.PhoneAsItem = false
|
||||
|
||||
------
|
||||
--Destroy Phone
|
||||
@@ -16,4 +16,18 @@ Config.RunRate = 10 --SECONDS /// Will do the initial thread every X SECONDS to
|
||||
|
||||
Config.DestoryChance = 100 --PERCENT BASED /// from 0 to 100 where 100 is equal to 100% chance and 10 is equal to 10%. This is dependent on the amount above so dont set it too low.
|
||||
|
||||
Config.DestroyPhoneReCheck = 3 --MINUTES /// WIll wait the check for x MINUTES as they have no phone now and have been given a destroyed phone = to the number of phones they had.
|
||||
Config.DestroyPhoneReCheck = 3 --MINUTES /// WIll wait the check for x MINUTES as they have no phone now and have been given a destroyed phone = to the number of phones they had.
|
||||
|
||||
|
||||
------
|
||||
--Twitter
|
||||
------
|
||||
Config.twitter = {}
|
||||
Config.twitter.generateProfileNameFromUsers = true -- if the player's profile name should be generated from the users.first_name and users.last_name table
|
||||
Config.twitter.characterLimit = 240 -- character limit on tweet messages
|
||||
Config.twitter.allowEdtiableProfileName = true -- whether or not players can edit their profile names
|
||||
-- Config.twitter.enableLikes = true -- whether or not players can like other player's tweets and that they are visible
|
||||
Config.twitter.enableAvatars = true -- whether or not player avatars are visible and editable
|
||||
Config.twitter.enableEmojis = true -- whether or not the emoji menu is available
|
||||
Config.twitter.enableImages = true -- whether or not links to images are rendered on the UI and if players can add new ones
|
||||
Config.twitter.maxImages = 3 -- max amount of images that can be attached to a single tweet
|
||||
@@ -1,9 +1,9 @@
|
||||
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=213)}([function(e,t,n){"use strict";e.exports=n(400)},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){var r=n(9),o=n(17),i=n(34),a=n(30),u=n(37),l=function(e,t,n){var s,c,f,d,p=e&l.F,h=e&l.G,v=e&l.S,m=e&l.P,g=e&l.B,y=h?r:v?r[t]||(r[t]={}):(r[t]||{}).prototype,b=h?o:o[t]||(o[t]={}),w=b.prototype||(b.prototype={});for(s in h&&(n=t),n)f=((c=!p&&y&&void 0!==y[s])?y:n)[s],d=g&&c?u(f,r):m&&"function"==typeof f?u(Function.call,f):f,y&&a(y,s,f,e&l.U),b[s]!=f&&i(b,s,d),m&&w[s]!=f&&(w[s]=f)};r.core=o,l.F=1,l.G=2,l.S=4,l.P=8,l.B=16,l.W=32,l.U=64,l.R=128,e.exports=l},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(28);function o(e,t){if(null==e)return{};var n,o,i=Object(r.a)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},function(e,t,n){"use strict";function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n);else for(t in e)e[t]&&(o&&(o+=" "),o+=t);return o}t.a=function(){for(var e,t,n=0,o="";n<arguments.length;)(e=arguments[n++])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o}},function(e,t,n){e.exports=n(410)()},function(e,t,n){"use strict";var r=n(1),o=n(3),i=n(0),a=n.n(i),u=(n(5),n(71)),l=n.n(u),s=n(454),c=n(453),f=n(452),d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(n){var i=t.defaultTheme,u=t.withTheme,d=void 0!==u&&u,p=t.name,h=Object(o.a)(t,["defaultTheme","withTheme","name"]);var v=p,m=Object(s.a)(e,Object(r.a)({defaultTheme:i,Component:n,name:p||n.displayName,classNamePrefix:v},h)),g=a.a.forwardRef((function(e,t){e.classes;var u,l=e.innerRef,s=Object(o.a)(e,["classes","innerRef"]),h=m(Object(r.a)(Object(r.a)({},n.defaultProps),e)),v=s;return("string"==typeof p||d)&&(u=Object(f.a)()||i,p&&(v=Object(c.a)({theme:u,name:p,props:s})),d&&!v.theme&&(v.theme=u)),a.a.createElement(n,Object(r.a)({ref:l||t,classes:h},v))}));return l()(g,n),g}},p=n(52);t.a=function(e,t){return d(e,Object(r.a)({defaultTheme:p.a},t))}},function(e,t,n){"use strict";e.exports=n(409)},function(e,t,n){"use strict";function r(e,t){return function(){return null}}n.r(t),n.d(t,"chainPropTypes",(function(){return r})),n.d(t,"deepmerge",(function(){return o.a})),n.d(t,"elementAcceptingRef",(function(){return l})),n.d(t,"elementTypeAcceptingRef",(function(){return s})),n.d(t,"exactProp",(function(){return c})),n.d(t,"formatMuiErrorMessage",(function(){return f.a})),n.d(t,"getDisplayName",(function(){return y})),n.d(t,"HTMLElementType",(function(){return b})),n.d(t,"ponyfillGlobal",(function(){return w})),n.d(t,"refType",(function(){return x}));var o=n(134),i=n(5),a=n.n(i);var u=(a.a.element,function(){return null});u.isRequired=(a.a.element.isRequired,function(){return null});var l=u;var s=(i.elementType,function(){return null});n(32),n(1);function c(e){return e}var f=n(92),d=n(23),p=n(48),h=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function v(e){var t="".concat(e).match(h);return t&&t[1]||""}function m(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.displayName||e.name||v(e)||t}function g(e,t,n){var r=m(t);return e.displayName||(""!==r?"".concat(n,"(").concat(r,")"):n)}function y(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return m(e,"Component");if("object"===Object(d.a)(e))switch(e.$$typeof){case p.ForwardRef:return g(e,e.render,"ForwardRef");case p.Memo:return g(e,e.type,"memo");default:return}}}function b(e,t,n,r,o){return null}var w="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),x=a.a.oneOfType([a.a.func,a.a.object])},function(e,t){var n=e.exports="undeLine truncated
|
||||
!function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=239)}([function(e,t,r){"use strict";e.exports=r(426)},function(e,t,r){"use strict";function a(){return(a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return a}))},function(e,t,r){e.exports=r(436)()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var a=r(37);function n(e,t){if(null==e)return{};var r,n,i=Object(a.a)(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}},function(e,t,r){var a=r(12),n=r(25),i=r(42),o=r(39),u=r(47),s=function(e,t,r){var l,f,d,c,_=e&s.F,h=e&s.G,g=e&s.S,F=e&s.P,m=e&s.B,p=h?a:g?a[t]||(a[t]={}):(a[t]||{}).prototype,b=h?n:n[t]||(n[t]={}),y=b.prototype||(b.prototype={});for(l in h&&(r=t),r)d=((f=!_&&p&&void 0!==p[l])?p:r)[l],c=m&&f?u(d,a):F&&"function"==typeof d?u(Function.call,d):d,p&&o(p,l,d,e&s.U),b[l]!=d&&i(b,l,c),F&&y[l]!=d&&(y[l]=d)};a.core=n,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,r){"use strict";e.exports=r(435)},function(e,t,r){"use strict";function a(e){var t,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=a(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}t.a=function(){for(var e,t,r=0,n="";r<arguments.length;)(e=arguments[r++])&&(t=a(e))&&(n&&(n+=" "),n+=t);return n}},function(e,t,r){"use strict";var a=r(1),n=r(3),i=r(0),o=r.n(i),u=(r(2),r(81)),s=r.n(u),l=r(488),f=r(487),d=r(486),c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r){var i=t.defaultTheme,u=t.withTheme,c=void 0!==u&&u,_=t.name,h=Object(n.a)(t,["defaultTheme","withTheme","name"]);var g=_,F=Object(l.a)(e,Object(a.a)({defaultTheme:i,Component:r,name:_||r.displayName,classNamePrefix:g},h)),m=o.a.forwardRef((function(e,t){e.classes;var u,s=e.innerRef,l=Object(n.a)(e,["classes","innerRef"]),h=F(Object(a.a)(Object(a.a)({},r.defaultProps),e)),g=l;return("string"==typeof _||c)&&(u=Object(d.a)()||i,_&&(g=Object(f.a)({theme:u,name:_,props:l})),c&&!g.theme&&(g.theme=u)),o.a.createElement(r,Object(a.a)({ref:s||t,classes:h},g))}));return s()(m,r),m}},_=r(62);t.a=function(e,t){return c(e,Object(a.a)({defaultTheme:_.a},t))}},,function(e,t,r){"use strict";function a(e,t){return function(){return null}}r.r(t),r.d(t,"chainPropTypes",(function(){return a})),r.d(t,"deepmerge",(function(){return n.a})),r.d(t,"elementAcceptingRef",(function(){return s})),r.d(t,"elementTypeAcceptingRef",(function(){return l})),r.d(t,"exactProp",(function(){return f})),r.d(t,"formatMuiErrorMessage",(function(){return d.a})),r.d(t,"getDisplayName",(function(){return p})),r.d(t,"HTMLElementType",(function(){return b})),r.d(t,"ponyfillGlobal",(function(){return y})),r.d(t,"refType",(function(){return k}));var n=r(150),i=r(2),o=r.n(i);var u=(o.a.element,function(){return null});u.isRequired=(o.a.element.isRequired,function(){return null});var s=u;var l=(i.elementType,function(){return null});r(24),r(1);function f(e){return e}var d=r(107),c=r(34),_=r(58),h=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function g(e){var t="".concat(e).match(h);return t&&t[1]||""}function F(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e.displayName||e.name||g(e)||t}function m(e,t,r){var a=F(t);return e.displayName||(""!==a?"".concat(r,"(").concat(a,")"):r)}function p(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return F(e,"Component");if("object"===Object(c.a)(e))switch(e.$$typeof){case _.ForwardRef:return m(e,e.render,"ForwardRef");case _.Memo:return m(e,e.type,"memo");default:return}}}function b(e,t,r,a,n){return null}var y="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),k=o.a.oneOfType([o.a.func,o.a.object])},function(e,t,r){"use strict";r.dLine truncated
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,u,l=a(e),s=1;s<arguments.length;s++){for(var c in n=Object(arguments[s]))o.call(n,c)&&(l[c]=n[c]);if(r){u=r(n);for(var f=0;f<u.length;f++)i.call(n,u[f])&&(l[u[f]]=n[u[f]])}}return l}},function(e,t,n){"use strict";var r=n(1),o=n(3),i=n(0),a=(n(5),n(4)),u=n(6),l=n(14),s=i.forwardRef((function(e,t){var n=e.children,u=e.classes,s=e.className,c=e.color,f=void 0===c?"inherit":c,d=e.component,p=void 0===d?"svg":d,h=e.fontSize,v=void 0===h?"default":h,m=e.htmlColor,g=e.titleAccess,y=e.viewBox,b=void 0===y?"0 0 24 24":y,w=Object(o.a)(e,["children","classes","className","color","component","fontSize","htmlColor","titleAccess","viewBox"]);return i.createElement(p,Object(r.a)({className:Object(a.a)(u.root,s,"inherit"!==f&&u["color".concat(Object(l.a)(f))],"default"!==v&&u["fontSize".concat(Object(l.a)(v))]),focusable:"false",viewBox:b,color:m,"aria-hidden":!g||void 0,role:g?"img":void 0,ref:t},w),n,g?i.createElement("title",null,g):null)}));s.muiName="SvgIcon",t.a=Object(u.a)((function(e){return{root:{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0,fontSize:e.typography.pxToRem(24),transition:e.transitions.create("fill",{duration:e.transitions.duration.shorter})},colorPrimary:{color:e.palette.primary.main},colorSecondary:{color:e.palette.secondary.main},colorAction:{color:e.palette.action.active},colorError:{color:e.palette.error.main},colorDisabled:{color:e.palette.action.disabled},fontSizeInherit:{fontSize:"inherit"},fontSizeSmall:{fontSize:e.typography.pxToRem(20)},fontSizeLarge:{fontSize:e.typography.pxToRem(35)}}}),{name:"MuiSvgIcon"})(s)},function(e,t,n){"use strict";n.r(t);var r=n(178);n.d(t,"default",(function(){return r.a}))},function(e){e.exports=JSON.parse('{"translation":{"COMING_SOON":"Coming soon...","APPS_DIALER":"Phone","APPS_CONTACTS":"Contacts","APPS_MESSAGES":"Messages","APPS_CALCULATOR":"Calculator","APPS_SETTINGS":"Settings","APPS_BANK":"WhoDis Banking","APPS_BANK_DEPOSIT":"Deposit","APPS_BANK_WITHDRAW":"Withdraw","APPS_BANK_TRANSFER":"Transfer","APPS_SETTINGS_OPTIONS_WALLPAPER":"Wallpaper","APPS_SETTINGS_OPTIONS_FRAME":"Frame"}}')},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e){e.exports=JSON.parse('{"wallpaper":"default.png","frame":"default.png","theme":"default-dark"}')},function(e){e.exports=JSON.parse('{"4gNetowrk":"AT&T","language":"en_US","wallpapers":["default.png","dragon.jpg","legacy.jpg"],"frames":["default.png","s10.png"],"themes":{"default-dark":{"palette":{"type":"dark"}},"default-light":{"palette":{"type":"light"}}}}')},function(e,t,n){"use strict";function r(e){if(Array.isArray(e))return e}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}n.d(t,"a",(function(){return r}))},function(e,t,n){var r=n(415),o=n(416),i=n(417),a=n(419);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||a()}},function(e,t,n){"use strict";var r=n(24);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(0)),i=(0,r(n(27)).default)(o.default.createElement("path",{d:"M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2zm13.54-7.1l-.71-.7L13 9.29V5h-1v6h6v-1h-4.15z"}),"PhoneCallback");t.default=i},function(e,t,n){"use strict";var r=n(24);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=r(n(0)),i=(0,r(n(27)).default)(o.default.createElement("path",{d:"M18 11l5-5-5-5v3h-4v4h4v3zm2 4.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.Line truncated
|
||||
*/var a=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach((function(e){a[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},a)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,u,s=o(e),l=1;l<arguments.length;l++){for(var f in r=Object(arguments[l]))n.call(r,f)&&(s[f]=r[f]);if(a){u=a(r);for(var d=0;d<u.length;d++)i.call(r,u[d])&&(s[u[d]]=r[u[d]])}}return s}},function(e,t,r){"use strict";var a=r(1),n=r(3),i=r(0),o=(r(2),r(6)),u=r(7),s=r(10),l=i.forwardRef((function(e,t){var r=e.children,u=e.classes,l=e.className,f=e.color,d=void 0===f?"inherit":f,c=e.component,_=void 0===c?"svg":c,h=e.fontSize,g=void 0===h?"default":h,F=e.htmlColor,m=e.titleAccess,p=e.viewBox,b=void 0===p?"0 0 24 24":p,y=Object(n.a)(e,["children","classes","className","color","component","fontSize","htmlColor","titleAccess","viewBox"]);return i.createElement(_,Object(a.a)({className:Object(o.a)(u.root,l,"inherit"!==d&&u["color".concat(Object(s.a)(d))],"default"!==g&&u["fontSize".concat(Object(s.a)(g))]),focusable:"false",viewBox:b,color:F,"aria-hidden":!m||void 0,role:m?"img":void 0,ref:t},y),r,m?i.createElement("title",null,m):null)}));l.muiName="SvgIcon",t.a=Object(u.a)((function(e){return{root:{userSelect:"none",width:"1em",height:"1em",display:"inline-block",fill:"currentColor",flexShrink:0,fontSize:e.typography.pxToRem(24),transition:e.transitions.create("fill",{duration:e.transitions.duration.shorter})},colorPrimary:{color:e.palette.primary.main},colorSecondary:{color:e.palette.secondary.main},colorAction:{color:e.palette.action.active},colorError:{color:e.palette.error.main},colorDisabled:{color:e.palette.action.disabled},fontSizeInherit:{fontSize:"inherit"},fontSizeSmall:{fontSize:e.typography.pxToRem(20)},fontSizeLarge:{fontSize:e.typography.pxToRem(35)}}}),{name:"MuiSvgIcon"})(l)},function(e,t,r){"use strict";r.r(t);var a=r(193);r.d(t,"default",(function(){return a.a}))},function(e){e.exports=JSON.parse('{"translation":{"COMING_SOON":"Coming soon...","APPS_DIALER":"Phone","APPS_CONTACTS":"Contacts","APPS_MESSAGES":"Messages","APPS_CALCULATOR":"Calculator","APPS_SETTINGS":"Settings","APPS_BANK":"WhoDis Banking","APPS_EXAMPLE":"Example app","APPS_BANK_DEPOSIT":"Deposit","APPS_BANK_WITHDRAW":"Withdraw","APPS_BANK_TRANSFER":"Transfer","APPS_SETTINGS_OPTIONS_WALLPAPER":"Wallpaper","APPS_SETTINGS_OPTIONS_FRAME":"Frame","APPS_TWITTER":"Twitter","APPS_TWITTER_TWEET":"Tweet","APPS_TWITTER_TWEET_MESSAGE_PLACEHOLDER":"What\'s happening?","APPS_TWITTER_IMAGE_PLACEHOLDER":"A link to your image or gif","APPS_TWITTER_SUBMIT_IMAGE":"Add Media","APPS_TWITTER_CLOSE_IMAGE":"Close","APPS_TWITTER_CLOSE":"Close","APPS_TWITTER_SEARCH_TWEETS":"Search for tweets","APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER":"Search by profile name or message","APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT":"Message is over the character limit","APPS_TWITTER_CREATE_SUCCESS":"Successfully sent your tweet","APPS_TWITTER_CREATE_FAILED":"Failed to send your tweet","APPS_TWITTER_EDIT_PROFILE_AVATAR":"Avatar URL","APPS_TWITTER_EDIT_PROFILE_NAME":"Profile name","APPS_TWITTER_EDIT_PROFILE_BIO":"Bio","APPS_TWITTER_EDIT_PROFILE_LOCATION":"Location","APPS_TWITTER_EDIT_PROFILE_JOB":"Job","APPS_TWITTER_EDIT_PROFILE_SUCCESS":"Successfully updated your profile","APPS_TWITTER_EDIT_PROFILE_FAILURE":"Failed to update your profile","APPS_TWITTER_TIME_JUST_NOW":"Just now","APPS_TWITTER_TIME_MINUTES":"m","APPS_TWITTER_TIME_HOURS":"h","APPS_TWITTER_TIME_DAYS":"d"}}')},function(e){e.exports=JSON.parse('{"wallpaper":"default.png","frame":"s10.png","theme":"default-dark"}')},function(e){e.exports=JSON.parse('{"4gNetowrk":"AT&T","language":"en_US","wallpapers":["default.png","dragon.jpg","legacy.jpg"],"frames":["default.png","s10.png"],"themes":{"default-dark":{"palette":{"type":"dark"}},"default-light":{"palette":{"type":"light"}}}}')},function(e,t,r){"use strict";function a(e){if(Array.isArray(e))return e}r.d(t,"a",(function(){return a}))},function(e,t,r){"use strict";function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}r.d(t,"a",(function(){return a}))},function(e,t,r){"use strict";function a(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}r.d(t,"a",(function(){return a}))},function(e,t,r){var a=r(438),n=r(439),i=r(440),o=r(442);e.exports=function(e,t){return a(e)||n(e,t)||i(e,t)||o()}},function(e,t,r){"use striLine truncated
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
@@ -11,7 +11,7 @@ object-assign
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var r=n(177),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,a=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,s=o?Symbol.for("react.profiler"):60114,c=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,d=o?Symbol.for("react.forward_ref"):60112,p=o?Symbol.for("react.suspense"):60113,h=o?Symbol.for("react.memo"):60115,v=o?Symbol.for("react.lazy"):60116,m="function"==typeof Symbol&&Symbol.iterator;function g(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b={};function w(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}function x(){}function S(e,t,n){this.props=e,this.context=t,this.refs=b,this.updater=n||y}w.prototype.isReactComponent={},w.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(g(85));this.updater.enqueueSetState(this,e,t,"setState")},w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},x.prototype=w.prototype;var E=S.prototype=new x;E.constructor=S,r(E,w.prototype),E.isPureReactComponent=!0;var O={current:null},k=Object.prototype.hasOwnProperty,j={key:!0,ref:!0,__self:!0,__source:!0};function T(e,t,n){var r,o={},a=null,u=null;if(null!=t)for(r in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(a=""+t.key),t)k.call(t,r)&&!j.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){for(var s=Array(l),c=0;c<l;c++)s[c]=arguments[c+2];o.children=s}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===o[r]&&(o[r]=l[r]);return{$$typeof:i,type:e,key:a,ref:u,props:o,_owner:O.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var P=/\/+/g,R=[];function A(e,t,n,r){if(R.length){var o=R.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function N(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>R.length&&R.push(e)}function _(e,t,n){return null==e?0:function e(t,n,r,o){var u=typeof t;"undefined"!==u&&"boolean"!==u||(t=null);var l=!1;if(null===t)l=!0;else switch(u){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case i:case a:l=!0}}if(l)return r(o,t,""===n?"."+M(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;s<t.length;s++){var c=n+M(u=t[s],s);l+=e(u,c,r,o)}else if(null===t||"object"!=typeof t?c=null:c="function"==typeof(c=m&&t[m]||t["@@iterator"])?c:null,"function"==typeof c)for(t=c.call(t),s=0;!(u=t.next()).done;)l+=e(u=u.value,c=n+M(u,s++),r,o);else if("object"===u)throw r=""+t,Error(g(31,"[object Object]"===r?"object with keys {"+Object.keys(t).join(", ")+"}":r,""));return l}(e,"",t,n)}function M(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function L(e,t){e.func.call(e.context,t,e.count++)}function I(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?F(e,r,n,(function(e){return e})):null!=e&&(C(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(P,"$&/")+"/")+n)),r.push(e))}function F(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(P,"$&/")+"/"),_(e,I,t=A(t,i,r,o)),N(t)}var z={current:null};function D(){var e=z.current;if(null===e)throw Error(g(321));return e}var V={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:O,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:function(e,t,n){if(null==e)return e;var r=[];return F(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;_(e,L,t=A(null,null,t,n)),N(t)},count:function(e){return _(e,(function(){return null}),null)},toArray:function(e){var t=[];return F(e,t,null,(function(e){return e})),t},only:function(e){if(!C(e))throw Error(g(143));return e}},t.Component=w,t.Fragment=u,t.Profiler=s,t.PureComponent=S,t.StrictMode=l,t.Suspense=p,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V,t.cloneElement=function(e,t,n){if(null==e)throw Error(g(267,e));var o=r({},e.props),a=e.key,u=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,l=O.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)k.call(t,c)&&!j.hasOwnProperty(c)&&(o[c]=void 0===t[c]&&void 0!==s?s[c]:t[c])}var c=arguments.length-2;if(1===c)o.children=n;else if(1<c){s=Array(c);for(var f=0;f<c;f++)s[f]=arguments[f+2];o.children=s}return{$$typeof:i,tLine truncated
|
||||
*/var a=r(192),n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,u=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,f=n?Symbol.for("react.provider"):60109,d=n?Symbol.for("react.context"):60110,c=n?Symbol.for("react.forward_ref"):60112,_=n?Symbol.for("react.suspense"):60113,h=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,F="function"==typeof Symbol&&Symbol.iterator;function m(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var p={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b={};function y(e,t,r){this.props=e,this.context=t,this.refs=b,this.updater=r||p}function k(){}function v(e,t,r){this.props=e,this.context=t,this.refs=b,this.updater=r||p}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(m(85));this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},k.prototype=y.prototype;var w=v.prototype=new k;w.constructor=v,a(w,y.prototype),w.isPureReactComponent=!0;var E={current:null},D=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,r){var a,n={},o=null,u=null;if(null!=t)for(a in void 0!==t.ref&&(u=t.ref),void 0!==t.key&&(o=""+t.key),t)D.call(t,a)&&!x.hasOwnProperty(a)&&(n[a]=t[a]);var s=arguments.length-2;if(1===s)n.children=r;else if(1<s){for(var l=Array(s),f=0;f<s;f++)l[f]=arguments[f+2];n.children=l}if(e&&e.defaultProps)for(a in s=e.defaultProps)void 0===n[a]&&(n[a]=s[a]);return{$$typeof:i,type:e,key:o,ref:u,props:n,_owner:E.current}}function j(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var S=/\/+/g,O=[];function B(e,t,r,a){if(O.length){var n=O.pop();return n.result=e,n.keyPrefix=t,n.func=r,n.context=a,n.count=0,n}return{result:e,keyPrefix:t,func:r,context:a,count:0}}function q(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>O.length&&O.push(e)}function A(e,t,r){return null==e?0:function e(t,r,a,n){var u=typeof t;"undefined"!==u&&"boolean"!==u||(t=null);var s=!1;if(null===t)s=!0;else switch(u){case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case i:case o:s=!0}}if(s)return a(n,t,""===r?"."+T(t,0):r),1;if(s=0,r=""===r?".":r+":",Array.isArray(t))for(var l=0;l<t.length;l++){var f=r+T(u=t[l],l);s+=e(u,f,a,n)}else if(null===t||"object"!=typeof t?f=null:f="function"==typeof(f=F&&t[F]||t["@@iterator"])?f:null,"function"==typeof f)for(t=f.call(t),l=0;!(u=t.next()).done;)s+=e(u=u.value,f=r+T(u,l++),a,n);else if("object"===u)throw a=""+t,Error(m(31,"[object Object]"===a?"object with keys {"+Object.keys(t).join(", ")+"}":a,""));return s}(e,"",t,r)}function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function P(e,t){e.func.call(e.context,t,e.count++)}function R(e,t,r){var a=e.result,n=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?M(e,a,r,(function(e){return e})):null!=e&&(j(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,n+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(S,"$&/")+"/")+r)),a.push(e))}function M(e,t,r,a,n){var i="";null!=r&&(i=(""+r).replace(S,"$&/")+"/"),A(e,R,t=B(t,i,a,n)),q(t)}var N={current:null};function L(){var e=N.current;if(null===e)throw Error(m(321));return e}var I={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:E,IsSomeRendererActing:{current:!1},assign:a};t.Children={map:function(e,t,r){if(null==e)return e;var a=[];return M(e,a,null,t,r),a},forEach:function(e,t,r){if(null==e)return e;A(e,P,t=B(null,null,t,r)),q(t)},count:function(e){return A(e,(function(){return null}),null)},toArray:function(e){var t=[];return M(e,t,null,(function(e){return e})),t},only:function(e){if(!j(e))throw Error(m(143));return e}},t.Component=y,t.Fragment=u,t.Profiler=l,t.PureComponent=v,t.StrictMode=s,t.Suspense=_,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,r){if(null==e)throw Error(m(267,e));var n=a({},e.props),o=e.key,u=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(u=t.ref,s=E.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(f in t)D.call(t,f)&&!x.hasOwnProperty(f)&&(n[f]=void 0===t[f]&&void 0!==l?l[f]:t[f])}var f=arguments.length-2;if(1===f)n.children=r;else if(1<f){l=Array(f);for(var d=0;d<f;d++)l[d]=arguments[d+2];n.children=l}return{$$typeof:i,tLine truncated
|
||||
/** @license React v16.13.1
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
@@ -19,7 +19,7 @@ object-assign
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var r=n(0),o=n(177),i=n(402);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!r)throw Error(a(227));function u(e,t,n,r,o,i,a,u,l){var s=Array.prototype.slice.call(arguments,3);try{t.apply(n,s)}catch(e){this.onError(e)}}var l=!1,s=null,c=!1,f=null,d={onError:function(e){l=!0,s=e}};function p(e,t,n,r,o,i,a,c,f){l=!1,s=null,u.apply(d,arguments)}var h=null,v=null,m=null;function g(e,t,n){var r=e.type||"unknown-event";e.currentTarget=m(n),function(e,t,n,r,o,i,u,d,h){if(p.apply(this,arguments),l){if(!l)throw Error(a(198));var v=s;l=!1,s=null,c||(c=!0,f=v)}}(r,t,void 0,e),e.currentTarget=null}var y=null,b={};function w(){if(y)for(var e in b){var t=b[e],n=y.indexOf(e);if(!(-1<n))throw Error(a(96,e));if(!S[n]){if(!t.extractEvents)throw Error(a(97,e));for(var r in S[n]=t,n=t.eventTypes){var o=void 0,i=n[r],u=t,l=r;if(E.hasOwnProperty(l))throw Error(a(99,l));E[l]=i;var s=i.phasedRegistrationNames;if(s){for(o in s)s.hasOwnProperty(o)&&x(s[o],u,l);o=!0}else i.registrationName?(x(i.registrationName,u,l),o=!0):o=!1;if(!o)throw Error(a(98,r,e))}}}}function x(e,t,n){if(O[e])throw Error(a(100,e));O[e]=t,k[e]=t.eventTypes[n].dependencies}var S=[],E={},O={},k={};function j(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];if(!b.hasOwnProperty(t)||b[t]!==r){if(b[t])throw Error(a(102,t));b[t]=r,n=!0}}n&&w()}var T=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),C=null,P=null,R=null;function A(e){if(e=v(e)){if("function"!=typeof C)throw Error(a(280));var t=e.stateNode;t&&(t=h(t),C(e.stateNode,e.type,t))}}function N(e){P?R?R.push(e):R=[e]:P=e}function _(){if(P){var e=P,t=R;if(R=P=null,A(e),t)for(e=0;e<t.length;e++)A(t[e])}}function M(e,t){return e(t)}function L(e,t,n,r,o){return e(t,n,r,o)}function I(){}var F=M,z=!1,D=!1;function V(){null===P&&null===R||(I(),_())}function U(e,t,n){if(D)return e(t,n);D=!0;try{return F(e,t,n)}finally{D=!1,V()}}var B=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,W=Object.prototype.hasOwnProperty,$={},H={};function K(e,t,n,r,o,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i}var q={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){q[e]=new K(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];q[t]=new K(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){q[e]=new K(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){q[e]=new K(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){q[e]=new K(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){q[e]=new K(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){q[e]=new K(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){q[e]=new K(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){q[e]=new K(e,5,!1,e.toLowerCase(),null,!1)}));var G=/[\-:]([a-z])/g;function Q(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-rLine truncated
|
||||
*/var a=r(0),n=r(192),i=r(428);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!a)throw Error(o(227));function u(e,t,r,a,n,i,o,u,s){var l=Array.prototype.slice.call(arguments,3);try{t.apply(r,l)}catch(e){this.onError(e)}}var s=!1,l=null,f=!1,d=null,c={onError:function(e){s=!0,l=e}};function _(e,t,r,a,n,i,o,f,d){s=!1,l=null,u.apply(c,arguments)}var h=null,g=null,F=null;function m(e,t,r){var a=e.type||"unknown-event";e.currentTarget=F(r),function(e,t,r,a,n,i,u,c,h){if(_.apply(this,arguments),s){if(!s)throw Error(o(198));var g=l;s=!1,l=null,f||(f=!0,d=g)}}(a,t,void 0,e),e.currentTarget=null}var p=null,b={};function y(){if(p)for(var e in b){var t=b[e],r=p.indexOf(e);if(!(-1<r))throw Error(o(96,e));if(!v[r]){if(!t.extractEvents)throw Error(o(97,e));for(var a in v[r]=t,r=t.eventTypes){var n=void 0,i=r[a],u=t,s=a;if(w.hasOwnProperty(s))throw Error(o(99,s));w[s]=i;var l=i.phasedRegistrationNames;if(l){for(n in l)l.hasOwnProperty(n)&&k(l[n],u,s);n=!0}else i.registrationName?(k(i.registrationName,u,s),n=!0):n=!1;if(!n)throw Error(o(98,a,e))}}}}function k(e,t,r){if(E[e])throw Error(o(100,e));E[e]=t,D[e]=t.eventTypes[r].dependencies}var v=[],w={},E={},D={};function x(e){var t,r=!1;for(t in e)if(e.hasOwnProperty(t)){var a=e[t];if(!b.hasOwnProperty(t)||b[t]!==a){if(b[t])throw Error(o(102,t));b[t]=a,r=!0}}r&&y()}var C=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),j=null,S=null,O=null;function B(e){if(e=g(e)){if("function"!=typeof j)throw Error(o(280));var t=e.stateNode;t&&(t=h(t),j(e.stateNode,e.type,t))}}function q(e){S?O?O.push(e):O=[e]:S=e}function A(){if(S){var e=S,t=O;if(O=S=null,B(e),t)for(e=0;e<t.length;e++)B(t[e])}}function T(e,t){return e(t)}function P(e,t,r,a,n){return e(t,r,a,n)}function R(){}var M=T,N=!1,L=!1;function I(){null===S&&null===O||(R(),A())}function z(e,t,r){if(L)return e(t,r);L=!0;try{return M(e,t,r)}finally{L=!1,I()}}var W=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,V=Object.prototype.hasOwnProperty,U={},H={};function $(e,t,r,a,n,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=a,this.attributeNamespace=n,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i}var G={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){G[e]=new $(e,0,!1,e,null,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];G[t]=new $(t,1,!1,e[1],null,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){G[e]=new $(e,2,!1,e.toLowerCase(),null,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){G[e]=new $(e,2,!1,e,null,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){G[e]=new $(e,3,!1,e.toLowerCase(),null,!1)})),["checked","multiple","muted","selected"].forEach((function(e){G[e]=new $(e,3,!0,e,null,!1)})),["capture","download"].forEach((function(e){G[e]=new $(e,4,!1,e,null,!1)})),["cols","rows","size","span"].forEach((function(e){G[e]=new $(e,6,!1,e,null,!1)})),["rowSpan","start"].forEach((function(e){G[e]=new $(e,5,!1,e.toLowerCase(),null,!1)}));var K=/[\-:]([a-z])/g;function Y(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-rLine truncated
|
||||
/** @license React v0.19.1
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
@@ -27,7 +27,7 @@ object-assign
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var r,o,i,a,u;if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,s=null,c=function(){if(null!==l)try{var e=t.unstable_now();l(!0,e),l=null}catch(e){throw setTimeout(c,0),e}},f=Date.now();t.unstable_now=function(){return Date.now()-f},r=function(e){null!==l?setTimeout(r,0,e):(l=e,setTimeout(c,0))},o=function(e,t){s=setTimeout(e,t)},i=function(){clearTimeout(s)},a=function(){return!1},u=t.unstable_forceFrameRate=function(){}}else{var d=window.performance,p=window.Date,h=window.setTimeout,v=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof d&&"function"==typeof d.now)t.unstable_now=function(){return d.now()};else{var g=p.now();t.unstable_now=function(){return p.now()-g}}var y=!1,b=null,w=-1,x=5,S=0;a=function(){return t.unstable_now()>=S},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):x=0<e?Math.floor(1e3/e):5};var E=new MessageChannel,O=E.port2;E.port1.onmessage=function(){if(null!==b){var e=t.unstable_now();S=e+x;try{b(!0,e)?O.postMessage(null):(y=!1,b=null)}catch(e){throw O.postMessage(null),e}}else y=!1},r=function(e){b=e,y||(y=!0,O.postMessage(null))},o=function(e,n){w=h((function(){e(t.unstable_now())}),n)},i=function(){v(w),w=-1}}function k(e,t){var n=e.length;e.push(t);e:for(;;){var r=n-1>>>1,o=e[r];if(!(void 0!==o&&0<C(o,t)))break e;e[r]=t,e[n]=o,n=r}}function j(e){return void 0===(e=e[0])?null:e}function T(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length;r<o;){var i=2*(r+1)-1,a=e[i],u=i+1,l=e[u];if(void 0!==a&&0>C(a,n))void 0!==l&&0>C(l,a)?(e[r]=l,e[u]=n,r=u):(e[r]=a,e[i]=n,r=i);else{if(!(void 0!==l&&0>C(l,n)))break e;e[r]=l,e[u]=n,r=u}}}return t}return null}function C(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var P=[],R=[],A=1,N=null,_=3,M=!1,L=!1,I=!1;function F(e){for(var t=j(R);null!==t;){if(null===t.callback)T(R);else{if(!(t.startTime<=e))break;T(R),t.sortIndex=t.expirationTime,k(P,t)}t=j(R)}}function z(e){if(I=!1,F(e),!L)if(null!==j(P))L=!0,r(D);else{var t=j(R);null!==t&&o(z,t.startTime-e)}}function D(e,n){L=!1,I&&(I=!1,i()),M=!0;var r=_;try{for(F(n),N=j(P);null!==N&&(!(N.expirationTime>n)||e&&!a());){var u=N.callback;if(null!==u){N.callback=null,_=N.priorityLevel;var l=u(N.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?N.callback=l:N===j(P)&&T(P),F(n)}else T(P);N=j(P)}if(null!==N)var s=!0;else{var c=j(R);null!==c&&o(z,c.startTime-n),s=!1}return s}finally{N=null,_=r,M=!1}}function V(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var U=u;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){L||M||(L=!0,r(D))},t.unstable_getCurrentPriorityLevel=function(){return _},t.unstable_getFirstCallbackNode=function(){return j(P)},t.unstable_next=function(e){switch(_){case 1:case 2:case 3:var t=3;break;default:t=_}var n=_;_=t;try{return e()}finally{_=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=U,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=_;_=e;try{return t()}finally{_=n}},t.unstable_scheduleCallback=function(e,n,a){var u=t.unstable_now();if("object"==typeof a&&null!==a){var l=a.delay;l="number"==typeof l&&0<l?u+l:u,a="number"==typeof a.timeout?a.timeout:V(e)}else a=V(e),l=u;return e={id:A++,callback:n,priorityLevel:e,startTime:l,expirationTime:a=l+a,sortIndex:-1},l>u?(e.sortIndex=l,k(R,e),null===j(P)&&e===j(R)&&(I?i():I=!0,o(z,l-u))):(e.sortIndex=a,k(P,e),L||M||(L=!0,r(D))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();F(e);var n=j(P);return n!==N&&null!==N&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime<N.expirationTime||a()},t.unstable_wrapCallback=function(e){var t=_;return function(){var n=_;_=t;try{return e.apply(this,arguments)}finally{_=n}}}},function(e,t,n){var r=n(405);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(133)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(132)(!1)).push([e.i,"body {\r\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\r\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\r\n sans-serif;\r\n -webkit-font-smooLine truncated
|
||||
*/var a,n,i,o,u;if("undefined"==typeof window||"function"!=typeof MessageChannel){var s=null,l=null,f=function(){if(null!==s)try{var e=t.unstable_now();s(!0,e),s=null}catch(e){throw setTimeout(f,0),e}},d=Date.now();t.unstable_now=function(){return Date.now()-d},a=function(e){null!==s?setTimeout(a,0,e):(s=e,setTimeout(f,0))},n=function(e,t){l=setTimeout(e,t)},i=function(){clearTimeout(l)},o=function(){return!1},u=t.unstable_forceFrameRate=function(){}}else{var c=window.performance,_=window.Date,h=window.setTimeout,g=window.clearTimeout;if("undefined"!=typeof console){var F=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof F&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof c&&"function"==typeof c.now)t.unstable_now=function(){return c.now()};else{var m=_.now();t.unstable_now=function(){return _.now()-m}}var p=!1,b=null,y=-1,k=5,v=0;o=function(){return t.unstable_now()>=v},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):k=0<e?Math.floor(1e3/e):5};var w=new MessageChannel,E=w.port2;w.port1.onmessage=function(){if(null!==b){var e=t.unstable_now();v=e+k;try{b(!0,e)?E.postMessage(null):(p=!1,b=null)}catch(e){throw E.postMessage(null),e}}else p=!1},a=function(e){b=e,p||(p=!0,E.postMessage(null))},n=function(e,r){y=h((function(){e(t.unstable_now())}),r)},i=function(){g(y),y=-1}}function D(e,t){var r=e.length;e.push(t);e:for(;;){var a=r-1>>>1,n=e[a];if(!(void 0!==n&&0<j(n,t)))break e;e[a]=t,e[r]=n,r=a}}function x(e){return void 0===(e=e[0])?null:e}function C(e){var t=e[0];if(void 0!==t){var r=e.pop();if(r!==t){e[0]=r;e:for(var a=0,n=e.length;a<n;){var i=2*(a+1)-1,o=e[i],u=i+1,s=e[u];if(void 0!==o&&0>j(o,r))void 0!==s&&0>j(s,o)?(e[a]=s,e[u]=r,a=u):(e[a]=o,e[i]=r,a=i);else{if(!(void 0!==s&&0>j(s,r)))break e;e[a]=s,e[u]=r,a=u}}}return t}return null}function j(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}var S=[],O=[],B=1,q=null,A=3,T=!1,P=!1,R=!1;function M(e){for(var t=x(O);null!==t;){if(null===t.callback)C(O);else{if(!(t.startTime<=e))break;C(O),t.sortIndex=t.expirationTime,D(S,t)}t=x(O)}}function N(e){if(R=!1,M(e),!P)if(null!==x(S))P=!0,a(L);else{var t=x(O);null!==t&&n(N,t.startTime-e)}}function L(e,r){P=!1,R&&(R=!1,i()),T=!0;var a=A;try{for(M(r),q=x(S);null!==q&&(!(q.expirationTime>r)||e&&!o());){var u=q.callback;if(null!==u){q.callback=null,A=q.priorityLevel;var s=u(q.expirationTime<=r);r=t.unstable_now(),"function"==typeof s?q.callback=s:q===x(S)&&C(S),M(r)}else C(S);q=x(S)}if(null!==q)var l=!0;else{var f=x(O);null!==f&&n(N,f.startTime-r),l=!1}return l}finally{q=null,A=a,T=!1}}function I(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var z=u;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){P||T||(P=!0,a(L))},t.unstable_getCurrentPriorityLevel=function(){return A},t.unstable_getFirstCallbackNode=function(){return x(S)},t.unstable_next=function(e){switch(A){case 1:case 2:case 3:var t=3;break;default:t=A}var r=A;A=t;try{return e()}finally{A=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=z,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=A;A=e;try{return t()}finally{A=r}},t.unstable_scheduleCallback=function(e,r,o){var u=t.unstable_now();if("object"==typeof o&&null!==o){var s=o.delay;s="number"==typeof s&&0<s?u+s:u,o="number"==typeof o.timeout?o.timeout:I(e)}else o=I(e),s=u;return e={id:B++,callback:r,priorityLevel:e,startTime:s,expirationTime:o=s+o,sortIndex:-1},s>u?(e.sortIndex=s,D(O,e),null===x(S)&&e===x(O)&&(R?i():R=!0,n(N,s-u))):(e.sortIndex=o,D(S,e),P||T||(P=!0,a(L))),e},t.unstable_shouldYield=function(){var e=t.unstable_now();M(e);var r=x(S);return r!==q&&null!==q&&null!==r&&null!==r.callback&&r.startTime<=e&&r.expirationTime<q.expirationTime||o()},t.unstable_wrapCallback=function(e){var t=A;return function(){var r=A;A=t;try{return e.apply(this,arguments)}finally{A=r}}}},function(e,t,r){var a=r(431);"string"==typeof a&&(a=[[e.i,a,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(91)(a,n);a.locals&&(e.exports=a.locals)},function(e,t,r){(e.exports=r(90)(!1)).push([e.i,"body {\r\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\r\n 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\r\n sans-serif;\r\n -webkit-font-smoothLine truncated
|
||||
/** @license React v16.13.1
|
||||
* react-is.production.min.js
|
||||
*
|
||||
@@ -35,11 +35,11 @@ object-assign
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var r="function"==typeof Symbol&&Symbol.for,o=r?Symbol.for("react.element"):60103,i=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,u=r?Symbol.for("react.strict_mode"):60108,l=r?Symbol.for("react.profiler"):60114,s=r?Symbol.for("react.provider"):60109,c=r?Symbol.for("react.context"):60110,f=r?Symbol.for("react.async_mode"):60111,d=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,h=r?Symbol.for("react.suspense"):60113,v=r?Symbol.for("react.suspense_list"):60120,m=r?Symbol.for("react.memo"):60115,g=r?Symbol.for("react.lazy"):60116,y=r?Symbol.for("react.block"):60121,b=r?Symbol.for("react.fundamental"):60117,w=r?Symbol.for("react.responder"):60118,x=r?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case o:switch(e=e.type){case f:case d:case a:case l:case u:case h:return e;default:switch(e=e&&e.$$typeof){case c:case p:case g:case m:case s:return e;default:return t}}case i:return t}}}function E(e){return S(e)===d}t.AsyncMode=f,t.ConcurrentMode=d,t.ContextConsumer=c,t.ContextProvider=s,t.Element=o,t.ForwardRef=p,t.Fragment=a,t.Lazy=g,t.Memo=m,t.Portal=i,t.Profiler=l,t.StrictMode=u,t.Suspense=h,t.isAsyncMode=function(e){return E(e)||S(e)===f},t.isConcurrentMode=E,t.isContextConsumer=function(e){return S(e)===c},t.isContextProvider=function(e){return S(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===o},t.isForwardRef=function(e){return S(e)===p},t.isFragment=function(e){return S(e)===a},t.isLazy=function(e){return S(e)===g},t.isMemo=function(e){return S(e)===m},t.isPortal=function(e){return S(e)===i},t.isProfiler=function(e){return S(e)===l},t.isStrictMode=function(e){return S(e)===u},t.isSuspense=function(e){return S(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===d||e===l||e===u||e===h||e===v||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===s||e.$$typeof===c||e.$$typeof===p||e.$$typeof===b||e.$$typeof===w||e.$$typeof===x||e.$$typeof===y)},t.typeOf=S},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return n}}},function(e,t,n){var r=n(418);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var r=n(422);"string"==typeof r&&(r=[[e.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(133)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){(t=e.exports=n(132)(!1)).push([e.i,"@import url(https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap);",""]),t.push([e.i,"\r\n",""])},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,s=[],c=!1,f=-1;function d(){c&&l&&(c=!1,l.length?s=l.concat(s):f=-1,s.length&&p())}function p(){if(!c){var e=u(d);c=!0;for(var t=s.length;t;){for(l=s,s=[];++f<t;)l&&l[f].run();f=-1,t=s.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=neLine truncated
|
||||
*/var a="function"==typeof Symbol&&Symbol.for,n=a?Symbol.for("react.element"):60103,i=a?Symbol.for("react.portal"):60106,o=a?Symbol.for("react.fragment"):60107,u=a?Symbol.for("react.strict_mode"):60108,s=a?Symbol.for("react.profiler"):60114,l=a?Symbol.for("react.provider"):60109,f=a?Symbol.for("react.context"):60110,d=a?Symbol.for("react.async_mode"):60111,c=a?Symbol.for("react.concurrent_mode"):60111,_=a?Symbol.for("react.forward_ref"):60112,h=a?Symbol.for("react.suspense"):60113,g=a?Symbol.for("react.suspense_list"):60120,F=a?Symbol.for("react.memo"):60115,m=a?Symbol.for("react.lazy"):60116,p=a?Symbol.for("react.block"):60121,b=a?Symbol.for("react.fundamental"):60117,y=a?Symbol.for("react.responder"):60118,k=a?Symbol.for("react.scope"):60119;function v(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case d:case c:case o:case s:case u:case h:return e;default:switch(e=e&&e.$$typeof){case f:case _:case m:case F:case l:return e;default:return t}}case i:return t}}}function w(e){return v(e)===c}t.AsyncMode=d,t.ConcurrentMode=c,t.ContextConsumer=f,t.ContextProvider=l,t.Element=n,t.ForwardRef=_,t.Fragment=o,t.Lazy=m,t.Memo=F,t.Portal=i,t.Profiler=s,t.StrictMode=u,t.Suspense=h,t.isAsyncMode=function(e){return w(e)||v(e)===d},t.isConcurrentMode=w,t.isContextConsumer=function(e){return v(e)===f},t.isContextProvider=function(e){return v(e)===l},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return v(e)===_},t.isFragment=function(e){return v(e)===o},t.isLazy=function(e){return v(e)===m},t.isMemo=function(e){return v(e)===F},t.isPortal=function(e){return v(e)===i},t.isProfiler=function(e){return v(e)===s},t.isStrictMode=function(e){return v(e)===u},t.isSuspense=function(e){return v(e)===h},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===c||e===s||e===u||e===h||e===g||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===F||e.$$typeof===l||e.$$typeof===f||e.$$typeof===_||e.$$typeof===b||e.$$typeof===y||e.$$typeof===k||e.$$typeof===p)},t.typeOf=v},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},function(e,t,r){var a=r(447);"string"==typeof a&&(a=[[e.i,a,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(91)(a,n);a.locals&&(e.exports=a.locals)},function(e,t,r){(t=e.exports=r(90)(!1)).push([e.i,"@import url(https://fonts.googleapis.com/css2?family=Bebas+Neue&display=swap);",""]),t.push([e.i,"\r\n",""])},function(e,t){function r(t,a){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,a)}e.exports=r},function(e,t,r){var a=r(450);"string"==typeof a&&(a=[[e.i,a,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(91)(a,n);a.locals&&(e.exports=a.locals)},function(e,t,r){(e.exports=r(90)(!1)).push([e.i,'/* 00acee is "twitter blue" and we want to use that to override\r\nsome of the Material UI primary theme settings */\r\n\r\n/* override buttons on the tweet modal */\r\n#twitter-app .MuiButton-containedPrimary {\r\n background: #00acee !important;\r\n}\r\n\r\n/* override the bottom navigation active color */\r\n#twitter-app .Mui-selected {\r\n color: #00acee !important;\r\n}\r\n/* override the FAB (action buttons) background when selected */\r\n#twitter-app .MuiFab-primary {\r\n background: #00acee !important;\r\n}\r\n\r\n/* override the labels on text fields */\r\n#twitter-app .MuiInputLabel-formControl.Mui-focused {\r\n color: #00acee !important;\r\n}\r\n\r\n/* override the underlines of text fields */\r\n#twitter-app .Mui-focused:after {\r\n border-bottom-color: #00acee !important;\r\n}\r\n\r\n/*\r\noverride position of the snackbar so that it appears\r\nwithin the phone rather than on the game UI */\r\n#twitter-app .MuiSnackbar-root {\r\n position: absolute;\r\n}\r\n\r\n.emoji-mart {\r\n margin: 0px 15px 8px 15px !important;\r\n width: calc(100% - 30px) !important;\r\n}\r\n\r\n.emoji-mart-bar {\r\n display: none;\r\n}\r\n',""])},function(e,t,r){var a=r(452);"string"==typeof a&&(a=[[e.i,a,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};r(91)(a,n);a.locals&&(e.exports=a.locals)},function(e,t,r){(e.exports=r(90)(!1)).push([e.i,'.emoji-mart,\n.emoji-mart * {\n box-sizing: border-box;\n line-height: 1.15;\n}\n\n.emoji-mart {\n font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;\n font-size: 16px;\n display: inline-block;\n color: #222427;\n border: 1px solid #d9d9d9;\n border-radius: 5px;\n background: #fff;\n}\n\n.emoji-mart .emoji-mart-emoji {\n padding: 6px;\n}\n\n.emoji-mart-bar {\n border: 0 solid #d9d9d9;\n}\n.emoji-mart-bar:first-child {\n border-bottom-width: 1px;\n border-top-left-radius: 5px;\n border-top-right-radius: 5px;\n}\n.emoji-mart-bar:last-child {\n border-top-wiLine truncated
|
||||
/**
|
||||
* A better abstraction over CSS.
|
||||
*
|
||||
* @copyright Oleg Isonen (Slobodskoi) / Isonen 2014-present
|
||||
* @website https://github.com/cssinjs/jss
|
||||
* @license MIT
|
||||
*/var Oe=Date.now(),ke="fnValues"+Oe,je="fnStyle"+ ++Oe;var Te=function(){return{onCreateRule:function(e,t,n){if("function"!=typeof t)return null;var r=v(e,{},n);return r[je]=t,r},onProcessStyle:function(e,t){if(ke in t||je in t)return e;var n={};for(var r in e){var o=e[r];"function"==typeof o&&(delete e[r],n[r]=o)}return t[ke]=n,e},onUpdate:function(e,t,n,r){var o=t,i=o[je];i&&(o.style=i(e)||{});var a=o[ke];if(a)for(var u in a)o.prop(u,a[u](e),r)}}},Ce="@global",Pe=function(){function e(e,t,n){for(var r in this.type="global",this.at=Ce,this.rules=void 0,this.options=void 0,this.key=void 0,this.isProcessed=!1,this.key=e,this.options=n,this.rules=new X(Object(o.a)({},n,{parent:this})),t)this.rules.add(r,t[r]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return this.options.jss.plugins.onProcessRule(r),r},t.indexOf=function(e){return this.rules.indexOf(e)},t.toString=function(){return this.rules.toString()},e}(),Re=function(){function e(e,t,n){this.type="global",this.at=Ce,this.options=void 0,this.rule=void 0,this.isProcessed=!1,this.key=void 0,this.key=e,this.options=n;var r=e.substr("@global ".length);this.rule=n.jss.createRule(r,t,Object(o.a)({},n,{parent:this}))}return e.prototype.toString=function(e){return this.rule?this.rule.toString(e):""},e}(),Ae=/\s*,\s*/g;function Ne(e,t){for(var n=e.split(Ae),r="",o=0;o<n.length;o++)r+=t+" "+n[o].trim(),n[o+1]&&(r+=", ");return r}var _e=function(){return{onCreateRule:function(e,t,n){if(!e)return null;if(e===Ce)return new Pe(e,t,n);if("@"===e[0]&&"@global "===e.substr(0,"@global ".length))return new Re(e,t,n);var r=n.parent;return r&&("global"===r.type||r.options.parent&&"global"===r.options.parent.type)&&(n.scoped=!1),!1===n.scoped&&(n.selector=e),null},onProcessRule:function(e){"style"===e.type&&(function(e){var t=e.options,n=e.style,r=n?n[Ce]:null;if(r){for(var i in r)t.sheet.addRule(i,r[i],Object(o.a)({},t,{selector:Ne(i,e.selector)}));delete n[Ce]}}(e),function(e){var t=e.options,n=e.style;for(var r in n)if("@"===r[0]&&r.substr(0,Ce.length)===Ce){var i=Ne(r.substr(Ce.length),e.selector);t.sheet.addRule(i,n[r],Object(o.a)({},t,{selector:i})),delete n[r]}}(e))}}},Me=/\s*,\s*/g,Le=/&/g,Ie=/\$([\w-]+)/g;var Fe=function(){function e(e,t){return function(n,r){var o=e.getRule(r)||t&&t.getRule(r);return o?(o=o).selector:r}}function t(e,t){for(var n=t.split(Me),r=e.split(Me),o="",i=0;i<n.length;i++)for(var a=n[i],u=0;u<r.length;u++){var l=r[u];o&&(o+=", "),o+=-1!==l.indexOf("&")?l.replace(Le,a):a+" "+l}return o}function n(e,t,n){if(n)return Object(o.a)({},n,{index:n.index+1});var r=e.options.nestingLevel;r=void 0===r?1:r+1;var i=Object(o.a)({},e.options,{nestingLevel:r,index:t.indexOf(e)+1});return delete i.name,i}return{onProcessStyle:function(r,i,a){if("style"!==i.type)return r;var u,l,s=i,c=s.options.parent;for(var f in r){var d=-1!==f.indexOf("&"),p="@"===f[0];if(d||p){if(u=n(s,c,u),d){var h=t(f,s.selector);l||(l=e(c,a)),h=h.replace(Ie,l),c.addRule(h,r[f],Object(o.a)({},u,{selector:h}))}else p&&c.addRule(f,{},u).addRule(s.key,r[f],{selector:s.selector});delete r[f]}}return r}}},ze=/[A-Z]/g,De=/^ms-/,Ve={};function Ue(e){return"-"+e.toLowerCase()}var Be=function(e){if(Ve.hasOwnProperty(e))return Ve[e];var t=e.replace(ze,Ue);return Ve[e]=De.test(t)?"-"+t:t};function We(e){var t={};for(var n in e){t[0===n.indexOf("--")?n:Be(n)]=e[n]}return e.fallbacks&&(Array.isArray(e.fallbacks)?t.fallbacks=e.fallbacks.map(We):t.fallbacks=We(e.fallbacks)),t}var $e=function(){return{onProcessStyle:function(e){if(Array.isArray(e)){for(var t=0;t<e.length;t++)e[t]=We(e[t]);return e}return We(e)},onChangeValue:function(e,t,n){if(0===t.indexOf("--"))return e;var r=Be(t);return t===r?e:(n.prop(r,e),null)}}},He=ge&&CSS?CSS.px:"px",Ke=ge&&CSS?CSS.ms:"ms",qe=ge&&CSS?CSS.percent:"%";function Ge(e){var t=/(-[a-z])/g,n=function(e){return e[1].toUpperCase()},r={};for(var o in e)r[o]=e[o],r[o.replace(t,n)]=e[o];return r}var Qe=Ge({"animation-delay":Ke,"animation-duration":Ke,"background-position":He,"background-position-x":He,"background-position-y":He,"background-size":He,border:He,"border-bottom":He,"border-bottom-left-radius":He,"border-bottom-right-radius":He,"border-bottom-width":He,"border-left":He,"border-left-width":He,"border-radius":He,"border-right":He,"border-right-width":He,"border-top":He,"border-top-left-radius":He,"border-top-right-radius":He,"border-top-width":He,"border-width":He,margin:He,"margin-bottom":He,"margin-left":He,"margin-right":He,"margin-top":He,padding:He,"padding-bottom":He,"padding-left":He,"padding-right":He,"padding-top":He,"mask-position-x":He,"mask-position-y":He,"mask-size":He,height:He,width:He,"min-height":He,"max-height":He,"min-width":He,"max-width":He,bottom:He,left:He,top:He,right:He,"box-shadow":He,"text-shadow":He,"column-gap":He,"column-rule":He,"column-rule-width":He,"column-width":He,"font-size":He,"font-size-delta":He,"letter-spacing":He,"text-iLine truncated
|
||||
*/var Ee=Date.now(),De="fnValues"+Ee,xe="fnStyle"+ ++Ee;var Ce=function(){return{onCreateRule:function(e,t,r){if("function"!=typeof t)return null;var a=g(e,{},r);return a[xe]=t,a},onProcessStyle:function(e,t){if(De in t||xe in t)return e;var r={};for(var a in e){var n=e[a];"function"==typeof n&&(delete e[a],r[a]=n)}return t[De]=r,e},onUpdate:function(e,t,r,a){var n=t,i=n[xe];i&&(n.style=i(e)||{});var o=n[De];if(o)for(var u in o)n.prop(u,o[u](e),a)}}},je="@global",Se=function(){function e(e,t,r){for(var a in this.type="global",this.at=je,this.rules=void 0,this.options=void 0,this.key=void 0,this.isProcessed=!1,this.key=e,this.options=r,this.rules=new Q(Object(n.a)({},r,{parent:this})),t)this.rules.add(a,t[a]);this.rules.process()}var t=e.prototype;return t.getRule=function(e){return this.rules.get(e)},t.addRule=function(e,t,r){var a=this.rules.add(e,t,r);return this.options.jss.plugins.onProcessRule(a),a},t.indexOf=function(e){return this.rules.indexOf(e)},t.toString=function(){return this.rules.toString()},e}(),Oe=function(){function e(e,t,r){this.type="global",this.at=je,this.options=void 0,this.rule=void 0,this.isProcessed=!1,this.key=void 0,this.key=e,this.options=r;var a=e.substr("@global ".length);this.rule=r.jss.createRule(a,t,Object(n.a)({},r,{parent:this}))}return e.prototype.toString=function(e){return this.rule?this.rule.toString(e):""},e}(),Be=/\s*,\s*/g;function qe(e,t){for(var r=e.split(Be),a="",n=0;n<r.length;n++)a+=t+" "+r[n].trim(),r[n+1]&&(a+=", ");return a}var Ae=function(){return{onCreateRule:function(e,t,r){if(!e)return null;if(e===je)return new Se(e,t,r);if("@"===e[0]&&"@global "===e.substr(0,"@global ".length))return new Oe(e,t,r);var a=r.parent;return a&&("global"===a.type||a.options.parent&&"global"===a.options.parent.type)&&(r.scoped=!1),!1===r.scoped&&(r.selector=e),null},onProcessRule:function(e){"style"===e.type&&(function(e){var t=e.options,r=e.style,a=r?r[je]:null;if(a){for(var i in a)t.sheet.addRule(i,a[i],Object(n.a)({},t,{selector:qe(i,e.selector)}));delete r[je]}}(e),function(e){var t=e.options,r=e.style;for(var a in r)if("@"===a[0]&&a.substr(0,je.length)===je){var i=qe(a.substr(je.length),e.selector);t.sheet.addRule(i,r[a],Object(n.a)({},t,{selector:i})),delete r[a]}}(e))}}},Te=/\s*,\s*/g,Pe=/&/g,Re=/\$([\w-]+)/g;var Me=function(){function e(e,t){return function(r,a){var n=e.getRule(a)||t&&t.getRule(a);return n?(n=n).selector:a}}function t(e,t){for(var r=t.split(Te),a=e.split(Te),n="",i=0;i<r.length;i++)for(var o=r[i],u=0;u<a.length;u++){var s=a[u];n&&(n+=", "),n+=-1!==s.indexOf("&")?s.replace(Pe,o):o+" "+s}return n}function r(e,t,r){if(r)return Object(n.a)({},r,{index:r.index+1});var a=e.options.nestingLevel;a=void 0===a?1:a+1;var i=Object(n.a)({},e.options,{nestingLevel:a,index:t.indexOf(e)+1});return delete i.name,i}return{onProcessStyle:function(a,i,o){if("style"!==i.type)return a;var u,s,l=i,f=l.options.parent;for(var d in a){var c=-1!==d.indexOf("&"),_="@"===d[0];if(c||_){if(u=r(l,f,u),c){var h=t(d,l.selector);s||(s=e(f,o)),h=h.replace(Re,s),f.addRule(h,a[d],Object(n.a)({},u,{selector:h}))}else _&&f.addRule(d,{},u).addRule(l.key,a[d],{selector:l.selector});delete a[d]}}return a}}},Ne=/[A-Z]/g,Le=/^ms-/,Ie={};function ze(e){return"-"+e.toLowerCase()}var We=function(e){if(Ie.hasOwnProperty(e))return Ie[e];var t=e.replace(Ne,ze);return Ie[e]=Le.test(t)?"-"+t:t};function Ve(e){var t={};for(var r in e){t[0===r.indexOf("--")?r:We(r)]=e[r]}return e.fallbacks&&(Array.isArray(e.fallbacks)?t.fallbacks=e.fallbacks.map(Ve):t.fallbacks=Ve(e.fallbacks)),t}var Ue=function(){return{onProcessStyle:function(e){if(Array.isArray(e)){for(var t=0;t<e.length;t++)e[t]=Ve(e[t]);return e}return Ve(e)},onChangeValue:function(e,t,r){if(0===t.indexOf("--"))return e;var a=We(t);return t===a?e:(r.prop(a,e),null)}}},He=me&&CSS?CSS.px:"px",$e=me&&CSS?CSS.ms:"ms",Ge=me&&CSS?CSS.percent:"%";function Ke(e){var t=/(-[a-z])/g,r=function(e){return e[1].toUpperCase()},a={};for(var n in e)a[n]=e[n],a[n.replace(t,r)]=e[n];return a}var Ye=Ke({"animation-delay":$e,"animation-duration":$e,"background-position":He,"background-position-x":He,"background-position-y":He,"background-size":He,border:He,"border-bottom":He,"border-bottom-left-radius":He,"border-bottom-right-radius":He,"border-bottom-width":He,"border-left":He,"border-left-width":He,"border-radius":He,"border-right":He,"border-right-width":He,"border-top":He,"border-top-left-radius":He,"border-top-right-radius":He,"border-top-width":He,"border-width":He,margin:He,"margin-bottom":He,"margin-left":He,"margin-right":He,"margin-top":He,padding:He,"padding-bottom":He,"padding-left":He,"padding-right":He,"padding-top":He,"mask-position-x":He,"mask-position-y":He,"mask-size":He,height:He,width:He,"min-height":He,"max-height":He,"min-width":He,"max-width":He,bottom:He,left:He,top:He,right:He,"box-shadow":He,"text-shadow":He,"column-gap":He,"column-rule":He,"column-rule-width":He,"column-width":He,"font-size":He,"font-size-delta":He,"letter-spacing":He,"text-iLine truncated
|
||||
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 149 KiB |
@@ -15,3 +15,30 @@ COLLATE utf8mb4_general_ci;
|
||||
|
||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('phone', 'Phone', 1, 0, 1);
|
||||
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`) VALUES ('dphone', 'Destroyed Phone', 1, 0, 1);
|
||||
|
||||
CREATE TABLE `npwd_twitter_tweets` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`message` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`likes` int NOT NULL DEFAULT '0',
|
||||
`identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`visible` tinyint NOT NULL DEFAULT '1',
|
||||
`images` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=190 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
|
||||
CREATE TABLE `npwd_twitter_profiles` (
|
||||
`id` int NOT NULL AUTO_INCREMENT,
|
||||
`profile_name` varchar(90) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
`identifier` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`avatar_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`bio` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`location` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`job` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL,
|
||||
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `profile_name_UNIQUE` (`profile_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
@@ -5,6 +5,13 @@ TriggerEvent('esx:getSharedObject', function(obj)
|
||||
end)
|
||||
|
||||
|
||||
-- we pass the server configuration to the phone so that we can have phone or
|
||||
-- app specific settings configured by the server owner
|
||||
ESX.RegisterServerCallback('phone:phoneConfig', function(source, cb)
|
||||
cb(Config)
|
||||
end)
|
||||
|
||||
|
||||
RegisterServerEvent('phone:getCredentials')
|
||||
AddEventHandler('phone:getCredentials', function()
|
||||
local _source = source
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
ESX = nil
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj)
|
||||
ESX = obj
|
||||
end)
|
||||
|
||||
function fetchAllTweets(cb)
|
||||
MySQL.Async.fetchAll([[
|
||||
SELECT
|
||||
npwd_twitter_profiles.profile_name,
|
||||
npwd_twitter_profiles.avatar_url,
|
||||
npwd_twitter_tweets.*,
|
||||
TIME_TO_SEC(TIMEDIFF( NOW(), npwd_twitter_tweets.createdAt)) AS seconds_since_tweet
|
||||
FROM npwd_twitter_tweets
|
||||
LEFT OUTER JOIN npwd_twitter_profiles ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier
|
||||
WHERE visible = 1
|
||||
ORDER BY npwd_twitter_tweets.createdAt DESC
|
||||
LIMIT 100
|
||||
]],
|
||||
{},
|
||||
function(tweets)
|
||||
cb(tweets)
|
||||
end)
|
||||
end
|
||||
|
||||
function fetchTweetsFiltered(searchValue, cb)
|
||||
local searchValueParameterized = '%' .. searchValue .. '%'
|
||||
MySQL.Async.fetchAll([[
|
||||
SELECT
|
||||
npwd_twitter_profiles.profile_name,
|
||||
npwd_twitter_profiles.avatar_url,
|
||||
npwd_twitter_tweets.*,
|
||||
TIME_TO_SEC(TIMEDIFF( NOW(), npwd_twitter_tweets.createdAt)) AS seconds_since_tweet
|
||||
FROM npwd_twitter_tweets
|
||||
LEFT OUTER JOIN npwd_twitter_profiles ON npwd_twitter_tweets.identifier = npwd_twitter_profiles.identifier
|
||||
WHERE visible = 1 AND (npwd_twitter_profiles.profile_name LIKE @profile_name OR npwd_twitter_tweets.message LIKE @message)
|
||||
ORDER BY npwd_twitter_tweets.createdAt DESC
|
||||
LIMIT 100
|
||||
]],
|
||||
{
|
||||
profile_name = searchValueParameterized,
|
||||
message = searchValueParameterized
|
||||
},
|
||||
function(tweets)
|
||||
cb(tweets)
|
||||
end)
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('phone:fetchTweets', function(source, cb)
|
||||
fetchAllTweets(cb)
|
||||
end)
|
||||
|
||||
-- search value expected to be lower case
|
||||
ESX.RegisterServerCallback('phone:fetchTweetsFiltered', function(source, cb, searchValue)
|
||||
fetchTweetsFiltered(searchValue, cb)
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('phone:createTweet', function(source, cb, data)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local _identifier = xPlayer.getIdentifier()
|
||||
|
||||
MySQL.Async.transaction({[[
|
||||
INSERT INTO npwd_twitter_tweets (`identifier`, `message`, `images`)
|
||||
VALUES (@identifier, @message, @images)
|
||||
]]},
|
||||
{
|
||||
identifier = _identifier,
|
||||
message = data.message,
|
||||
images = data.images
|
||||
},
|
||||
function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
function getProfile(identifier, cb)
|
||||
MySQL.Async.fetchAll([[
|
||||
SELECT * FROM npwd_twitter_profiles
|
||||
WHERE identifier = @identifier
|
||||
LIMIT 1
|
||||
]],
|
||||
{ identifier = identifier },
|
||||
function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end
|
||||
|
||||
function getProfileName(identifier, cb)
|
||||
local defaultProfileName = ''
|
||||
if Config.twitter.generateProfileNameFromUsers == false then
|
||||
cb(defaultProfileName)
|
||||
return
|
||||
end
|
||||
|
||||
-- TODO: make this query configurable
|
||||
MySQL.Async.fetchAll([[
|
||||
SELECT CONCAT(firstname, '_', lastname) AS profile_name
|
||||
FROM users
|
||||
WHERE identifier = @identifier LIMIT 1
|
||||
]],
|
||||
{ identifier = identifier },
|
||||
function(users)
|
||||
if next(users) == nil then -- no user found with this identifier
|
||||
cb(defaultProfileName)
|
||||
return
|
||||
end
|
||||
|
||||
cb(users[1].profile_name)
|
||||
end)
|
||||
end
|
||||
|
||||
function createDefaultProfile(identifier, cb)
|
||||
getProfileName(identifier, function(profileName)
|
||||
MySQL.Async.execute([[
|
||||
INSERT INTO npwd_twitter_profiles (`identifier`, `profile_name`)
|
||||
VALUES (@identifier, @profile_name)
|
||||
]],
|
||||
{ identifier = identifier, profile_name = profileName },
|
||||
function(result)
|
||||
if result == 1 then -- if we created the profile then return it
|
||||
getProfile(identifier, cb)
|
||||
else -- otherwise just give back the failed result
|
||||
cb(result)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
-- Retrieve a twitter profile by identifier. If it does not exist then
|
||||
-- create and return it
|
||||
function getOrCreateProfile(identifier, cb)
|
||||
getProfile(identifier, function(retrieveResult)
|
||||
if next(retrieveResult) == nil then -- profile does not exist, attempt to create it
|
||||
createDefaultProfile(identifier, function(createResult)
|
||||
cb(createResult)
|
||||
end)
|
||||
else -- profile does exist
|
||||
cb(retrieveResult)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('phone:getOrCreateTwitterProfile', function(source, cb)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local _identifier = xPlayer.getIdentifier()
|
||||
|
||||
getOrCreateProfile(_identifier, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||
function updateTwitterProfile(identifier, data, cb)
|
||||
MySQL.Async.transaction({[[
|
||||
UPDATE npwd_twitter_profiles
|
||||
SET avatar_url = @avatar_url, profile_name = @profile_name, bio = @bio, location = @location, job = @job
|
||||
WHERE identifier = @identifier
|
||||
]]},
|
||||
{
|
||||
identifier = identifier,
|
||||
avatar_url= data.avatar_url,
|
||||
profile_name = data.profile_name,
|
||||
bio = data.bio,
|
||||
location = data.location,
|
||||
job = data.job,
|
||||
},
|
||||
function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end
|
||||
|
||||
ESX.RegisterServerCallback('phone:updateTwitterProfile', function(source, cb, data)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local _identifier = xPlayer.getIdentifier()
|
||||
|
||||
updateTwitterProfile(_identifier, data, function(result)
|
||||
cb(result)
|
||||
end)
|
||||
end)
|
||||
|
||||