mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Merge pull request #9 from Re-Ignited-Development/feature/ts-cleanup
Feature/ts cleanup
This commit is contained in:
49 files changed
+236
-77
No files matched your search
@@ -1 +0,0 @@
|
|||||||
TSC_COMPILE_ON_ERROR=true
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from "react";
|
import React from "react";
|
||||||
import ListItemText from "@material-ui/core/ListItemText";
|
import ListItemText from "@material-ui/core/ListItemText";
|
||||||
import { Button } from "@material-ui/core";
|
import { Button } from "@material-ui/core";
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ import Nui from "../../../os/nui-events/utils/Nui";
|
|||||||
|
|
||||||
export const ContactList = () => {
|
export const ContactList = () => {
|
||||||
const contacts = useContacts();
|
const contacts = useContacts();
|
||||||
const [call, setCall] = useState("");
|
|
||||||
|
|
||||||
const startCall = (number) => {
|
const startCall = (number) => {
|
||||||
console.log(number);
|
console.log(number);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const AddContactModal = ({ handleClose, show, children }) => {
|
export const AddContactModal = ({ handleClose, show }) => {
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [number, setNumber] = useState("");
|
const [number, setNumber] = useState("");
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
|
||||||
import { AppWrapper } from "../../../ui/components";
|
import { AppWrapper } from "../../../ui/components";
|
||||||
import { AppTitle } from "../../../ui/components/AppTitle";
|
import { AppTitle } from "../../../ui/components/AppTitle";
|
||||||
import { AppContent } from "../../../ui/components/AppContent";
|
import { AppContent } from "../../../ui/components/AppContent";
|
||||||
@@ -9,20 +8,8 @@ import AddCircleIcon from "@material-ui/icons/AddCircle";
|
|||||||
import { AddContactModal } from "./ContactModal";
|
import { AddContactModal } from "./ContactModal";
|
||||||
import { Button } from "@material-ui/core";
|
import { Button } from "@material-ui/core";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
|
||||||
modalOpener: {
|
|
||||||
backgroundColor: "red",
|
|
||||||
height: 50,
|
|
||||||
position: "fixed",
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const ContactsApp = () => {
|
export const ContactsApp = () => {
|
||||||
const [modal, setModal] = useState(false);
|
const [modal, setModal] = useState(false);
|
||||||
const classes = useStyles();
|
|
||||||
const contacts = useApp("CONTACTS");
|
const contacts = useApp("CONTACTS");
|
||||||
|
|
||||||
const openModal = () => {
|
const openModal = () => {
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
import { contactsState } from "./state";
|
import { contactsState } from "./state";
|
||||||
|
|
||||||
export const useContacts = () => {
|
interface Contact {
|
||||||
|
id: string;
|
||||||
|
display: string;
|
||||||
|
number: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUseContacts {
|
||||||
|
contacts: Contact[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useContacts = (): IUseContacts => {
|
||||||
const contacts = useRecoilValue(contactsState.contacts);
|
const contacts = useRecoilValue(contactsState.contacts);
|
||||||
return { contacts };
|
return { contacts };
|
||||||
};
|
};
|
||||||
Whitespace-only changes.
Whitespace-only changes.
@@ -59,10 +59,10 @@ export const SelloutItem = (listing) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
<ImageDisplay imgURL={listing.img} />
|
<ImageDisplay imgURL={listing.img} />
|
||||||
<Typography variant="h7" className={classes.desc}>
|
<Typography variant="h6" className={classes.desc}>
|
||||||
{listing.description}
|
{listing.description}
|
||||||
</Typography>
|
</Typography>
|
||||||
<div className={classes.postActions}>
|
<div>
|
||||||
<Button>
|
<Button>
|
||||||
<ChatIcon style={{ color: "#f44336" }} />
|
<ChatIcon style={{ color: "#f44336" }} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Paper from "@material-ui/core/Paper";
|
import Paper from "@material-ui/core/Paper";
|
||||||
import { makeStyles } from "@material-ui/core";
|
import { makeStyles } from "@material-ui/core";
|
||||||
import LinkedInIcon from "@material-ui/icons/LinkedIn";
|
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
import { faAd } from "@fortawesome/free-solid-svg-icons";
|
import { faAd } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const ImageDisplay = ({ imgURL }) => {
|
|||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
src={imgURL}
|
src={imgURL}
|
||||||
alt="Image"
|
alt="twitter display"
|
||||||
style={{ height: 200, width: 350, margin: "auto" }}
|
style={{ height: 200, width: 350, margin: "auto" }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { ListItem, ListItemText, Divider } from "@material-ui/core";
|
import { ListItem, ListItemText, Divider } from "@material-ui/core";
|
||||||
|
|
||||||
export const SettingItem = ({ options, label, value, onClick }) => {
|
interface IProps {
|
||||||
|
options?: any;
|
||||||
|
label: string;
|
||||||
|
value: string | null;
|
||||||
|
onClick?: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SettingItem = ({ options, label, value, onClick }: IProps) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ListItem onClick={() => onClick(options)} button>
|
<ListItem onClick={() => onClick(options)} button>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const settingsState = atom({
|
|||||||
default: Default,
|
default: Default,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useSettings = () => {
|
export const useSettings = (): any => {
|
||||||
const [settings, setSettings] = useConfig(settingsState);
|
const [settings, setSettings] = useConfig(settingsState);
|
||||||
const [config] = useConfig();
|
const [config] = useConfig();
|
||||||
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
|
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
|
||||||
|
|||||||
@@ -52,6 +52,11 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
interface Image {
|
||||||
|
id: string;
|
||||||
|
link: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const AddTweetModal = () => {
|
export const AddTweetModal = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { message, setMessage, modalVisible, setModalVisible } = useModal();
|
const { message, setMessage, modalVisible, setModalVisible } = useModal();
|
||||||
@@ -61,10 +66,10 @@ export const AddTweetModal = () => {
|
|||||||
const [showImagePrompt, setShowImagePrompt] = useState(false);
|
const [showImagePrompt, setShowImagePrompt] = useState(false);
|
||||||
const [link, setLink] = useState("");
|
const [link, setLink] = useState("");
|
||||||
|
|
||||||
const [images, setImages] = useState([]);
|
const [images, setImages] = useState<Image[]>([]);
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
setShowImagePrompt(null);
|
setShowImagePrompt(false);
|
||||||
setShowEmoji(false);
|
setShowEmoji(false);
|
||||||
|
|
||||||
setLink("");
|
setLink("");
|
||||||
@@ -79,16 +84,18 @@ export const AddTweetModal = () => {
|
|||||||
|
|
||||||
// when the user presses escape we should close the modal
|
// when the user presses escape we should close the modal
|
||||||
const _handleEscape = (e) => {
|
const _handleEscape = (e) => {
|
||||||
const isEscapeKey = e.key == "Escape" || e.key == "Esc";
|
const isEscapeKey = e.key === "Escape" || e.key === "Esc";
|
||||||
if (isEscapeKey) {
|
if (isEscapeKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
_handleClose();
|
_handleClose();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const listener = window.addEventListener("keydown", _handleEscape, true);
|
window.addEventListener("keydown", _handleEscape, true);
|
||||||
return () => window.removeEventListener("keydown", listener);
|
return () => window.removeEventListener("keydown", _handleEscape);
|
||||||
}, []);
|
});
|
||||||
|
|
||||||
|
if (!config) return null;
|
||||||
|
|
||||||
const submitTweet = () => {
|
const submitTweet = () => {
|
||||||
const cleanedMessage = message.trim();
|
const cleanedMessage = message.trim();
|
||||||
@@ -140,7 +147,7 @@ export const AddTweetModal = () => {
|
|||||||
const toggleShowEmoji = () => {
|
const toggleShowEmoji = () => {
|
||||||
// clear the images so we can seemlessly toggle between emoji/images
|
// clear the images so we can seemlessly toggle between emoji/images
|
||||||
setShowImagePrompt(false);
|
setShowImagePrompt(false);
|
||||||
setImages("");
|
setImages([]);
|
||||||
setShowEmoji(!showEmoji);
|
setShowEmoji(!showEmoji);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
|
|||||||
<img
|
<img
|
||||||
className={classes.img}
|
className={classes.img}
|
||||||
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
|
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
|
||||||
alt="Invalid avatar image"
|
alt="Invalid avatar"
|
||||||
style={{ height, width }}
|
style={{ height, width }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const TwitterApp = () => {
|
|||||||
return (
|
return (
|
||||||
<AppWrapper id="twitter-app">
|
<AppWrapper id="twitter-app">
|
||||||
<AddTweetModal />
|
<AddTweetModal />
|
||||||
<div className={modalVisible ? classes.backgroundModal : null} />
|
<div className={modalVisible ? classes.backgroundModal : undefined} />
|
||||||
<TwitterTitle />
|
<TwitterTitle />
|
||||||
<AppContent>
|
<AppContent>
|
||||||
{promptProfileName ? (
|
{promptProfileName ? (
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function TwitterSearch() {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [searchValue, setSearchValue] = useState("");
|
const [searchValue, setSearchValue] = useState("");
|
||||||
const { tweets, setTweets } = useFilteredTweets();
|
const { tweets } = useFilteredTweets();
|
||||||
|
|
||||||
const handleChange = (e) => setSearchValue(e.target.value);
|
const handleChange = (e) => setSearchValue(e.target.value);
|
||||||
|
|
||||||
@@ -35,6 +35,8 @@ function TwitterSearch() {
|
|||||||
Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue);
|
Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const filteredTweets = tweets || [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
@@ -49,7 +51,7 @@ function TwitterSearch() {
|
|||||||
inputRef={(input) => input && input.focus()}
|
inputRef={(input) => input && input.focus()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{tweets && tweets.length > 0 && <TweetList tweets={tweets} />}
|
{filteredTweets.length > 0 && <TweetList tweets={tweets} />}
|
||||||
</div>
|
</div>
|
||||||
<SearchButton handleClick={handleSubmit} />
|
<SearchButton handleClick={handleSubmit} />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ export default function AlertBar() {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { updateProfileSuccessful, setUpdateProfileSuccessful } = useProfile();
|
const { updateProfileSuccessful, setUpdateProfileSuccessful } = useProfile();
|
||||||
const { createTweetSuccessful, setCreateTweetSuccessful } = useTweetStatus();
|
const { createTweetSuccessful, setCreateTweetSuccessful } = useTweetStatus();
|
||||||
const [severity, setSeverity] = useState(null);
|
const [severity, setSeverity] = useState<string | null>(null);
|
||||||
const [open, setOpen] = useState(null);
|
const [open, setOpen] = useState(false);
|
||||||
const [message, setMessage] = useState(null);
|
const [message, setMessage] = useState(null);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
@@ -49,7 +49,7 @@ export default function AlertBar() {
|
|||||||
setSeverity("error");
|
setSeverity("error");
|
||||||
setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE"));
|
setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE"));
|
||||||
}
|
}
|
||||||
}, [updateProfileSuccessful, createTweetSuccessful]);
|
}, [updateProfileSuccessful, createTweetSuccessful, t]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Snackbar
|
<Snackbar
|
||||||
|
|||||||
@@ -49,7 +49,11 @@ export const Image = ({ link, handleClick, small }) => {
|
|||||||
<CloseIcon />
|
<CloseIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
)}
|
)}
|
||||||
<img className={small ? classes.imgSmall : classes.img} src={link} />
|
<img
|
||||||
|
alt="small avatar"
|
||||||
|
className={small ? classes.imgSmall : classes.img}
|
||||||
|
src={link}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export function ProfilePrompt() {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { profile } = useProfile();
|
const { profile } = useProfile();
|
||||||
|
|
||||||
const [name, handleNameChange] = useState(profile.profile_name || "");
|
const [name, handleNameChange] = useState(profile.profile_name || "");
|
||||||
|
|
||||||
const handleUpdate = () => {
|
const handleUpdate = () => {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
Button,
|
Button,
|
||||||
Typography,
|
Typography,
|
||||||
} from "@material-ui/core";
|
} from "@material-ui/core";
|
||||||
import FavoriteBorderIcon from "@material-ui/icons/FavoriteBorder";
|
|
||||||
import MoreIcon from "@material-ui/icons/MoreVert";
|
import MoreIcon from "@material-ui/icons/MoreVert";
|
||||||
|
|
||||||
import { ListItem } from "../../../../ui/components/ListItem";
|
import { ListItem } from "../../../../ui/components/ListItem";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useRef } from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import { TextField } from "@material-ui/core";
|
import { TextField } from "@material-ui/core";
|
||||||
@@ -23,6 +23,8 @@ export const TweetMessage = ({ message, handleChange }) => {
|
|||||||
const { config } = usePhone();
|
const { config } = usePhone();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
if (!config) return null;
|
||||||
|
|
||||||
const overCharacterLimit =
|
const overCharacterLimit =
|
||||||
message.trim().length > config.twitter.characterLimit;
|
message.trim().length > config.twitter.characterLimit;
|
||||||
const characterWarningPrompt = `${t(
|
const characterWarningPrompt = `${t(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { atom } from "recoil";
|
|||||||
export const twitterState = {
|
export const twitterState = {
|
||||||
profile: atom({
|
profile: atom({
|
||||||
key: "profile",
|
key: "profile",
|
||||||
default: null,
|
default: {},
|
||||||
}),
|
}),
|
||||||
tweets: atom({
|
tweets: atom({
|
||||||
key: "tweets",
|
key: "tweets",
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
import { useRecoilValue, useRecoilState } from "recoil";
|
import { useRecoilValue, useRecoilState } from "recoil";
|
||||||
import { twitterState } from "./state";
|
import { twitterState } from "./state";
|
||||||
|
|
||||||
export const useProfile = () => {
|
interface IProfile {
|
||||||
|
profile_name?: string;
|
||||||
|
bio?: string;
|
||||||
|
job?: string;
|
||||||
|
location?: string;
|
||||||
|
avatar_url?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUseProfile {
|
||||||
|
profile: IProfile;
|
||||||
|
updateProfileLoading: any;
|
||||||
|
updateProfileSuccessful: any;
|
||||||
|
setUpdateProfileSuccessful: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useProfile = (): IUseProfile => {
|
||||||
const profile = useRecoilValue(twitterState.profile);
|
const profile = useRecoilValue(twitterState.profile);
|
||||||
const updateProfileLoading = useRecoilValue(
|
const updateProfileLoading = useRecoilValue(
|
||||||
twitterState.updateProfileLoading
|
twitterState.updateProfileLoading
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useRecoilValue, useSetRecoilState } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
import { twitterState } from "./state";
|
import { twitterState } from "./state";
|
||||||
|
|
||||||
export const useTweets = () => {
|
export const useTweets = () => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const configState = atom({
|
|||||||
default: Default,
|
default: Default,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const useConfig = (state = configState) => {
|
export const useConfig = (state: any = configState): any => {
|
||||||
const [config, _setConfig] = useRecoilState(state);
|
const [config, _setConfig] = useRecoilState(state);
|
||||||
|
|
||||||
const setConfig = (key, value) => {
|
const setConfig = (key, value) => {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
interface TwitterConfig {
|
||||||
|
generateProfileNameFromUsers: boolean;
|
||||||
|
characterLimit: number;
|
||||||
|
allowEdtiableProfileName: boolean;
|
||||||
|
enableAvatars: boolean;
|
||||||
|
enableEmojis: boolean;
|
||||||
|
enableImages: boolean;
|
||||||
|
maxImages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServerConfig {
|
||||||
|
Locale: string;
|
||||||
|
KeyTogglePhone: number;
|
||||||
|
KeyTakeCall: number;
|
||||||
|
PhoneAsItem: boolean;
|
||||||
|
SwimDestroy: boolean;
|
||||||
|
RunRate: number;
|
||||||
|
DestoryChance: number;
|
||||||
|
DestroyPhoneReCheck: number;
|
||||||
|
twitter: TwitterConfig;
|
||||||
|
}
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { makeStyles } from "@material-ui/core";
|
import { green } from "@material-ui/core/colors";
|
||||||
import { AppWrapper } from "../../ui/components/AppWrapper";
|
import { AppWrapper } from "../../ui/components/AppWrapper";
|
||||||
import { AppTitle } from "../../ui/components/AppTitle";
|
import { AppTitle } from "../../ui/components/AppTitle";
|
||||||
import { AppContent } from "../../ui/components/AppContent";
|
import { AppContent } from "../../ui/components/AppContent";
|
||||||
import { Button } from "../../ui/components/Button";
|
|
||||||
|
|
||||||
export const CallModal = () => {
|
export const CallModal = () => {
|
||||||
return (
|
return (
|
||||||
<AppWrapper>
|
<AppWrapper>
|
||||||
<AppTitle app="Call" />
|
<AppTitle
|
||||||
|
app={{
|
||||||
|
backgroundColor: green[400],
|
||||||
|
color: green[50],
|
||||||
|
nameLocale: "Call",
|
||||||
|
}}
|
||||||
|
variant="h4"
|
||||||
|
/>
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<h1
|
<h1
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilState } from "recoil";
|
||||||
import { callerState } from "./state";
|
import { callerState } from "./state";
|
||||||
|
|
||||||
export const useCall = () => {
|
export const useCall = () => {
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
interface TwitterConfig {
|
||||||
|
generateProfileNameFromUsers: boolean;
|
||||||
|
characterLimit: number;
|
||||||
|
allowEdtiableProfileName: boolean;
|
||||||
|
enableAvatars: boolean;
|
||||||
|
enableEmojis: boolean;
|
||||||
|
enableImages: boolean;
|
||||||
|
maxImages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServerConfig {
|
||||||
|
Locale: string;
|
||||||
|
KeyTogglePhone: number;
|
||||||
|
KeyTakeCall: number;
|
||||||
|
PhoneAsItem: boolean;
|
||||||
|
SwimDestroy: boolean;
|
||||||
|
RunRate: number;
|
||||||
|
DestoryChance: number;
|
||||||
|
DestroyPhoneReCheck: number;
|
||||||
|
twitter: TwitterConfig;
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ export const useInitKeyboard = () => {
|
|||||||
Escape: useRecoilValue(keyboardState.Escape),
|
Escape: useRecoilValue(keyboardState.Escape),
|
||||||
};
|
};
|
||||||
|
|
||||||
const setEscape = useSetRecoilState(keyboardState.Escape);
|
const setEscape = useSetRecoilState<any>(keyboardState.Escape);
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
function handleNUIKeyboardMessage() {
|
function handleNUIKeyboardMessage() {
|
||||||
|
|||||||
@@ -35,17 +35,17 @@ export const Navigation = () => {
|
|||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Phone"
|
label="Phone"
|
||||||
value={() => history.push("/phone")}
|
value={() => history.push("/phone")}
|
||||||
icon={<PhoneIcon className={classes.icon} />}
|
icon={<PhoneIcon />}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Home"
|
label="Home"
|
||||||
value={() => history.push("/")}
|
value={() => history.push("/")}
|
||||||
icon={<AppsIcon className={classes.icon} />}
|
icon={<AppsIcon />}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Close"
|
label="Close"
|
||||||
value={() => closePhone()}
|
value={() => closePhone()}
|
||||||
icon={<RadioButtonUncheckedIcon className={classes.icon} />}
|
icon={<RadioButtonUncheckedIcon />}
|
||||||
/>
|
/>
|
||||||
<BottomNavigationAction
|
<BottomNavigationAction
|
||||||
label="Back"
|
label="Back"
|
||||||
|
|||||||
Whitespace-only changes.
@@ -25,7 +25,16 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const NotificationBar = ({ notifications = [] }) => {
|
interface INotification {
|
||||||
|
key: string;
|
||||||
|
icon: JSX.Element;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
notifications?: INotification[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const NotificationBar = ({ notifications = [] }: IProps) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { eventNameFactory } from "../utils/nuiUtils";
|
import { eventNameFactory } from "../utils/nuiUtils";
|
||||||
|
|
||||||
export const useNuiEvent = (app, method, handler, options = {}) => {
|
interface IOptions {
|
||||||
const savedHandler = useRef();
|
capture?: boolean;
|
||||||
|
passive?: boolean;
|
||||||
|
once?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useNuiEvent = (app, method, handler, options: IOptions = {}) => {
|
||||||
|
const savedHandler: any = useRef();
|
||||||
const { capture, passive, once } = options;
|
const { capture, passive, once } = options;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { eventNameFactory } from "../utils/nuiUtils";
|
import { eventNameFactory } from "../utils/nuiUtils";
|
||||||
|
|
||||||
export const useNuiService = (options = {}) => {
|
interface IOptions {
|
||||||
|
capture?: boolean;
|
||||||
|
passive?: boolean;
|
||||||
|
once?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useNuiService = (options: IOptions = {}) => {
|
||||||
const { capture, passive, once } = options;
|
const { capture, passive, once } = options;
|
||||||
const eventListener = (event) => {
|
const eventListener = (event) => {
|
||||||
const { app, method, data } = event.data;
|
const { app, method, data } = event.data;
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ export const phoneState = {
|
|||||||
}),
|
}),
|
||||||
phoneConfig: atom({
|
phoneConfig: atom({
|
||||||
key: "phoneConfig",
|
key: "phoneConfig",
|
||||||
default: null,
|
default: undefined,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from "recoil";
|
||||||
import { phoneState } from "./state";
|
import { phoneState } from "./state";
|
||||||
|
import { ServerConfig } from "../../interfaces/serverConfig";
|
||||||
|
|
||||||
export const usePhone = () => {
|
interface IUsePhone {
|
||||||
|
visibility: boolean;
|
||||||
|
config?: ServerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const usePhone = (): IUsePhone => {
|
||||||
const visibility = useRecoilValue(phoneState.visibility);
|
const visibility = useRecoilValue(phoneState.visibility);
|
||||||
const config = useRecoilValue(phoneState.phoneConfig);
|
const config = useRecoilValue(phoneState.phoneConfig);
|
||||||
return { visibility, config };
|
return { visibility, config };
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from "react";
|
|||||||
import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core";
|
import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core";
|
||||||
import { AppContentTypes } from "../interface/InterfaceUI";
|
import { AppContentTypes } from "../interface/InterfaceUI";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles(() => ({
|
||||||
wrapper: {
|
wrapper: {
|
||||||
height: "67vh",
|
height: "67vh",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
@@ -34,7 +34,7 @@ export const AppContent = ({
|
|||||||
return (
|
return (
|
||||||
<Paper className={classes.wrapper}>
|
<Paper className={classes.wrapper}>
|
||||||
<Box flexGrow={1} className={classes.box} {...props}>
|
<Box flexGrow={1} className={classes.box} {...props}>
|
||||||
<Paper square px={2} pt={1} elevation={0} className={classes.paper}>
|
<Paper square elevation={0} className={classes.paper}>
|
||||||
<Backdrop
|
<Backdrop
|
||||||
className={classes.backdrop}
|
className={classes.backdrop}
|
||||||
open={backdrop || false}
|
open={backdrop || false}
|
||||||
|
|||||||
@@ -4,7 +4,13 @@ import Avatar from "@material-ui/core/Avatar";
|
|||||||
import { green } from "@material-ui/core/colors";
|
import { green } from "@material-ui/core/colors";
|
||||||
import { Button } from "@material-ui/core";
|
import { Button } from "@material-ui/core";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
interface IStyles {
|
||||||
|
root: any;
|
||||||
|
avatar: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const useStyles = makeStyles(
|
||||||
|
(theme): IStyles => ({
|
||||||
root: {
|
root: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
"& > *": {
|
"& > *": {
|
||||||
@@ -19,7 +25,8 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
height: theme.spacing(7),
|
height: theme.spacing(7),
|
||||||
fontSize: theme.typography.h4.fontSize,
|
fontSize: theme.typography.h4.fontSize,
|
||||||
},
|
},
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
export const AppIcon = ({ name, icon, backgroundColor, color }) => {
|
export const AppIcon = ({ name, icon, backgroundColor, color }) => {
|
||||||
const classes = useStyles({
|
const classes = useStyles({
|
||||||
|
|||||||
@@ -1,8 +1,21 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { Typography, Box, makeStyles } from "@material-ui/core";
|
import { Typography, Box, makeStyles } from "@material-ui/core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Variant } from "@material-ui/core/styles/createTypography";
|
||||||
|
|
||||||
const useStyle = makeStyles((theme) => ({
|
interface IProps {
|
||||||
|
app: any;
|
||||||
|
className?: string;
|
||||||
|
variant?: Variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IUseStyle {
|
||||||
|
root: any;
|
||||||
|
text: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
const useStyle = makeStyles(
|
||||||
|
(theme): IUseStyle => ({
|
||||||
root: ({ backgroundColor }) => ({
|
root: ({ backgroundColor }) => ({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
@@ -11,13 +24,14 @@ const useStyle = makeStyles((theme) => ({
|
|||||||
text: ({ color }) => ({
|
text: ({ color }) => ({
|
||||||
color: color || theme.palette.text.primary,
|
color: color || theme.palette.text.primary,
|
||||||
}),
|
}),
|
||||||
}));
|
})
|
||||||
|
);
|
||||||
|
|
||||||
export const AppTitle = ({
|
export const AppTitle = ({
|
||||||
app: { backgroundColor, color, nameLocale },
|
app: { backgroundColor, color, nameLocale },
|
||||||
variant = "h4",
|
variant = "h4",
|
||||||
...props
|
...props
|
||||||
}) => {
|
}: IProps) => {
|
||||||
const classes = useStyle({ color, backgroundColor });
|
const classes = useStyle({ color, backgroundColor });
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, { useEffect } from "react";
|
|||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
import { Paper } from "@material-ui/core";
|
import { Paper } from "@material-ui/core";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles(() => ({
|
||||||
root: {
|
root: {
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
background: "#424242",
|
background: "#424242",
|
||||||
@@ -31,16 +31,16 @@ export const Modal = ({ children, visible, handleClose }) => {
|
|||||||
|
|
||||||
// when the user presses escape we should close the modal
|
// when the user presses escape we should close the modal
|
||||||
const _handleEscape = (e) => {
|
const _handleEscape = (e) => {
|
||||||
const isEscapeKey = e.key == "Escape" || e.key == "Esc";
|
const isEscapeKey = e.key === "Escape" || e.key === "Esc";
|
||||||
if (isEscapeKey) {
|
if (isEscapeKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
handleClose();
|
handleClose();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const listener = window.addEventListener("keydown", _handleEscape, true);
|
window.addEventListener("keydown", _handleEscape, true);
|
||||||
return () => window.removeEventListener("keydown", listener);
|
return () => window.removeEventListener("keydown", _handleEscape);
|
||||||
}, []);
|
});
|
||||||
|
|
||||||
const showHideClassName = visible
|
const showHideClassName = visible
|
||||||
? classes.displayBlock
|
? classes.displayBlock
|
||||||
|
|||||||
Whitespace-only changes.
@@ -1,6 +1,8 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { ContextMenu } from "../components/ContextMenu";
|
import { ContextMenu } from "../components/ContextMenu";
|
||||||
|
|
||||||
|
type UseContextMenu = [any, any, () => JSX.Element, boolean];
|
||||||
|
|
||||||
export const MapStringOptions = (current, onClick) => (string) => {
|
export const MapStringOptions = (current, onClick) => (string) => {
|
||||||
return {
|
return {
|
||||||
selected: current === string,
|
selected: current === string,
|
||||||
@@ -10,8 +12,8 @@ export const MapStringOptions = (current, onClick) => (string) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useContextMenu = (_options = []) => {
|
export const useContextMenu = (_options = []): UseContextMenu => {
|
||||||
const [open, setOpen] = useState();
|
const [open, setOpen] = useState(false);
|
||||||
const [options, setOptions] = useState(_options);
|
const [options, setOptions] = useState(_options);
|
||||||
|
|
||||||
const onClose = () => setOpen(false);
|
const onClose = () => setOpen(false);
|
||||||
|
|||||||
Whitespace-only changes.
@@ -1,2 +0,0 @@
|
|||||||
import { atom, selector, useRecoilState } from "recoil";
|
|
||||||
import { useNuiEvent } from "../../os/nui-events/hooks";
|
|
||||||
@@ -6,6 +6,7 @@ export interface AppContentTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AppWrapperTypes {
|
export interface AppWrapperTypes {
|
||||||
|
id?: string;
|
||||||
children: any;
|
children: any;
|
||||||
style?: any;
|
style?: any;
|
||||||
handleClickAway?: any;
|
handleClickAway?: any;
|
||||||
|
|||||||
@@ -1217,6 +1217,37 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed"
|
resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed"
|
||||||
integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==
|
integrity sha512-OWORNpfjMsSSUBVrRBVGECkhWcULOAJz9ZW8uK9qgxD+87M7jHRcvh/A96XXNhXTLmKcoYSQtBEX7lHMO7YRwg==
|
||||||
|
|
||||||
|
"@fortawesome/fontawesome-common-types@^0.2.32":
|
||||||
|
version "0.2.32"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-0.2.32.tgz#3436795d5684f22742989bfa08f46f50f516f259"
|
||||||
|
integrity sha512-ux2EDjKMpcdHBVLi/eWZynnPxs0BtFVXJkgHIxXRl+9ZFaHPvYamAfCzeeQFqHRjuJtX90wVnMRaMQAAlctz3w==
|
||||||
|
|
||||||
|
"@fortawesome/fontawesome-free@^5.15.1":
|
||||||
|
version "5.15.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.1.tgz#ccfef6ddbe59f8fe8f694783e1d3eb88902dc5eb"
|
||||||
|
integrity sha512-OEdH7SyC1suTdhBGW91/zBfR6qaIhThbcN8PUXtXilY4GYnSBbVqOntdHbC1vXwsDnX0Qix2m2+DSU1J51ybOQ==
|
||||||
|
|
||||||
|
"@fortawesome/fontawesome-svg-core@^1.2.32":
|
||||||
|
version "1.2.32"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-1.2.32.tgz#da092bfc7266aa274be8604de610d7115f9ba6cf"
|
||||||
|
integrity sha512-XjqyeLCsR/c/usUpdWcOdVtWFVjPbDFBTQkn2fQRrWhhUoxriQohO2RWDxLyUM8XpD+Zzg5xwJ8gqTYGDLeGaQ==
|
||||||
|
dependencies:
|
||||||
|
"@fortawesome/fontawesome-common-types" "^0.2.32"
|
||||||
|
|
||||||
|
"@fortawesome/free-solid-svg-icons@^5.15.1":
|
||||||
|
version "5.15.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-5.15.1.tgz#e1432676ddd43108b41197fee9f86d910ad458ef"
|
||||||
|
integrity sha512-EFMuKtzRMNbvjab/SvJBaOOpaqJfdSap/Nl6hst7CgrJxwfORR1drdTV6q1Ib/JVzq4xObdTDcT6sqTaXMqfdg==
|
||||||
|
dependencies:
|
||||||
|
"@fortawesome/fontawesome-common-types" "^0.2.32"
|
||||||
|
|
||||||
|
"@fortawesome/react-fontawesome@^0.1.11":
|
||||||
|
version "0.1.11"
|
||||||
|
resolved "https://registry.yarnpkg.com/@fortawesome/react-fontawesome/-/react-fontawesome-0.1.11.tgz#c1a95a2bdb6a18fa97b355a563832e248bf6ef4a"
|
||||||
|
integrity sha512-sClfojasRifQKI0OPqTy8Ln8iIhnxR/Pv/hukBhWnBz9kQRmqi6JSH3nghlhAY7SUeIIM7B5/D2G8WjX0iepVg==
|
||||||
|
dependencies:
|
||||||
|
prop-types "^15.7.2"
|
||||||
|
|
||||||
"@hapi/[email protected]":
|
"@hapi/[email protected]":
|
||||||
version "2.1.4"
|
version "2.1.4"
|
||||||
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
|
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"*": ["types/*"]
|
"*": ["types/*"]
|
||||||
},
|
},
|
||||||
"outDir": "./",
|
"outDir": "./",
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"*": ["types/*"]
|
"*": ["types/*"]
|
||||||
},
|
},
|
||||||
"outDir": "./",
|
"outDir": "./",
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
|
|||||||
Reference in new issue
Block a user