mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 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
+257
-98
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 { 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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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 };
|
||||
};
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -59,10 +59,10 @@ export const SelloutItem = (listing) => {
|
||||
</Typography>
|
||||
</div>
|
||||
<ImageDisplay imgURL={listing.img} />
|
||||
<Typography variant="h7" className={classes.desc}>
|
||||
<Typography variant="h6" className={classes.desc}>
|
||||
{listing.description}
|
||||
</Typography>
|
||||
<div className={classes.postActions}>
|
||||
<div>
|
||||
<Button>
|
||||
<ChatIcon style={{ color: "#f44336" }} />
|
||||
</Button>
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ export const ImageDisplay = ({ imgURL }) => {
|
||||
return (
|
||||
<img
|
||||
src={imgURL}
|
||||
alt="Image"
|
||||
alt="twitter display"
|
||||
style={{ height: 200, width: 350, margin: "auto" }}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<ListItem onClick={() => onClick(options)} button>
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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<Image[]>([]);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ function Avatar({ avatarUrl, showInvalidImage, height, width }) {
|
||||
<img
|
||||
className={classes.img}
|
||||
src={showInvalidImage ? IMG_INVALID_AVATAR : IMG_DEFAULT_AVATAR}
|
||||
alt="Invalid avatar image"
|
||||
alt="Invalid avatar"
|
||||
style={{ height, width }}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -69,7 +69,7 @@ export const TwitterApp = () => {
|
||||
return (
|
||||
<AppWrapper id="twitter-app">
|
||||
<AddTweetModal />
|
||||
<div className={modalVisible ? classes.backgroundModal : null} />
|
||||
<div className={modalVisible ? classes.backgroundModal : undefined} />
|
||||
<TwitterTitle />
|
||||
<AppContent>
|
||||
{promptProfileName ? (
|
||||
|
||||
@@ -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 (
|
||||
<>
|
||||
<div className={classes.root}>
|
||||
@@ -49,7 +51,7 @@ function TwitterSearch() {
|
||||
inputRef={(input) => input && input.focus()}
|
||||
/>
|
||||
</div>
|
||||
{tweets && tweets.length > 0 && <TweetList tweets={tweets} />}
|
||||
{filteredTweets.length > 0 && <TweetList tweets={tweets} />}
|
||||
</div>
|
||||
<SearchButton handleClick={handleSubmit} />
|
||||
</>
|
||||
|
||||
@@ -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<string | null>(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 (
|
||||
<Snackbar
|
||||
|
||||
@@ -49,7 +49,11 @@ export const Image = ({ link, handleClick, small }) => {
|
||||
<CloseIcon />
|
||||
</IconButton>
|
||||
)}
|
||||
<img className={small ? classes.imgSmall : classes.img} src={link} />
|
||||
<img
|
||||
alt="small avatar"
|
||||
className={small ? classes.imgSmall : classes.img}
|
||||
src={link}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { atom } from "recoil";
|
||||
export const twitterState = {
|
||||
profile: atom({
|
||||
key: "profile",
|
||||
default: null,
|
||||
default: {},
|
||||
}),
|
||||
tweets: atom({
|
||||
key: "tweets",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRecoilValue, useSetRecoilState } from "recoil";
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { twitterState } from "./state";
|
||||
|
||||
export const useTweets = () => {
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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 { 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 (
|
||||
<AppWrapper>
|
||||
<AppTitle app="Call" />
|
||||
<AppTitle
|
||||
app={{
|
||||
backgroundColor: green[400],
|
||||
color: green[50],
|
||||
nameLocale: "Call",
|
||||
}}
|
||||
variant="h4"
|
||||
/>
|
||||
<AppContent>
|
||||
<h1
|
||||
style={{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { useRecoilState } from "recoil";
|
||||
import { callerState } from "./state";
|
||||
|
||||
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),
|
||||
};
|
||||
|
||||
const setEscape = useSetRecoilState(keyboardState.Escape);
|
||||
const setEscape = useSetRecoilState<any>(keyboardState.Escape);
|
||||
|
||||
useEffect(
|
||||
function handleNUIKeyboardMessage() {
|
||||
|
||||
@@ -35,17 +35,17 @@ export const Navigation = () => {
|
||||
<BottomNavigationAction
|
||||
label="Phone"
|
||||
value={() => history.push("/phone")}
|
||||
icon={<PhoneIcon className={classes.icon} />}
|
||||
icon={<PhoneIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
label="Home"
|
||||
value={() => history.push("/")}
|
||||
icon={<AppsIcon className={classes.icon} />}
|
||||
icon={<AppsIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
label="Close"
|
||||
value={() => closePhone()}
|
||||
icon={<RadioButtonUncheckedIcon className={classes.icon} />}
|
||||
icon={<RadioButtonUncheckedIcon />}
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
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();
|
||||
return (
|
||||
<Grid
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { eventNameFactory } from "../utils/nuiUtils";
|
||||
|
||||
export const useNuiEvent = (app, method, handler, options = {}) => {
|
||||
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(() => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,6 +7,6 @@ export const phoneState = {
|
||||
}),
|
||||
phoneConfig: atom({
|
||||
key: "phoneConfig",
|
||||
default: null,
|
||||
default: undefined,
|
||||
}),
|
||||
};
|
||||
@@ -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 };
|
||||
|
||||
@@ -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 (
|
||||
<Paper className={classes.wrapper}>
|
||||
<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
|
||||
className={classes.backdrop}
|
||||
open={backdrop || false}
|
||||
|
||||
@@ -4,22 +4,29 @@ import Avatar from "@material-ui/core/Avatar";
|
||||
import { green } from "@material-ui/core/colors";
|
||||
import { Button } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
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({
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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
|
||||
|
||||
Whitespace-only changes.
@@ -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);
|
||||
|
||||
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 {
|
||||
id?: string;
|
||||
children: any;
|
||||
style?: any;
|
||||
handleClickAway?: any;
|
||||
|
||||
@@ -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/[email protected]":
|
||||
version "2.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-2.1.4.tgz#5d67ed43f3fd41a69d4b9ff7b56e7c0d1d0a81e5"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"*": ["types/*"]
|
||||
},
|
||||
"outDir": "./",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitAny": true,
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"allowJs": true,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"*": ["types/*"]
|
||||
},
|
||||
"outDir": "./",
|
||||
"noImplicitAny": false,
|
||||
"noImplicitAny": true,
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"allowJs": false,
|
||||
|
||||
Reference in new issue
Block a user