diff --git a/phone/.env b/phone/.env deleted file mode 100644 index 7512f11..0000000 --- a/phone/.env +++ /dev/null @@ -1 +0,0 @@ -TSC_COMPILE_ON_ERROR=true \ No newline at end of file diff --git a/phone/src/apps/contacts/components/ContactList.tsx b/phone/src/apps/contacts/components/ContactList.tsx index 7edd44c..73aa274 100644 --- a/phone/src/apps/contacts/components/ContactList.tsx +++ b/phone/src/apps/contacts/components/ContactList.tsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React from "react"; import ListItemText from "@material-ui/core/ListItemText"; import { Button } from "@material-ui/core"; @@ -13,7 +13,6 @@ import Nui from "../../../os/nui-events/utils/Nui"; export const ContactList = () => { const contacts = useContacts(); - const [call, setCall] = useState(""); const startCall = (number) => { console.log(number); diff --git a/phone/src/apps/contacts/components/ContactModal.tsx b/phone/src/apps/contacts/components/ContactModal.tsx index c6950d5..d115adb 100644 --- a/phone/src/apps/contacts/components/ContactModal.tsx +++ b/phone/src/apps/contacts/components/ContactModal.tsx @@ -30,7 +30,7 @@ const useStyles = makeStyles((theme) => ({ }, })); -export const AddContactModal = ({ handleClose, show, children }) => { +export const AddContactModal = ({ handleClose, show }) => { const [name, setName] = useState(""); const [number, setNumber] = useState(""); const classes = useStyles(); diff --git a/phone/src/apps/contacts/components/ContactsApp.tsx b/phone/src/apps/contacts/components/ContactsApp.tsx index de98f0d..a9ad942 100644 --- a/phone/src/apps/contacts/components/ContactsApp.tsx +++ b/phone/src/apps/contacts/components/ContactsApp.tsx @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import { makeStyles } from "@material-ui/core/styles"; import { AppWrapper } from "../../../ui/components"; import { AppTitle } from "../../../ui/components/AppTitle"; import { AppContent } from "../../../ui/components/AppContent"; @@ -9,20 +8,8 @@ import AddCircleIcon from "@material-ui/icons/AddCircle"; import { AddContactModal } from "./ContactModal"; 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 = () => { const [modal, setModal] = useState(false); - const classes = useStyles(); const contacts = useApp("CONTACTS"); const openModal = () => { diff --git a/phone/src/apps/contacts/hooks/useContacts.ts b/phone/src/apps/contacts/hooks/useContacts.ts index 1b5f41f..6cddeda 100644 --- a/phone/src/apps/contacts/hooks/useContacts.ts +++ b/phone/src/apps/contacts/hooks/useContacts.ts @@ -1,7 +1,17 @@ import { useRecoilValue } from "recoil"; 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); return { contacts }; }; diff --git a/phone/src/apps/messages/hooks/useMessages.ts b/phone/src/apps/messages/hooks/useMessages.ts deleted file mode 100644 index e69de29..0000000 diff --git a/phone/src/apps/messages/index.ts b/phone/src/apps/messages/index.ts deleted file mode 100644 index e69de29..0000000 diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx index 6af692b..3e93cba 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutItem.tsx @@ -59,10 +59,10 @@ export const SelloutItem = (listing) => { - + {listing.description} -
+
diff --git a/phone/src/apps/sellout/components/SelloutTitle.tsx b/phone/src/apps/sellout/components/SelloutTitle.tsx index 02cb752..0464a08 100644 --- a/phone/src/apps/sellout/components/SelloutTitle.tsx +++ b/phone/src/apps/sellout/components/SelloutTitle.tsx @@ -1,7 +1,6 @@ import React from "react"; import Paper from "@material-ui/core/Paper"; import { makeStyles } from "@material-ui/core"; -import LinkedInIcon from "@material-ui/icons/LinkedIn"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAd } from "@fortawesome/free-solid-svg-icons"; diff --git a/phone/src/apps/sellout/components/images/ImageDisplay.tsx b/phone/src/apps/sellout/components/images/ImageDisplay.tsx index 60836c0..7145b0c 100644 --- a/phone/src/apps/sellout/components/images/ImageDisplay.tsx +++ b/phone/src/apps/sellout/components/images/ImageDisplay.tsx @@ -4,7 +4,7 @@ export const ImageDisplay = ({ imgURL }) => { return ( Image ); diff --git a/phone/src/apps/settings/components/SettingItem.tsx b/phone/src/apps/settings/components/SettingItem.tsx index 075299e..90a2897 100644 --- a/phone/src/apps/settings/components/SettingItem.tsx +++ b/phone/src/apps/settings/components/SettingItem.tsx @@ -1,7 +1,14 @@ import React from "react"; 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 ( <> onClick(options)} button> diff --git a/phone/src/apps/settings/hooks/useSettings.ts b/phone/src/apps/settings/hooks/useSettings.ts index bd791ed..61def22 100644 --- a/phone/src/apps/settings/hooks/useSettings.ts +++ b/phone/src/apps/settings/hooks/useSettings.ts @@ -8,7 +8,7 @@ const settingsState = atom({ default: Default, }); -export const useSettings = () => { +export const useSettings = (): any => { const [settings, setSettings] = useConfig(settingsState); const [config] = useConfig(); const currentTheme = () => createMuiTheme(config.themes[settings.theme]); diff --git a/phone/src/apps/twitter/components/AddTweetModal.tsx b/phone/src/apps/twitter/components/AddTweetModal.tsx index 8e8b967..2c5f09c 100644 --- a/phone/src/apps/twitter/components/AddTweetModal.tsx +++ b/phone/src/apps/twitter/components/AddTweetModal.tsx @@ -52,6 +52,11 @@ const useStyles = makeStyles((theme) => ({ }, })); +interface Image { + id: string; + link: string; +} + export const AddTweetModal = () => { const classes = useStyles(); const { message, setMessage, modalVisible, setModalVisible } = useModal(); @@ -61,10 +66,10 @@ export const AddTweetModal = () => { const [showImagePrompt, setShowImagePrompt] = useState(false); const [link, setLink] = useState(""); - const [images, setImages] = useState([]); + const [images, setImages] = useState([]); const reset = () => { - setShowImagePrompt(null); + setShowImagePrompt(false); setShowEmoji(false); setLink(""); @@ -79,16 +84,18 @@ export const AddTweetModal = () => { // when the user presses escape we should close the modal const _handleEscape = (e) => { - const isEscapeKey = e.key == "Escape" || e.key == "Esc"; + 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); - }, []); + window.addEventListener("keydown", _handleEscape, true); + return () => window.removeEventListener("keydown", _handleEscape); + }); + + if (!config) return null; const submitTweet = () => { const cleanedMessage = message.trim(); @@ -140,7 +147,7 @@ export const AddTweetModal = () => { const toggleShowEmoji = () => { // clear the images so we can seemlessly toggle between emoji/images setShowImagePrompt(false); - setImages(""); + setImages([]); setShowEmoji(!showEmoji); }; diff --git a/phone/src/apps/twitter/components/Avatar.tsx b/phone/src/apps/twitter/components/Avatar.tsx index 35f4d83..b917cd6 100644 --- a/phone/src/apps/twitter/components/Avatar.tsx +++ b/phone/src/apps/twitter/components/Avatar.tsx @@ -30,7 +30,7 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) { Invalid avatar image )} diff --git a/phone/src/apps/twitter/components/TwitterApp.tsx b/phone/src/apps/twitter/components/TwitterApp.tsx index 2f7397a..f264676 100644 --- a/phone/src/apps/twitter/components/TwitterApp.tsx +++ b/phone/src/apps/twitter/components/TwitterApp.tsx @@ -69,7 +69,7 @@ export const TwitterApp = () => { return ( -
+
{promptProfileName ? ( diff --git a/phone/src/apps/twitter/components/TwitterSearch.tsx b/phone/src/apps/twitter/components/TwitterSearch.tsx index 8e033bf..187e05a 100644 --- a/phone/src/apps/twitter/components/TwitterSearch.tsx +++ b/phone/src/apps/twitter/components/TwitterSearch.tsx @@ -24,7 +24,7 @@ function TwitterSearch() { const classes = useStyles(); const { t } = useTranslation(); const [searchValue, setSearchValue] = useState(""); - const { tweets, setTweets } = useFilteredTweets(); + const { tweets } = useFilteredTweets(); const handleChange = (e) => setSearchValue(e.target.value); @@ -35,6 +35,8 @@ function TwitterSearch() { Nui.send("phone:fetchTweetsFiltered", cleanedSearchValue); }; + const filteredTweets = tweets || []; + return ( <>
@@ -49,7 +51,7 @@ function TwitterSearch() { inputRef={(input) => input && input.focus()} />
- {tweets && tweets.length > 0 && } + {filteredTweets.length > 0 && }
diff --git a/phone/src/apps/twitter/components/alerts/AlertBar.tsx b/phone/src/apps/twitter/components/alerts/AlertBar.tsx index 10dbce5..4de4583 100644 --- a/phone/src/apps/twitter/components/alerts/AlertBar.tsx +++ b/phone/src/apps/twitter/components/alerts/AlertBar.tsx @@ -21,8 +21,8 @@ export default function AlertBar() { const { t } = useTranslation(); const { updateProfileSuccessful, setUpdateProfileSuccessful } = useProfile(); const { createTweetSuccessful, setCreateTweetSuccessful } = useTweetStatus(); - const [severity, setSeverity] = useState(null); - const [open, setOpen] = useState(null); + const [severity, setSeverity] = useState(null); + const [open, setOpen] = useState(false); const [message, setMessage] = useState(null); const handleClose = () => { @@ -49,7 +49,7 @@ export default function AlertBar() { setSeverity("error"); setMessage(t("APPS_TWITTER_EDIT_PROFILE_FAILURE")); } - }, [updateProfileSuccessful, createTweetSuccessful]); + }, [updateProfileSuccessful, createTweetSuccessful, t]); return ( { )} - + small avatar
); }; diff --git a/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx b/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx index 307aecb..2d83882 100644 --- a/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx +++ b/phone/src/apps/twitter/components/profile/ProfilePrompt.tsx @@ -23,6 +23,7 @@ export function ProfilePrompt() { const classes = useStyles(); const { t } = useTranslation(); const { profile } = useProfile(); + const [name, handleNameChange] = useState(profile.profile_name || ""); const handleUpdate = () => { diff --git a/phone/src/apps/twitter/components/tweet/Tweet.tsx b/phone/src/apps/twitter/components/tweet/Tweet.tsx index 138f5b7..8d91505 100644 --- a/phone/src/apps/twitter/components/tweet/Tweet.tsx +++ b/phone/src/apps/twitter/components/tweet/Tweet.tsx @@ -7,7 +7,6 @@ import { 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"; diff --git a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx index 878817a..7818ca6 100644 --- a/phone/src/apps/twitter/components/tweet/TweetMessage.tsx +++ b/phone/src/apps/twitter/components/tweet/TweetMessage.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useRef } from "react"; +import React from "react"; import { useTranslation } from "react-i18next"; import { makeStyles } from "@material-ui/core/styles"; import { TextField } from "@material-ui/core"; @@ -23,6 +23,8 @@ export const TweetMessage = ({ message, handleChange }) => { const { config } = usePhone(); const { t } = useTranslation(); + if (!config) return null; + const overCharacterLimit = message.trim().length > config.twitter.characterLimit; const characterWarningPrompt = `${t( diff --git a/phone/src/apps/twitter/hooks/state.ts b/phone/src/apps/twitter/hooks/state.ts index 130a509..a908080 100644 --- a/phone/src/apps/twitter/hooks/state.ts +++ b/phone/src/apps/twitter/hooks/state.ts @@ -3,7 +3,7 @@ import { atom } from "recoil"; export const twitterState = { profile: atom({ key: "profile", - default: null, + default: {}, }), tweets: atom({ key: "tweets", diff --git a/phone/src/apps/twitter/hooks/useProfile.ts b/phone/src/apps/twitter/hooks/useProfile.ts index a8982e5..388317c 100644 --- a/phone/src/apps/twitter/hooks/useProfile.ts +++ b/phone/src/apps/twitter/hooks/useProfile.ts @@ -1,7 +1,22 @@ import { useRecoilValue, useRecoilState } from "recoil"; 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 updateProfileLoading = useRecoilValue( twitterState.updateProfileLoading diff --git a/phone/src/apps/twitter/hooks/useTweets.ts b/phone/src/apps/twitter/hooks/useTweets.ts index 7b24c1c..2753b39 100644 --- a/phone/src/apps/twitter/hooks/useTweets.ts +++ b/phone/src/apps/twitter/hooks/useTweets.ts @@ -1,4 +1,4 @@ -import { useRecoilValue, useSetRecoilState } from "recoil"; +import { useRecoilValue } from "recoil"; import { twitterState } from "./state"; export const useTweets = () => { diff --git a/phone/src/config/hooks/useConfig.ts b/phone/src/config/hooks/useConfig.ts index 4db3ecf..87e2fcf 100644 --- a/phone/src/config/hooks/useConfig.ts +++ b/phone/src/config/hooks/useConfig.ts @@ -6,7 +6,7 @@ const configState = atom({ default: Default, }); -export const useConfig = (state = configState) => { +export const useConfig = (state: any = configState): any => { const [config, _setConfig] = useRecoilState(state); const setConfig = (key, value) => { diff --git a/phone/src/config/interface.ts b/phone/src/config/interface.ts new file mode 100644 index 0000000..7fc2e0e --- /dev/null +++ b/phone/src/config/interface.ts @@ -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; +} diff --git a/phone/src/modal/components/CallModal.tsx b/phone/src/modal/components/CallModal.tsx index 2943c57..6fd581e 100644 --- a/phone/src/modal/components/CallModal.tsx +++ b/phone/src/modal/components/CallModal.tsx @@ -1,14 +1,20 @@ import React from "react"; -import { makeStyles } from "@material-ui/core"; +import { green } from "@material-ui/core/colors"; import { AppWrapper } from "../../ui/components/AppWrapper"; import { AppTitle } from "../../ui/components/AppTitle"; import { AppContent } from "../../ui/components/AppContent"; -import { Button } from "../../ui/components/Button"; export const CallModal = () => { return ( - +

{ diff --git a/phone/src/os/interfaces/serverConfig.ts b/phone/src/os/interfaces/serverConfig.ts new file mode 100644 index 0000000..7fc2e0e --- /dev/null +++ b/phone/src/os/interfaces/serverConfig.ts @@ -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; +} diff --git a/phone/src/os/keyboard/hooks/useKeyboard.ts b/phone/src/os/keyboard/hooks/useKeyboard.ts index 0b02a39..7430e37 100644 --- a/phone/src/os/keyboard/hooks/useKeyboard.ts +++ b/phone/src/os/keyboard/hooks/useKeyboard.ts @@ -55,7 +55,7 @@ export const useInitKeyboard = () => { Escape: useRecoilValue(keyboardState.Escape), }; - const setEscape = useSetRecoilState(keyboardState.Escape); + const setEscape = useSetRecoilState(keyboardState.Escape); useEffect( function handleNUIKeyboardMessage() { diff --git a/phone/src/os/navigation-bar/components/Navigation.tsx b/phone/src/os/navigation-bar/components/Navigation.tsx index c41b8f3..8000d74 100644 --- a/phone/src/os/navigation-bar/components/Navigation.tsx +++ b/phone/src/os/navigation-bar/components/Navigation.tsx @@ -35,17 +35,17 @@ export const Navigation = () => { history.push("/phone")} - icon={} + icon={} /> history.push("/")} - icon={} + icon={} /> closePhone()} - icon={} + icon={} /> ({ }, })); -export const NotificationBar = ({ notifications = [] }) => { +interface INotification { + key: string; + icon: JSX.Element; +} + +interface IProps { + notifications?: INotification[]; +} + +export const NotificationBar = ({ notifications = [] }: IProps) => { const classes = useStyles(); return ( { - const savedHandler = useRef(); +interface IOptions { + capture?: boolean; + passive?: boolean; + once?: boolean; +} + +export const useNuiEvent = (app, method, handler, options: IOptions = {}) => { + const savedHandler: any = useRef(); const { capture, passive, once } = options; useEffect(() => { diff --git a/phone/src/os/nui-events/hooks/useNuiService.ts b/phone/src/os/nui-events/hooks/useNuiService.ts index a0126bd..0e8bfc3 100644 --- a/phone/src/os/nui-events/hooks/useNuiService.ts +++ b/phone/src/os/nui-events/hooks/useNuiService.ts @@ -1,7 +1,13 @@ import { useEffect } from "react"; 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 eventListener = (event) => { const { app, method, data } = event.data; diff --git a/phone/src/os/phone/hooks/state.ts b/phone/src/os/phone/hooks/state.ts index f978ba3..8af0dc6 100644 --- a/phone/src/os/phone/hooks/state.ts +++ b/phone/src/os/phone/hooks/state.ts @@ -7,6 +7,6 @@ export const phoneState = { }), phoneConfig: atom({ key: "phoneConfig", - default: null, + default: undefined, }), }; diff --git a/phone/src/os/phone/hooks/usePhone.ts b/phone/src/os/phone/hooks/usePhone.ts index 2164ed3..43443a0 100644 --- a/phone/src/os/phone/hooks/usePhone.ts +++ b/phone/src/os/phone/hooks/usePhone.ts @@ -1,7 +1,13 @@ import { useRecoilValue } from "recoil"; 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 config = useRecoilValue(phoneState.phoneConfig); return { visibility, config }; diff --git a/phone/src/ui/components/AppContent.tsx b/phone/src/ui/components/AppContent.tsx index a40a3e6..6908dfc 100644 --- a/phone/src/ui/components/AppContent.tsx +++ b/phone/src/ui/components/AppContent.tsx @@ -2,7 +2,7 @@ import React from "react"; import { Box, makeStyles, Backdrop, Paper } from "@material-ui/core"; import { AppContentTypes } from "../interface/InterfaceUI"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ wrapper: { height: "67vh", overflow: "auto", @@ -34,7 +34,7 @@ export const AppContent = ({ return ( - + ({ - root: { - display: "flex", - "& > *": { - margin: theme.spacing(1), +interface IStyles { + root: any; + avatar: any; +} + +const useStyles = makeStyles( + (theme): IStyles => ({ + root: { + display: "flex", + "& > *": { + margin: theme.spacing(1), + }, + padding: 0, }, - padding: 0, - }, - avatar: { - backgroundColor: ({ backgroundColor }) => backgroundColor, - color: ({ color }) => color, - width: theme.spacing(7), - height: theme.spacing(7), - fontSize: theme.typography.h4.fontSize, - }, -})); + avatar: { + backgroundColor: ({ backgroundColor }) => backgroundColor, + color: ({ color }) => color, + width: theme.spacing(7), + height: theme.spacing(7), + fontSize: theme.typography.h4.fontSize, + }, + }) +); export const AppIcon = ({ name, icon, backgroundColor, color }) => { const classes = useStyles({ diff --git a/phone/src/ui/components/AppTitle.tsx b/phone/src/ui/components/AppTitle.tsx index 09bddd8..58e6cd5 100644 --- a/phone/src/ui/components/AppTitle.tsx +++ b/phone/src/ui/components/AppTitle.tsx @@ -1,23 +1,37 @@ import React from "react"; import { Typography, Box, makeStyles } from "@material-ui/core"; import { useTranslation } from "react-i18next"; +import { Variant } from "@material-ui/core/styles/createTypography"; -const useStyle = makeStyles((theme) => ({ - root: ({ backgroundColor }) => ({ - width: "100%", - textAlign: "center", - backgroundColor: backgroundColor || theme.palette.background.default, - }), - text: ({ color }) => ({ - color: color || theme.palette.text.primary, - }), -})); +interface IProps { + app: any; + className?: string; + variant?: Variant; +} + +interface IUseStyle { + root: any; + text: any; +} + +const useStyle = makeStyles( + (theme): IUseStyle => ({ + root: ({ backgroundColor }) => ({ + width: "100%", + textAlign: "center", + backgroundColor: backgroundColor || theme.palette.background.default, + }), + text: ({ color }) => ({ + color: color || theme.palette.text.primary, + }), + }) +); export const AppTitle = ({ app: { backgroundColor, color, nameLocale }, variant = "h4", ...props -}) => { +}: IProps) => { const classes = useStyle({ color, backgroundColor }); const { t } = useTranslation(); return ( diff --git a/phone/src/ui/components/Modal.tsx b/phone/src/ui/components/Modal.tsx index c7fcfed..7613f8d 100644 --- a/phone/src/ui/components/Modal.tsx +++ b/phone/src/ui/components/Modal.tsx @@ -2,7 +2,7 @@ import React, { useEffect } from "react"; import { makeStyles } from "@material-ui/core/styles"; import { Paper } from "@material-ui/core"; -const useStyles = makeStyles((theme) => ({ +const useStyles = makeStyles(() => ({ root: { zIndex: 10, background: "#424242", @@ -31,16 +31,16 @@ export const Modal = ({ children, visible, handleClose }) => { // when the user presses escape we should close the modal const _handleEscape = (e) => { - const isEscapeKey = e.key == "Escape" || e.key == "Esc"; + 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); - }, []); + window.addEventListener("keydown", _handleEscape, true); + return () => window.removeEventListener("keydown", _handleEscape); + }); const showHideClassName = visible ? classes.displayBlock diff --git a/phone/src/ui/hooks/phoneState.ts b/phone/src/ui/hooks/phoneState.ts deleted file mode 100644 index e69de29..0000000 diff --git a/phone/src/ui/hooks/useContextMenu.tsx b/phone/src/ui/hooks/useContextMenu.tsx index 5f1a2b3..7305e8a 100644 --- a/phone/src/ui/hooks/useContextMenu.tsx +++ b/phone/src/ui/hooks/useContextMenu.tsx @@ -1,6 +1,8 @@ import React, { useState } from "react"; import { ContextMenu } from "../components/ContextMenu"; +type UseContextMenu = [any, any, () => JSX.Element, boolean]; + export const MapStringOptions = (current, onClick) => (string) => { return { selected: current === string, @@ -10,8 +12,8 @@ export const MapStringOptions = (current, onClick) => (string) => { }; }; -export const useContextMenu = (_options = []) => { - const [open, setOpen] = useState(); +export const useContextMenu = (_options = []): UseContextMenu => { + const [open, setOpen] = useState(false); const [options, setOptions] = useState(_options); const onClose = () => setOpen(false); diff --git a/phone/src/ui/hooks/useModal.ts b/phone/src/ui/hooks/useModal.ts deleted file mode 100644 index e69de29..0000000 diff --git a/phone/src/ui/hooks/usePhoneService.ts b/phone/src/ui/hooks/usePhoneService.ts deleted file mode 100644 index 7e7a595..0000000 --- a/phone/src/ui/hooks/usePhoneService.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { atom, selector, useRecoilState } from "recoil"; -import { useNuiEvent } from "../../os/nui-events/hooks"; diff --git a/phone/src/ui/interface/InterfaceUI.ts b/phone/src/ui/interface/InterfaceUI.ts index 6669d62..c2b2933 100644 --- a/phone/src/ui/interface/InterfaceUI.ts +++ b/phone/src/ui/interface/InterfaceUI.ts @@ -6,6 +6,7 @@ export interface AppContentTypes { } export interface AppWrapperTypes { + id?: string; children: any; style?: any; handleClickAway?: any; diff --git a/phone/yarn.lock b/phone/yarn.lock index 279311c..1b32522 100644 --- a/phone/yarn.lock +++ b/phone/yarn.lock @@ -1217,6 +1217,37 @@ resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.5.tgz#77211291c1900a700b8a78cfafda3160d76949ed" 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/address@2.x.x": version "2.1.4" resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5" diff --git a/resources/client/tsconfig.json b/resources/client/tsconfig.json index 48924e7..15d8e64 100644 --- a/resources/client/tsconfig.json +++ b/resources/client/tsconfig.json @@ -5,7 +5,7 @@ "*": ["types/*"] }, "outDir": "./", - "noImplicitAny": false, + "noImplicitAny": true, "module": "commonjs", "target": "es6", "allowJs": true, diff --git a/resources/server/tsconfig.json b/resources/server/tsconfig.json index 7e89f45..5ee2046 100644 --- a/resources/server/tsconfig.json +++ b/resources/server/tsconfig.json @@ -5,7 +5,7 @@ "*": ["types/*"] }, "outDir": "./", - "noImplicitAny": false, + "noImplicitAny": true, "module": "commonjs", "target": "es6", "allowJs": false,