mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
Merge branch 'master' into feat/sellout-app
This commit is contained in:
46 files changed
+4495
-587
No files matched your search
@@ -4,13 +4,12 @@ import { Button, TextField } from "@material-ui/core";
|
||||
import Nui from "../../../os/nui-events/utils/Nui";
|
||||
import List from "@material-ui/core/List";
|
||||
import ListItem from "@material-ui/core/ListItem";
|
||||
import Modal from '../../../ui/components/Modal';
|
||||
import { useModal } from '../hooks/useModal';
|
||||
import ClearIcon from '@material-ui/icons/Clear';
|
||||
import PersonIcon from '@material-ui/icons/Person';
|
||||
import PhoneIcon from '@material-ui/icons/Phone';
|
||||
import AccountCircleIcon from '@material-ui/icons/AccountCircle';
|
||||
|
||||
import Modal from "../../../ui/components/Modal";
|
||||
import { useModal } from "../hooks/useModal";
|
||||
import ClearIcon from "@material-ui/icons/Clear";
|
||||
import PersonIcon from "@material-ui/icons/Person";
|
||||
import PhoneIcon from "@material-ui/icons/Phone";
|
||||
import AccountCircleIcon from "@material-ui/icons/AccountCircle";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) => ({
|
||||
button: {
|
||||
@@ -26,32 +25,32 @@ const useStyles = makeStyles((theme: Theme) => ({
|
||||
height: "20%",
|
||||
},
|
||||
clearButton: {
|
||||
width: '10%',
|
||||
position: 'absolute',
|
||||
right: 0
|
||||
width: "10%",
|
||||
position: "absolute",
|
||||
right: 0,
|
||||
},
|
||||
textInputField: {
|
||||
fontSize: 20,
|
||||
borderBottomColor: 'red'
|
||||
borderBottomColor: "red",
|
||||
},
|
||||
addBtn: {
|
||||
margin: 'auto',
|
||||
margin: "auto",
|
||||
fontSize: 16,
|
||||
width: 150,
|
||||
background: "#2196f3",
|
||||
marginBottom: 10,
|
||||
padding: 8
|
||||
padding: 8,
|
||||
},
|
||||
cancelBtn: {
|
||||
margin: 'auto',
|
||||
margin: "auto",
|
||||
width: 150,
|
||||
background: "#232323",
|
||||
marginBottom: 20,
|
||||
padding: 8
|
||||
padding: 8,
|
||||
},
|
||||
icons: {
|
||||
marginRight: 5
|
||||
}
|
||||
marginRight: 5,
|
||||
},
|
||||
}));
|
||||
|
||||
export const AddContactModal = () => {
|
||||
@@ -69,25 +68,27 @@ export const AddContactModal = () => {
|
||||
Nui.send("contacts:add", {
|
||||
name,
|
||||
number,
|
||||
avatar
|
||||
avatar,
|
||||
});
|
||||
console.log(name, number, avatar);
|
||||
}
|
||||
};
|
||||
|
||||
const _handleClose = () => {
|
||||
setShowModal(false)
|
||||
}
|
||||
setShowModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal visible={showModal} handleClose={_handleClose}>
|
||||
<Button onClick={_handleClose} className={classes.clearButton}><ClearIcon /></Button>
|
||||
<Button onClick={_handleClose} className={classes.clearButton}>
|
||||
<ClearIcon />
|
||||
</Button>
|
||||
<List style={{ marginTop: 30 }}>
|
||||
<ListItem>
|
||||
<PersonIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={name}
|
||||
inputProps={{ className: classes.textInputField}}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setName(e.target.value)}
|
||||
fullWidth
|
||||
variant="standard"
|
||||
@@ -98,7 +99,7 @@ export const AddContactModal = () => {
|
||||
<PhoneIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={number}
|
||||
inputProps={{ className: classes.textInputField}}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setNumber(e.target.value)}
|
||||
fullWidth
|
||||
placeholder="Number"
|
||||
@@ -110,7 +111,7 @@ export const AddContactModal = () => {
|
||||
<AccountCircleIcon className={classes.icons} />
|
||||
<TextField
|
||||
value={avatar}
|
||||
inputProps={{ className: classes.textInputField}}
|
||||
inputProps={{ className: classes.textInputField }}
|
||||
onChange={(e) => setAvatar(e.target.value)}
|
||||
fullWidth
|
||||
placeholder="Avatar URL"
|
||||
@@ -118,8 +119,10 @@ export const AddContactModal = () => {
|
||||
type="text"
|
||||
/>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Button className={classes.addBtn} onClick={addContact}>Add Contact</Button>
|
||||
</List>
|
||||
<Button className={classes.addBtn} onClick={addContact}>
|
||||
Add Contact
|
||||
</Button>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react'
|
||||
import React from "react";
|
||||
import { makeStyles, createStyles, Theme } from "@material-ui/core/styles";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import ContactsIcon from "@material-ui/icons/Contacts";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
root: {
|
||||
height: "60px",
|
||||
@@ -21,12 +21,11 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
export const ContactTitle = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||
<ContactsIcon className={classes.icon} />
|
||||
</Paper>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -6,14 +6,13 @@ import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { ContactList } from "./List/ContactList";
|
||||
import { useApp } from "../../../os/apps/hooks/useApps";
|
||||
import { AddContactModal } from "./ContactModal";
|
||||
import { useModal } from '../hooks/useModal';
|
||||
import { useModal } from "../hooks/useModal";
|
||||
import { SearchContacts } from "./List/SearchContacts";
|
||||
import PersonAddIcon from '@material-ui/icons/PersonAdd'
|
||||
import Fab from '@material-ui/core/Fab';
|
||||
import { useContactModal } from '../hooks/useContactModal';
|
||||
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
backgroundModal: {
|
||||
background: "black",
|
||||
@@ -26,7 +25,7 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
zIndex: 5,
|
||||
},
|
||||
absolute: {
|
||||
position: 'sticky',
|
||||
position: "sticky",
|
||||
bottom: theme.spacing(2),
|
||||
left: theme.spacing(3),
|
||||
},
|
||||
@@ -34,7 +33,6 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
);
|
||||
|
||||
export const ContactsApp = () => {
|
||||
|
||||
const classes = useStyles();
|
||||
const { showModal, setShowModal } = useModal();
|
||||
const contacts = useApp("CONTACTS");
|
||||
@@ -44,16 +42,19 @@ export const ContactsApp = () => {
|
||||
setShowModal(true);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<AppWrapper id="contact-app">
|
||||
<AppTitle app={contacts}></AppTitle>
|
||||
<SearchContacts />
|
||||
<AddContactModal/>
|
||||
<AddContactModal />
|
||||
<div className={showModal ? classes.backgroundModal : undefined} />
|
||||
<AppContent>
|
||||
<ContactList />
|
||||
<Fab onClick={openModal} style={{backgroundColor: '#2196f3', color: '#fff'}} className={classes.absolute}>
|
||||
<Fab
|
||||
onClick={openModal}
|
||||
style={{ backgroundColor: "#2196f3", color: "#fff" }}
|
||||
className={classes.absolute}
|
||||
>
|
||||
<PersonAddIcon />
|
||||
</Fab>
|
||||
</AppContent>
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faPen } from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
|
||||
|
||||
import PhoneIcon from "@material-ui/icons/Phone";
|
||||
import ChatIcon from "@material-ui/icons/Chat";
|
||||
@@ -42,9 +42,7 @@ const useStyles = makeStyles((theme) => ({
|
||||
|
||||
|
||||
export const ContactList = () => {
|
||||
|
||||
const classes = useStyles()
|
||||
|
||||
const { filteredContacts } = useFilteredContacts();
|
||||
const { showContactModal, setShowContactModal } = useContactModal();
|
||||
|
||||
|
||||
@@ -1,95 +1,97 @@
|
||||
import React, { useState } from 'react'
|
||||
import React, { useState } from "react";
|
||||
import { InputBase } from "@material-ui/core";
|
||||
import SearchIcon from '@material-ui/icons/Search';
|
||||
import { createStyles, fade, Theme, makeStyles } from '@material-ui/core/styles';
|
||||
import SearchIcon from "@material-ui/icons/Search";
|
||||
import {
|
||||
createStyles,
|
||||
fade,
|
||||
Theme,
|
||||
makeStyles,
|
||||
} from "@material-ui/core/styles";
|
||||
|
||||
import { useFilteredContacts } from '../../hooks/useFilteredContacts';
|
||||
import { useFilteredContacts } from "../../hooks/useFilteredContacts";
|
||||
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
bg: {
|
||||
backgroundColor: "#232323",
|
||||
display: 'flex',
|
||||
display: "flex",
|
||||
height: 60,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 20
|
||||
fontSize: 20,
|
||||
},
|
||||
inputRoot: {
|
||||
color: '#fff',
|
||||
fontSize: 18
|
||||
color: "#fff",
|
||||
fontSize: 18,
|
||||
},
|
||||
inputInput: {
|
||||
padding: theme.spacing(1, 4, 1, 4),
|
||||
// vertical padding + font size from searchIcon
|
||||
transition: theme.transitions.create('width'),
|
||||
width: '100%',
|
||||
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: '13ch',
|
||||
'&:focus': {
|
||||
width: '20ch',
|
||||
transition: theme.transitions.create("width"),
|
||||
width: "100%",
|
||||
|
||||
[theme.breakpoints.up("sm")]: {
|
||||
width: "13ch",
|
||||
"&:focus": {
|
||||
width: "20ch",
|
||||
},
|
||||
},
|
||||
},
|
||||
search: {
|
||||
position: 'relative',
|
||||
position: "relative",
|
||||
borderRadius: theme.shape.borderRadius,
|
||||
backgroundColor: fade(theme.palette.common.white, 0.15),
|
||||
'&:hover': {
|
||||
"&:hover": {
|
||||
backgroundColor: fade(theme.palette.common.white, 0.25),
|
||||
},
|
||||
marginLeft: 0,
|
||||
width: '100%',
|
||||
[theme.breakpoints.up('sm')]: {
|
||||
width: "100%",
|
||||
[theme.breakpoints.up("sm")]: {
|
||||
marginLeft: theme.spacing(1),
|
||||
width: 'auto',
|
||||
width: "auto",
|
||||
},
|
||||
},
|
||||
searchIcon: {
|
||||
padding: theme.spacing(0, 0.5),
|
||||
height: '100%',
|
||||
position: 'absolute',
|
||||
pointerEvents: 'none',
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: "100%",
|
||||
position: "absolute",
|
||||
pointerEvents: "none",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
export const SearchContacts = () => {
|
||||
|
||||
const { setFilteredContacts } = useFilteredContacts();
|
||||
|
||||
const classes = useStyles();
|
||||
const [ searchValue, setSearchValue ] = useState('')
|
||||
|
||||
const [searchValue, setSearchValue] = useState("");
|
||||
|
||||
const handleChange = (e) => {
|
||||
setSearchValue(e.target.value)
|
||||
setFilteredContacts(e.target.value)
|
||||
}
|
||||
setSearchValue(e.target.value);
|
||||
setFilteredContacts(e.target.value);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={classes.bg}>
|
||||
<div className={classes.search}>
|
||||
<div className={classes.searchIcon}>
|
||||
<SearchIcon style={{ color: '#fff' }} />
|
||||
<SearchIcon style={{ color: "#fff" }} />
|
||||
</div>
|
||||
<InputBase
|
||||
onChange={handleChange}
|
||||
placeholder="Search contacts..."
|
||||
classes={{
|
||||
root: classes.inputRoot,
|
||||
input: classes.inputInput
|
||||
input: classes.inputInput,
|
||||
}}
|
||||
inputProps={{ 'aria-label': 'search' }}
|
||||
inputProps={{ "aria-label": "search" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -6,8 +6,8 @@ export const contactsState = {
|
||||
default: [],
|
||||
}),
|
||||
showModal: atom({
|
||||
key: 'showModal',
|
||||
default: false
|
||||
key: "showModal",
|
||||
default: false,
|
||||
}),
|
||||
filterContacts: atom({
|
||||
key: 'filterContacts',
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
import { useRecoilState } from "recoil";
|
||||
import { contactsState } from "./state";
|
||||
|
||||
export const useFilteredContacts = () => {
|
||||
const [ filteredContacts, setFilteredContacts ] = useRecoilState(contactsState.filterContacts);
|
||||
const [filteredContacts, setFilteredContacts] = useRecoilState(
|
||||
contactsState.filterContacts
|
||||
);
|
||||
return { filteredContacts, setFilteredContacts };
|
||||
}
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
import { useRecoilState } from "recoil";
|
||||
import { contactsState } from "./state";
|
||||
|
||||
export const useModal = () => {
|
||||
const [ showModal, setShowModal ] = useRecoilState(contactsState.showModal);
|
||||
const [showModal, setShowModal] = useRecoilState(contactsState.showModal);
|
||||
return { showModal, setShowModal };
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
import TwitterNotification from "./TwitterNotification";
|
||||
|
||||
jest.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({ t: (key) => key }),
|
||||
}));
|
||||
|
||||
jest.mock("../../../../os/phone/hooks/usePhone", () => ({
|
||||
usePhone: jest.fn().mockReturnValue({
|
||||
config: {
|
||||
twitter: {
|
||||
showNotifications: true,
|
||||
},
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
jest.mock("../../hooks/useTwitterNotification", () => ({
|
||||
useTwitterNotification: jest.fn().mockReturnValue({
|
||||
notification: {
|
||||
profile_name: "test",
|
||||
message: "test message",
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("TwitterNotification", () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<TwitterNotification />);
|
||||
});
|
||||
it("renders", () => {
|
||||
expect(wrapper).toBeDefined();
|
||||
});
|
||||
|
||||
it("renders profile name", () => {
|
||||
expect(wrapper.find(".makeStyles-profileName-5").text()).toEqual("@test");
|
||||
});
|
||||
|
||||
it("renders message", () => {
|
||||
expect(wrapper.find(".makeStyles-message-7").text()).toEqual(
|
||||
"test message"
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,88 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { makeStyles, createStyles, Theme } from "@material-ui/core/styles";
|
||||
import TwitterIcon from "@material-ui/icons/Twitter";
|
||||
import { useTwitterNotification } from "../../hooks/useTwitterNotification";
|
||||
import Notification from "../../../../ui/components/Notification";
|
||||
import { usePhone } from "../../../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
content: {
|
||||
padding: theme.spacing(2),
|
||||
overflowY: "hidden",
|
||||
},
|
||||
title: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
titleLeft: {
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "center",
|
||||
},
|
||||
icon: {
|
||||
marginTop: "3px",
|
||||
marginRight: "5px",
|
||||
},
|
||||
profileName: {
|
||||
marginBottom: "3px",
|
||||
},
|
||||
justNow: {
|
||||
fontSize: "18px",
|
||||
fontStyle: "italic",
|
||||
paddingRight: "3px",
|
||||
},
|
||||
message: {
|
||||
fontSize: "16px",
|
||||
overflow: "hidden",
|
||||
display: "-webkit-box",
|
||||
WebkitLineClamp: 2,
|
||||
WebkitBoxOrient: "vertical",
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
function TwitterNotification() {
|
||||
const classes = useStyles();
|
||||
const { t } = useTranslation();
|
||||
const [visible, setVisible] = useState(false);
|
||||
const { notification } = useTwitterNotification();
|
||||
const { config } = usePhone();
|
||||
|
||||
useEffect(() => {
|
||||
if (notification) {
|
||||
setVisible(true);
|
||||
}
|
||||
}, [notification?.id]);
|
||||
|
||||
if (!config?.twitter.showNotifications || !notification) return null;
|
||||
|
||||
const profileName = `@${notification.profile_name?.trim()}`;
|
||||
|
||||
return (
|
||||
<Notification
|
||||
key={notification.id}
|
||||
open={visible}
|
||||
handleClose={() => setVisible(false)}
|
||||
>
|
||||
<div className={classes.content}>
|
||||
<div className={classes.title}>
|
||||
<div className={classes.titleLeft}>
|
||||
<div className={classes.icon}>
|
||||
<TwitterIcon />
|
||||
</div>
|
||||
<div className={classes.profileName}>{profileName}</div>
|
||||
</div>
|
||||
<div className={classes.justNow}>{t("APPS_TWITTER_JUST_NOW")}</div>
|
||||
</div>
|
||||
<div className={classes.message}>{notification.message}</div>
|
||||
</div>
|
||||
</Notification>
|
||||
);
|
||||
}
|
||||
|
||||
export default TwitterNotification;
|
||||
@@ -37,4 +37,8 @@ export const twitterState = {
|
||||
key: "updateProfileSuccess",
|
||||
default: null,
|
||||
}),
|
||||
notification: atom({
|
||||
key: "notification",
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { Tweet } from "../interfaces";
|
||||
|
||||
import { twitterState } from "./state";
|
||||
|
||||
interface ITwitterNotification {
|
||||
notification: Tweet | null;
|
||||
}
|
||||
|
||||
export const useTwitterNotification = (): ITwitterNotification => {
|
||||
const notification = useRecoilValue<Tweet | null>(twitterState.notification);
|
||||
return { notification };
|
||||
};
|
||||
@@ -41,6 +41,7 @@ export const useTwitterService = () => {
|
||||
const setCreateSuccess = useSetRecoilState(
|
||||
twitterState.createTweetSuccessful
|
||||
);
|
||||
const setNotification = useSetRecoilState(twitterState.notification);
|
||||
|
||||
const _setProfile = (profile) => {
|
||||
setProfile(profile);
|
||||
@@ -55,6 +56,10 @@ export const useTwitterService = () => {
|
||||
setCreateLoading(false);
|
||||
};
|
||||
|
||||
const _setNotification = (tweet) => {
|
||||
setNotification(tweet);
|
||||
};
|
||||
|
||||
const _setTweets = (tweets) => {
|
||||
setTweets(tweets.map(processTweet));
|
||||
};
|
||||
@@ -69,4 +74,5 @@ export const useTwitterService = () => {
|
||||
useNuiEvent(APP_TWITTER, "fetchTweetsFiltered", _setFilteredTweets);
|
||||
useNuiEvent(APP_TWITTER, "createTweetLoading", setCreateLoading);
|
||||
useNuiEvent(APP_TWITTER, "createTweetResult", _setCreateSuccess);
|
||||
useNuiEvent(APP_TWITTER, "createTweetBroadcast", _setNotification);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface Tweet {
|
||||
id: number;
|
||||
profile_name?: string;
|
||||
avatar_url?: string;
|
||||
message: string;
|
||||
createdAt?: string;
|
||||
updatedAt?: string;
|
||||
images?: string;
|
||||
likes?: number;
|
||||
}
|
||||
+5
-3
@@ -1,16 +1,18 @@
|
||||
import "@babel/polyfill";
|
||||
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { HashRouter } from "react-router-dom";
|
||||
import { RecoilRoot } from "recoil";
|
||||
|
||||
import "./main.css";
|
||||
import Phone from "./Phone";
|
||||
import * as serviceWorker from "./serviceWorker";
|
||||
import { HashRouter } from "react-router-dom";
|
||||
import { RecoilRoot } from "recoil";
|
||||
import TwitterNotification from "./apps/twitter/components/notification/TwitterNotification";
|
||||
|
||||
ReactDOM.render(
|
||||
<HashRouter>
|
||||
<RecoilRoot>
|
||||
<TwitterNotification />
|
||||
<Phone />
|
||||
</RecoilRoot>
|
||||
</HashRouter>,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"APPS_TWITTER_SUBMIT_IMAGE": "Add Media",
|
||||
"APPS_TWITTER_CLOSE_IMAGE": "Close",
|
||||
"APPS_TWITTER_CLOSE": "Close",
|
||||
"APPS_TWITTER_JUST_NOW": "Just now",
|
||||
"APPS_TWITTER_SEARCH_TWEETS": "Search for tweets",
|
||||
"APPS_TWITTER_SEARCH_TWEETS_PLACEHOLDER": "Search by profile name or message",
|
||||
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT": "Message is over the character limit",
|
||||
|
||||
+7
-4
@@ -1,6 +1,6 @@
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
@@ -10,10 +10,13 @@ body {
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
||||
monospace;
|
||||
}
|
||||
|
||||
a, a:visited, a:hover, a:active {
|
||||
a,
|
||||
a:visited,
|
||||
a:hover,
|
||||
a:active {
|
||||
text-decoration: none;
|
||||
}
|
||||
@@ -10,8 +10,13 @@ import {
|
||||
amber,
|
||||
} from "@material-ui/core/colors";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faAd, faPlaneArrival, faPhoneAlt, faLandmark } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faTwitter } from '@fortawesome/free-brands-svg-icons'
|
||||
import {
|
||||
faAd,
|
||||
faPlaneArrival,
|
||||
faPhoneAlt,
|
||||
faLandmark,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { faTwitter } from "@fortawesome/free-brands-svg-icons";
|
||||
|
||||
import ContactsIcon from "@material-ui/icons/Contacts";
|
||||
import SettingsIcon from "@material-ui/icons/Settings";
|
||||
@@ -90,7 +95,7 @@ const appsState = atom({
|
||||
{
|
||||
id: "TWITTER",
|
||||
nameLocale: "APPS_TWITTER",
|
||||
icon: <FontAwesomeIcon icon={faTwitter} fixedWidth size="xs"/>,
|
||||
icon: <FontAwesomeIcon icon={faTwitter} fixedWidth size="xs" />,
|
||||
backgroundColor: blue[600],
|
||||
color: common.white,
|
||||
path: "/twitter",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
interface TwitterConfig {
|
||||
showNotifications: boolean;
|
||||
generateProfileNameFromUsers: boolean;
|
||||
characterLimit: number;
|
||||
allowEdtiableProfileName: boolean;
|
||||
@@ -8,6 +9,11 @@ interface TwitterConfig {
|
||||
maxImages: number;
|
||||
}
|
||||
|
||||
interface NotificationConfig {
|
||||
horizontal: "left" | "center" | "right";
|
||||
vertical: "bottom" | "top";
|
||||
}
|
||||
|
||||
export interface ServerConfig {
|
||||
Locale: string;
|
||||
KeyTogglePhone: number;
|
||||
@@ -18,4 +24,5 @@ export interface ServerConfig {
|
||||
DestoryChance: number;
|
||||
DestroyPhoneReCheck: number;
|
||||
twitter: TwitterConfig;
|
||||
notificationPosition: NotificationConfig;
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,47 @@
|
||||
import React from "react";
|
||||
import { ThemeProvider } from "@material-ui/core";
|
||||
import Paper from "@material-ui/core/Paper";
|
||||
import Snackbar from "@material-ui/core/Snackbar";
|
||||
import Fade from "@material-ui/core/Fade";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { useSettings } from "../../apps/settings/hooks/useSettings";
|
||||
import { usePhone } from "../../os/phone/hooks/usePhone";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
paper: {
|
||||
width: "350px",
|
||||
height: "100px",
|
||||
opacity: "0.93",
|
||||
},
|
||||
snackBar: {
|
||||
zIndex: -5, // we want this to appear behind other active NUI events...probably
|
||||
},
|
||||
});
|
||||
|
||||
function Notification({ children, handleClose, open }) {
|
||||
const classes = useStyles();
|
||||
const { currentTheme } = useSettings();
|
||||
const { config } = usePhone();
|
||||
|
||||
if (!config) return null;
|
||||
|
||||
const { horizontal, vertical } = config.notificationPosition;
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={currentTheme()}>
|
||||
<Snackbar
|
||||
className={classes.snackBar}
|
||||
anchorOrigin={{ horizontal, vertical }}
|
||||
ClickAwayListenerProps={{ onClickAway: () => null }}
|
||||
onClose={handleClose}
|
||||
open={open}
|
||||
TransitionComponent={Fade}
|
||||
autoHideDuration={6000}
|
||||
>
|
||||
<Paper className={classes.paper}>{children}</Paper>
|
||||
</Snackbar>
|
||||
</ThemeProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default Notification;
|
||||
Reference in new issue
Block a user