mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
Merge branch 'master' of github.com:Re-Ignited-Development/new-phone-who-dis into feature/twitter_likes
This commit is contained in:
commit
54d0637e15
145 files changed
+4944
-489
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -1,31 +0,0 @@
|
||||
import { useRecoilState, atom } from 'recoil';
|
||||
|
||||
const transactionListState = atom({
|
||||
key: 'transactionList',
|
||||
default: [
|
||||
{
|
||||
id: 0,
|
||||
amount: 300,
|
||||
type: 'withdraw',
|
||||
date: '3'
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
amount: 1000,
|
||||
type: 'withdraw',
|
||||
date: '3'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
amount: 50,
|
||||
type: 'transfer',
|
||||
date: '2'
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const useBank = () => {
|
||||
const [transactionList, setTransactionList] = useRecoilState
|
||||
(transactionListState);
|
||||
return { transactionList, setTransactionList };
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { useRecoilState, atom } from "recoil";
|
||||
|
||||
const transactionListState = atom({
|
||||
key: "transactionList",
|
||||
default: [
|
||||
{
|
||||
id: 0,
|
||||
amount: 300,
|
||||
type: "withdraw",
|
||||
date: "3",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
amount: 1000,
|
||||
type: "withdraw",
|
||||
date: "3",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
amount: 50,
|
||||
type: "transfer",
|
||||
date: "2",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
export const useBank = () => {
|
||||
const [transactionList, setTransactionList] = useRecoilState(
|
||||
transactionListState
|
||||
);
|
||||
return { transactionList, setTransactionList };
|
||||
};
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
#sellout-app .Mui-selected {
|
||||
color: #f44336 !important;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
import { AppWrapper } from "../../../ui/components/AppWrapper";
|
||||
import { AppContent } from "../../../ui/components/AppContent";
|
||||
import { SelloutTitle } from "./SelloutTitle";
|
||||
import { SelloutListContainer } from "./SelloutList/SelloutListContainer";
|
||||
import { NavigationBar } from "./navigation/NavigationBar";
|
||||
import { Switch, Route } from "react-router-dom";
|
||||
|
||||
import "./Sellout.css";
|
||||
import { ListingFormContainer } from "./form/ListingFormContainer";
|
||||
|
||||
export const SelloutApp = () => {
|
||||
return (
|
||||
<AppWrapper id="sellout-app">
|
||||
<SelloutTitle />
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path="/sellout" exact component={SelloutListContainer} />
|
||||
<Route path="/sellout/new" component={ListingFormContainer} />
|
||||
</Switch>
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,77 @@
|
||||
import React from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Button, Typography, Paper } from "@material-ui/core";
|
||||
import { ImageDisplay } from "../images/ImageDisplay";
|
||||
import { ListItem } from "../../../../ui/components/ListItem";
|
||||
import ChatIcon from "@material-ui/icons/Chat";
|
||||
import PhoneIcon from "@material-ui/icons/Phone";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
overflowX: "hidden",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
alignItems: "flex-start",
|
||||
width: "100%",
|
||||
marginTop: "3px",
|
||||
},
|
||||
content: {
|
||||
display: "flex",
|
||||
marginTop: "-10px",
|
||||
flexFlow: "column nowrap",
|
||||
width: "100%",
|
||||
},
|
||||
paper: {
|
||||
overflow: "auto",
|
||||
display: "flex",
|
||||
flexFlow: "column",
|
||||
alignItems: "flex",
|
||||
height: "auto",
|
||||
background: "#232323",
|
||||
marginBottom: 20,
|
||||
},
|
||||
header: {
|
||||
margin: 10,
|
||||
},
|
||||
headerTypo: {
|
||||
margin: 5,
|
||||
},
|
||||
desc: {
|
||||
padding: 10,
|
||||
},
|
||||
}));
|
||||
|
||||
export const SelloutItem = (listing) => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<ListItem className={classes.root}>
|
||||
<div className={classes.content}>
|
||||
<Paper elevation={2} className={classes.paper}>
|
||||
<div className={classes.header}>
|
||||
<Typography className={classes.headerTypo} variant="h5">
|
||||
{listing.name}
|
||||
</Typography>
|
||||
<Typography
|
||||
className={classes.headerTypo}
|
||||
style={{ borderBottom: "1px solid #f44336" }}
|
||||
>
|
||||
{listing.number}
|
||||
</Typography>
|
||||
</div>
|
||||
<ImageDisplay imgURL={listing.img} />
|
||||
<Typography variant="h7" className={classes.desc}>
|
||||
{listing.description}
|
||||
</Typography>
|
||||
<div className={classes.postActions}>
|
||||
<Button>
|
||||
<ChatIcon style={{ color: "#f44336" }} />
|
||||
</Button>
|
||||
<Button>
|
||||
<PhoneIcon style={{ color: "#f44336" }} />
|
||||
</Button>
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
</ListItem>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
import { List } from "../../../../ui/components/List";
|
||||
import { SelloutItem } from "./SelloutItem";
|
||||
|
||||
export const SelloutList = ({ listings }) => {
|
||||
return (
|
||||
<List>
|
||||
{listings.map((listing) => (
|
||||
<SelloutItem key={listing.id} {...listing} />
|
||||
))}
|
||||
</List>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import React from "react";
|
||||
import { useListing } from "../../hooks/useListing";
|
||||
import { SelloutList } from "./SelloutList";
|
||||
|
||||
export const SelloutListContainer = () => {
|
||||
const { listing } = useListing();
|
||||
return <SelloutList listings={listing} />;
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
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";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
height: "60px",
|
||||
width: "100%",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
background: "#424242",
|
||||
},
|
||||
icon: {
|
||||
color: "#f44336",
|
||||
fontSize: 40,
|
||||
},
|
||||
}));
|
||||
|
||||
export const SelloutTitle = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||
<FontAwesomeIcon icon={faAd} className={classes.icon} />
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,64 @@
|
||||
import React from "react";
|
||||
import { makeStyles, Button, TextField } from "@material-ui/core";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
margin: "auto",
|
||||
textAlign: "center",
|
||||
},
|
||||
input: {
|
||||
marginBottom: 25,
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 22,
|
||||
},
|
||||
multilineFieldInput: {
|
||||
fontSize: 20,
|
||||
},
|
||||
postButton: {
|
||||
display: "block",
|
||||
margin: "auto",
|
||||
background: "#f44336",
|
||||
width: "80%",
|
||||
fontSize: 20,
|
||||
},
|
||||
}));
|
||||
|
||||
export const ListingForm = () => {
|
||||
const classes = useStyles();
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<h1>New Listing</h1>
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder="Title on listing.."
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
/>
|
||||
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder="Image URL"
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
variant="outlined"
|
||||
/>
|
||||
|
||||
<TextField
|
||||
className={classes.input}
|
||||
placeholder="Description"
|
||||
inputProps={{ className: classes.multilineFieldInput }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
multiline
|
||||
rows={4}
|
||||
variant="outlined"
|
||||
/>
|
||||
|
||||
<Button className={classes.postButton}>Post</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import { ListingForm } from "./ListingForm";
|
||||
|
||||
export const ListingFormContainer = () => {
|
||||
return (
|
||||
<div>
|
||||
<ListingForm />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from "react";
|
||||
|
||||
export const ImageDisplay = ({ imgURL }) => {
|
||||
return (
|
||||
<img
|
||||
src={imgURL}
|
||||
alt="Image"
|
||||
style={{ height: 200, width: 350, margin: "auto" }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles } from "@material-ui/core/styles";
|
||||
import { Link } from "react-router-dom";
|
||||
import { BottomNavigation, BottomNavigationAction } from "@material-ui/core";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import { faHome } from "@fortawesome/free-solid-svg-icons";
|
||||
import AddCircleIcon from "@material-ui/icons/AddCircle";
|
||||
import FaceIcon from "@material-ui/icons/Face";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
},
|
||||
icon: {
|
||||
color: "#f44336",
|
||||
},
|
||||
}));
|
||||
|
||||
export const NavigationBar = () => {
|
||||
const classes = useStyles();
|
||||
const [activePage, setActivePage] = useState(0);
|
||||
return (
|
||||
<BottomNavigation
|
||||
value={activePage}
|
||||
onChange={(event, newPage) => {
|
||||
setActivePage(newPage);
|
||||
}}
|
||||
showLabels
|
||||
className={classes.root}
|
||||
>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FontAwesomeIcon icon={faHome} />}
|
||||
to="/sellout"
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<AddCircleIcon />}
|
||||
to="/sellout/new"
|
||||
/>
|
||||
<BottomNavigationAction
|
||||
component={Link}
|
||||
icon={<FaceIcon />}
|
||||
to="/sellout/new"
|
||||
/>
|
||||
</BottomNavigation>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const selloutState = {
|
||||
listing: atom({
|
||||
key: "listing",
|
||||
default: null,
|
||||
}),
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { selloutState } from "./state";
|
||||
|
||||
export const useListing = () => {
|
||||
const listing = useRecoilValue(selloutState.listing);
|
||||
return { listing };
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
import { useNuiEvent } from "../../../os/nui-events/hooks/useNuiEvent";
|
||||
import { selloutState } from "./state";
|
||||
import { useListing } from "./useListing";
|
||||
import { useSetRecoilState } from "recoil";
|
||||
|
||||
export const useSelloutService = () => {
|
||||
const setSellout = useSetRecoilState(selloutState.listing);
|
||||
useNuiEvent("SELLOUT", "setListings", setSellout);
|
||||
return useListing();
|
||||
};
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+6
-2
@@ -127,7 +127,7 @@ export const AddTweetModal = () => {
|
||||
withValidImage(cleanedLink, () => setImages([...images, image]));
|
||||
|
||||
setShowImagePrompt(false);
|
||||
setLink('')
|
||||
setLink("");
|
||||
};
|
||||
const removeImage = (id) =>
|
||||
setImages(images.filter((image) => id !== image.id));
|
||||
@@ -171,7 +171,11 @@ export const AddTweetModal = () => {
|
||||
/>
|
||||
<div className={classes.buttonsContainer}>
|
||||
<IconButtons
|
||||
onImageClick={images.length < config.twitter.maxImages ? toggleShowImagePrompt : null}
|
||||
onImageClick={
|
||||
images.length < config.twitter.maxImages
|
||||
? toggleShowImagePrompt
|
||||
: null
|
||||
}
|
||||
onEmojiClick={toggleShowEmoji}
|
||||
/>
|
||||
<ControlButtons
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+11
-7
@@ -21,18 +21,22 @@ const useStyles = makeStyles((theme) => ({
|
||||
export const IconButtons = ({ onImageClick, onEmojiClick }) => {
|
||||
const classes = useStyles();
|
||||
const { config } = usePhone();
|
||||
|
||||
|
||||
if (!config) return null;
|
||||
const { enableImages, enableEmojis } = config.twitter;
|
||||
|
||||
return (
|
||||
<div className={classes.buttons}>
|
||||
{enableImages && (<Button className={classes.button} onClick={onImageClick}>
|
||||
<InsertPhotoIcon color="action" />
|
||||
</Button>)}
|
||||
{enableEmojis && (<Button className={classes.button} onClick={onEmojiClick}>
|
||||
<EmojiIcon color="action" />
|
||||
</Button>)}
|
||||
{enableImages && (
|
||||
<Button className={classes.button} onClick={onImageClick}>
|
||||
<InsertPhotoIcon color="action" />
|
||||
</Button>
|
||||
)}
|
||||
{enableEmojis && (
|
||||
<Button className={classes.button} onClick={onEmojiClick}>
|
||||
<EmojiIcon color="action" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-2
@@ -27,7 +27,6 @@ export function Profile() {
|
||||
const { profile } = useProfile();
|
||||
const { config } = usePhone();
|
||||
|
||||
|
||||
// note that this assumes we are defensively checking
|
||||
// that profile is not null in a parent above this component.
|
||||
// Annoyingling adding conditionals above this line to not render
|
||||
@@ -50,7 +49,7 @@ export function Profile() {
|
||||
Nui.send("phone:updateTwitterProfile", data);
|
||||
};
|
||||
|
||||
// fetching the config is an asynchronous call so defend against it
|
||||
// fetching the config is an asynchronous call so defend against it
|
||||
if (!config) return null;
|
||||
|
||||
const { enableAvatars, allowEdtiableProfileName } = config.twitter;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-2
@@ -23,8 +23,11 @@ export const TweetMessage = ({ message, handleChange }) => {
|
||||
const { config } = usePhone();
|
||||
const { t } = useTranslation();
|
||||
|
||||
const overCharacterLimit = message.trim().length > config.twitter.characterLimit;
|
||||
const characterWarningPrompt = `${t("APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT")} (${config.twitter.characterLimit})`;
|
||||
const overCharacterLimit =
|
||||
message.trim().length > config.twitter.characterLimit;
|
||||
const characterWarningPrompt = `${t(
|
||||
"APPS_TWITTER_TWEET_MESSAGE_CHAR_LIMIT"
|
||||
)} (${config.twitter.characterLimit})`;
|
||||
|
||||
return (
|
||||
<TextField
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -12,7 +12,10 @@ const DAYS = "APPS_TWITTER_TIME_DAYS";
|
||||
* @param {function} t - translation object passed from a component implementing the hook
|
||||
* @param {number} seconds - seconds to translate to a string
|
||||
*/
|
||||
export function secondsToHumanReadable(t, seconds) {
|
||||
export function secondsToHumanReadable(
|
||||
t: (input: string) => string,
|
||||
seconds: number
|
||||
): string {
|
||||
if (seconds < 60) {
|
||||
return t(JUST_NOW);
|
||||
} else if (seconds < ONE_HOUR) {
|
||||
Reference in new issue
Block a user