mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +00:00
Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
795de75da4 | ||
|
|
60bf8be58d | ||
|
|
d443b794c3 | ||
|
|
361a8ac6eb | ||
|
|
9adc01f870 | ||
|
|
98d4aa345a | ||
|
|
8577995d4a | ||
|
|
a494f5225a | ||
|
|
8ff550cd6f | ||
|
|
6ee401e3d5 | ||
|
|
d0ed913d7c | ||
|
|
9c1fc2e885 | ||
|
|
c8af1fc61f | ||
|
|
a3d8285265 | ||
|
|
5debff0ae7 | ||
|
|
ec21abc7d4 | ||
|
|
bcc2e45697 | ||
|
|
c9f24e3ce2 | ||
|
|
fc211acb98 | ||
|
|
6c8ab4aadd | ||
|
|
1addd5cead | ||
|
|
dc8074fb21 | ||
|
|
f29b9d2be6 | ||
|
|
0e6383891a | ||
|
|
7a32bbc0c4 |
No files matched your search
+6
-1
@@ -223,16 +223,21 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
name: 'Some guy',
|
name: 'Some guy',
|
||||||
number: '123-4567',
|
number: '123-4567',
|
||||||
title: 'Car',
|
title: 'Car',
|
||||||
|
category: 'CAR',
|
||||||
description: 'Selling this cool car',
|
description: 'Selling this cool car',
|
||||||
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
||||||
|
price: 400,
|
||||||
|
posted: '1/9/2021',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'Some other dude',
|
name: 'Some other dude',
|
||||||
number: '666-6666',
|
number: '666-6666',
|
||||||
title: 'Material',
|
title: 'Material',
|
||||||
description: 'Selling my wife',
|
description:
|
||||||
|
'Selling my wife olsdfjsdfk jfksdaj kasjfksf jdkasf jklasf jasklf jaskf',
|
||||||
url: '',
|
url: '',
|
||||||
|
price: 30,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css2?family=Libre+Franklin:wght@300;500;600&display=swap');
|
||||||
|
|
||||||
|
#sellout-app {
|
||||||
|
background-color: #F6F6F6;
|
||||||
|
}
|
||||||
|
|
||||||
#sellout-app .Mui-selected {
|
#sellout-app .Mui-selected {
|
||||||
color: #f44336 !important;
|
color: #f44336 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#sellout-app .Mui-focused::after {
|
#sellout-app .Mui-focused::after {
|
||||||
border-bottom: #f44336 solid 3px;
|
border-bottom: #f44336 solid 3px;
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,20 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { AppWrapper } from "../../../ui/components/AppWrapper";
|
import { AppWrapper } from '../../../ui/components/AppWrapper';
|
||||||
import { AppContent } from "../../../ui/components/AppContent";
|
import { AppContent } from '../../../ui/components/AppContent';
|
||||||
import { SelloutTitle } from "./SelloutTitle";
|
import { SelloutTitle } from './SelloutTitle';
|
||||||
import { SelloutListContainer } from "./SelloutList/SelloutListContainer";
|
import { SelloutListContainer } from './SelloutList/SelloutListContainer';
|
||||||
import { NavigationBar } from "./navigation/NavigationBar";
|
|
||||||
import { Switch, Route } from "react-router-dom";
|
|
||||||
|
|
||||||
import "./Sellout.css";
|
import './Sellout.css';
|
||||||
import { ListingFormContainer } from "./form/ListingFormContainer";
|
import { ListingForm } from './form/ListingForm';
|
||||||
|
import ItemModal from './modal/ItemModal';
|
||||||
|
|
||||||
export const SelloutApp = () => {
|
export const SelloutApp = () => {
|
||||||
return (
|
return (
|
||||||
<AppWrapper id="sellout-app">
|
<AppWrapper id='sellout-app'>
|
||||||
<SelloutTitle />
|
|
||||||
<AppContent>
|
<AppContent>
|
||||||
<Switch>
|
<ListingForm />
|
||||||
<Route path="/sellout" exact component={SelloutListContainer} />
|
<SelloutListContainer />
|
||||||
<Route path="/sellout/new" component={ListingFormContainer} />
|
|
||||||
</Switch>
|
|
||||||
</AppContent>
|
</AppContent>
|
||||||
<NavigationBar />
|
|
||||||
</AppWrapper>
|
</AppWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,81 +1,111 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { makeStyles } from "@material-ui/core/styles";
|
import { makeStyles } from '@material-ui/core/styles';
|
||||||
import { Button, Typography, Paper } from "@material-ui/core";
|
import { Button, Typography, Paper } from '@material-ui/core';
|
||||||
import { ImageDisplay } from "../images/ImageDisplay";
|
import { ListItem } from '../../../../ui/components/ListItem';
|
||||||
import { ListItem } from "../../../../ui/components/ListItem";
|
import { useItemModal } from '../../hooks/useItemModal';
|
||||||
import ChatIcon from "@material-ui/icons/Chat";
|
import { useListingDetails } from '../../hooks/useListingDetails';
|
||||||
import PhoneIcon from "@material-ui/icons/Phone";
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
overflowX: "hidden",
|
overflowX: 'hidden',
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
flexFlow: "row nowrap",
|
flexFlow: 'row nowrap',
|
||||||
alignItems: "flex-start",
|
alignItems: 'flex-start',
|
||||||
width: "100%",
|
width: '100%',
|
||||||
marginTop: "3px",
|
marginTop: '5px',
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
display: "flex",
|
display: 'flex',
|
||||||
marginTop: "-10px",
|
marginTop: '-5px',
|
||||||
flexFlow: "column nowrap",
|
flexFlow: 'column nowrap',
|
||||||
width: "100%",
|
width: '100%',
|
||||||
},
|
},
|
||||||
paper: {
|
paper: {
|
||||||
overflow: "auto",
|
borderRadius: 15,
|
||||||
display: "flex",
|
overflow: 'auto',
|
||||||
flexFlow: "column",
|
display: 'flex',
|
||||||
alignItems: "flex",
|
color: '#292929',
|
||||||
height: "auto",
|
justifyContent: 'space-between',
|
||||||
background: "#232323",
|
height: 'auto',
|
||||||
|
background: '#fff',
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
|
boxShadow: '0px 0px 5px 0px rgba(0,0,0,0.75)',
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
margin: 10,
|
|
||||||
},
|
|
||||||
headerTypo: {
|
|
||||||
margin: 5,
|
margin: 5,
|
||||||
},
|
},
|
||||||
|
headerTypo: {
|
||||||
|
margin: 3,
|
||||||
|
},
|
||||||
desc: {
|
desc: {
|
||||||
padding: 10,
|
padding: 3,
|
||||||
|
fontSize: 16,
|
||||||
|
color: '#838383',
|
||||||
|
paddingTop: '5px',
|
||||||
|
paddingLeft: '10px',
|
||||||
|
},
|
||||||
|
imageSection: {
|
||||||
|
float: 'right',
|
||||||
|
},
|
||||||
|
listingImage: {},
|
||||||
|
price: {
|
||||||
|
fontWeight: 600,
|
||||||
|
paddingLeft: '10px',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
},
|
||||||
|
readMoreBtn: {
|
||||||
|
background: '#FF9472',
|
||||||
|
paddingLeft: '10px',
|
||||||
|
'&:hover': {
|
||||||
|
background: '#FE9485',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const SelloutItem = (listing) => {
|
export const SelloutItem = (listing) => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const { setItemModal } = useItemModal();
|
||||||
|
const { setDetails } = useListingDetails();
|
||||||
|
|
||||||
|
const handleOpenListing = (listing) => {
|
||||||
|
setDetails(listing);
|
||||||
|
setItemModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListItem className={classes.root}>
|
<ListItem className={classes.root}>
|
||||||
<div className={classes.content}>
|
<div className={classes.content}>
|
||||||
<Paper elevation={2} className={classes.paper}>
|
<Paper elevation={2} className={classes.paper}>
|
||||||
<div className={classes.header}>
|
<div className={classes.header}>
|
||||||
<Typography className={classes.headerTypo} variant="h5">
|
<Typography variant='h5' style={{ padding: '5px 0px 0px 10px' }}>
|
||||||
{listing.name}
|
|
||||||
</Typography>
|
|
||||||
<Typography
|
|
||||||
className={classes.headerTypo}
|
|
||||||
style={{ borderBottom: "1px solid #f44336" }}
|
|
||||||
>
|
|
||||||
{listing.number}
|
|
||||||
</Typography>
|
|
||||||
<Typography variant="h5" style={{ padding: 5}}>
|
|
||||||
{listing.title}
|
{listing.title}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
<Typography variant='h6' className={classes.desc}>
|
||||||
|
{listing.description.slice(0, 30)}...
|
||||||
|
</Typography>
|
||||||
|
<Typography variant='h6' className={classes.price}>
|
||||||
|
${listing.price}
|
||||||
|
</Typography>
|
||||||
|
<Button
|
||||||
|
className={classes.readMoreBtn}
|
||||||
|
onClick={() => handleOpenListing(listing)}
|
||||||
|
>
|
||||||
|
Read more
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{listing.url ? (
|
<div className={classes.imageSection}>
|
||||||
<ImageDisplay imgURL={listing.url} />
|
<div
|
||||||
): (
|
className={classes.listingImage}
|
||||||
<Typography style={{ margin: 10 }}>No image provided🙁</Typography>
|
style={{
|
||||||
) }
|
backgroundImage: `url(${listing.url})`,
|
||||||
<Typography variant="h6" className={classes.desc}>
|
backgroundPosition: 'center',
|
||||||
{listing.description}
|
backgroundSize: 'cover',
|
||||||
</Typography>
|
backgroundRepeat: 'no-repeat',
|
||||||
<div>
|
width: '150px',
|
||||||
<Button>
|
height: '150px',
|
||||||
<ChatIcon style={{ color: "#f44336" }} />
|
}}
|
||||||
</Button>
|
/>
|
||||||
<Button>
|
|
||||||
<PhoneIcon style={{ color: "#f44336" }} />
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</Paper>
|
</Paper>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { List } from "../../../../ui/components/List";
|
import { List } from '../../../../ui/components/List';
|
||||||
import { SelloutItem } from "./SelloutItem";
|
import SelloutSearch from '../search/SelloutSearch';
|
||||||
|
import { SelloutItem } from './SelloutItem';
|
||||||
|
|
||||||
export const SelloutList = ({ listings }) => {
|
export const SelloutList = ({ listings }) => {
|
||||||
return (
|
return (
|
||||||
<List>
|
<div>
|
||||||
{listings.map((listing) => (
|
<SelloutSearch />
|
||||||
<SelloutItem key={listing.id} {...listing} />
|
<List style={{ backgroundColor: '#F6F6F6' }}>
|
||||||
))}
|
{listings?.map((listing) => (
|
||||||
</List>
|
<SelloutItem key={listing.id} {...listing} />
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,8 +1,31 @@
|
|||||||
import React from "react";
|
import React from 'react';
|
||||||
import { useListing } from "../../hooks/useListing";
|
import { useListing } from '../../hooks/useListing';
|
||||||
import { SelloutList } from "./SelloutList";
|
import { SelloutList } from './SelloutList';
|
||||||
|
import SelloutSearch from '../search/SelloutSearch';
|
||||||
|
import { useListingModal } from '../../hooks/useListingModal';
|
||||||
|
|
||||||
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
|
import { useItemModal } from '../../hooks/useItemModal';
|
||||||
|
import ItemModal from '../modal/ItemModal';
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
|
hidden: {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
|
show: {
|
||||||
|
display: 'block',
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
export const SelloutListContainer = () => {
|
export const SelloutListContainer = () => {
|
||||||
const { listing } = useListing();
|
const { modal } = useListingModal();
|
||||||
return <SelloutList listings={listing} />;
|
const { itemModal } = useItemModal();
|
||||||
|
const { listings } = useListing();
|
||||||
|
|
||||||
|
const classes = useStyles();
|
||||||
|
return (
|
||||||
|
<div className={modal ? classes.hidden : classes.show}>
|
||||||
|
{itemModal ? <ItemModal /> : <SelloutList listings={listings} />}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
|
root: {
|
||||||
|
overflowX: 'hidden',
|
||||||
|
display: 'flex',
|
||||||
|
flexFlow: 'row nowrap',
|
||||||
|
alignItems: 'flex-start',
|
||||||
|
width: '100%',
|
||||||
|
marginTop: '5px',
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
display: 'flex',
|
||||||
|
marginTop: '-5px',
|
||||||
|
flexFlow: 'column nowrap',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
paper: {
|
||||||
|
borderRadius: 15,
|
||||||
|
overflow: 'auto',
|
||||||
|
display: 'flex',
|
||||||
|
color: '#292929',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
height: 'auto',
|
||||||
|
background: '#fff',
|
||||||
|
marginBottom: 20,
|
||||||
|
boxShadow: '0px 0px 5px 0px rgba(0,0,0,0.75)',
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
headerTypo: {
|
||||||
|
margin: 3,
|
||||||
|
},
|
||||||
|
desc: {
|
||||||
|
padding: 3,
|
||||||
|
fontSize: 16,
|
||||||
|
color: '#838383',
|
||||||
|
paddingTop: '5px',
|
||||||
|
paddingLeft: '10px',
|
||||||
|
},
|
||||||
|
imageSection: {
|
||||||
|
float: 'right',
|
||||||
|
},
|
||||||
|
listingImage: {},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default useStyles;
|
||||||
@@ -24,7 +24,7 @@ export const SelloutTitle = () => {
|
|||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
return (
|
return (
|
||||||
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
||||||
<FontAwesomeIcon icon={faAd} className={classes.icon} />
|
<h3>Marketplace</h3>
|
||||||
</Paper>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,29 +1,54 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from 'react';
|
||||||
import { makeStyles, Button, TextField } from "@material-ui/core";
|
import { makeStyles, Button, TextField, InputBase } from '@material-ui/core';
|
||||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
import Nui from '../../../../os/nui-events/utils/Nui';
|
||||||
|
|
||||||
import "../Sellout.css"
|
import CloseIcon from '@material-ui/icons/Close';
|
||||||
|
|
||||||
|
import '../Sellout.css';
|
||||||
|
import { useListingModal } from '../../hooks/useListingModal';
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
width: "100%",
|
position: 'absolute',
|
||||||
margin: "auto",
|
width: '100%',
|
||||||
textAlign: "center",
|
backgroundColor: '#F9F9F9',
|
||||||
|
height: '100%',
|
||||||
|
margin: 'auto',
|
||||||
|
textAlign: 'center',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
},
|
||||||
|
hidden: {
|
||||||
|
display: 'none',
|
||||||
},
|
},
|
||||||
input: {
|
input: {
|
||||||
marginBottom: 25,
|
marginBottom: 20,
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
},
|
},
|
||||||
textFieldInput: {
|
textFieldInput: {
|
||||||
fontSize: 22,
|
fontSize: 18,
|
||||||
|
background: '#EBEBEB',
|
||||||
|
color: '#272727',
|
||||||
|
fontWeight: 600,
|
||||||
|
textIndent: 3,
|
||||||
|
borderRadius: 15,
|
||||||
|
padding: 15,
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
},
|
},
|
||||||
multilineFieldInput: {
|
multilineFieldInput: {
|
||||||
fontSize: 20,
|
fontSize: 18,
|
||||||
|
background: '#EBEBEB',
|
||||||
|
borderRadius: 15,
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
color: '#272727',
|
||||||
|
textIndent: 3,
|
||||||
|
fontWeight: 600,
|
||||||
|
padding: 15,
|
||||||
},
|
},
|
||||||
postButton: {
|
postButton: {
|
||||||
display: "block",
|
display: 'block',
|
||||||
margin: "auto",
|
margin: 'auto',
|
||||||
background: "#f44336",
|
background: '#f44336',
|
||||||
width: "80%",
|
width: '80%',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
@@ -31,53 +56,75 @@ const useStyles = makeStyles((theme) => ({
|
|||||||
export const ListingForm = () => {
|
export const ListingForm = () => {
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
|
|
||||||
const [ title, setTitle ] = useState('');
|
const { modal, setModal } = useListingModal();
|
||||||
const [ url, setUrl ] = useState('');
|
|
||||||
const [ description, setDescription ] = useState('');
|
const [title, setTitle] = useState('');
|
||||||
|
const [url, setUrl] = useState('');
|
||||||
|
const [description, setDescription] = useState('');
|
||||||
|
|
||||||
const addListing = () => {
|
const addListing = () => {
|
||||||
Nui.send('phone:addListing', {
|
Nui.send('phone:addListing', {
|
||||||
title,
|
title,
|
||||||
url,
|
url,
|
||||||
description
|
description,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
setModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={modal ? classes.root : classes.hidden}>
|
||||||
<h1>New Listing</h1>
|
<h1 style={{ color: '#272727' }}>New Listing</h1>
|
||||||
<TextField
|
<InputBase
|
||||||
className={classes.input}
|
className={classes.input}
|
||||||
onChange={e => setTitle(e.target.value)}
|
onChange={(e) => setTitle(e.target.value)}
|
||||||
placeholder="Title on listing.."
|
placeholder='Title'
|
||||||
inputProps={{ className: classes.textFieldInput }}
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
style={{ width: "80%" }}
|
style={{ width: '80%' }}
|
||||||
size="medium"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextField
|
<InputBase
|
||||||
className={classes.input}
|
className={classes.input}
|
||||||
placeholder="Image URL"
|
placeholder='Category'
|
||||||
onChange={e => setUrl(e.target.value)}
|
|
||||||
inputProps={{ className: classes.textFieldInput }}
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
style={{ width: "80%" }}
|
style={{ width: '80%' }}
|
||||||
size="medium"
|
|
||||||
variant="outlined"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextField
|
<InputBase
|
||||||
className={classes.input}
|
className={classes.input}
|
||||||
onChange={e => setDescription(e.target.value)}
|
placeholder='Image or URL link'
|
||||||
placeholder="Description"
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
|
style={{ width: '80%' }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputBase
|
||||||
|
className={classes.input}
|
||||||
|
placeholder='Price'
|
||||||
|
onChange={(e) => setUrl(e.target.value)}
|
||||||
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
|
style={{ width: '80%' }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<InputBase
|
||||||
|
className={classes.input}
|
||||||
|
onChange={(e) => setDescription(e.target.value)}
|
||||||
|
placeholder='Description'
|
||||||
inputProps={{ className: classes.multilineFieldInput }}
|
inputProps={{ className: classes.multilineFieldInput }}
|
||||||
style={{ width: "80%" }}
|
style={{ width: '80%' }}
|
||||||
size="medium"
|
|
||||||
multiline
|
multiline
|
||||||
rows={4}
|
rows={3}
|
||||||
variant="outlined"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button onClick={addListing} className={classes.postButton}>Post</Button>
|
<Button onClick={addListing} className={classes.postButton}>
|
||||||
|
Post
|
||||||
|
</Button>
|
||||||
|
<div>
|
||||||
|
<Button onClick={closeModal}>
|
||||||
|
<h3 style={{ color: '#272727' }}>Cancel</h3>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { ListingForm } from "./ListingForm";
|
|
||||||
|
|
||||||
export const ListingFormContainer = () => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<ListingForm />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Button, Typography } from '@material-ui/core';
|
||||||
|
import { useItemModal } from '../../hooks/useItemModal';
|
||||||
|
import { useListingDetails } from '../../hooks/useListingDetails';
|
||||||
|
import useStyles from './modal.styles';
|
||||||
|
import CloseIcon from '@material-ui/icons/Close';
|
||||||
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||||
|
import { spawnSync } from 'child_process';
|
||||||
|
|
||||||
|
export default function ItemModal() {
|
||||||
|
const classes = useStyles();
|
||||||
|
|
||||||
|
const { details, setDetails } = useListingDetails();
|
||||||
|
const { itemModal, setItemModal } = useItemModal();
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setDetails(null);
|
||||||
|
setItemModal(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={itemModal ? classes.root : classes.hidden}>
|
||||||
|
{/* Header part */}
|
||||||
|
<div
|
||||||
|
className={classes.header}
|
||||||
|
style={{
|
||||||
|
backgroundImage: `url(${details.url})`,
|
||||||
|
backgroundSize: 'cover',
|
||||||
|
backgroundPosition: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<button onClick={handleClose} className={classes.closeButton}>
|
||||||
|
{<CloseIcon />}
|
||||||
|
</button>
|
||||||
|
<div>
|
||||||
|
<button className={classes.editButton}>
|
||||||
|
EDIT {<ExpandMoreIcon />}
|
||||||
|
</button>
|
||||||
|
<span className={classes.category}>{details.category}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.content}>
|
||||||
|
<div className={classes.titleSection}>
|
||||||
|
<Typography className={classes.listingTitle}>
|
||||||
|
{details.title}
|
||||||
|
</Typography>
|
||||||
|
<span className={classes.priceContainer}>${details.price}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.metaContainer}>
|
||||||
|
<div className={classes.metaSection}>
|
||||||
|
<Typography className={classes.metaDetail}>
|
||||||
|
<span style={{ color: '#504F4F' }}>Author:</span> {details.name}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Typography className={classes.metaDetail}>
|
||||||
|
<span style={{ color: '#504F4F' }}>Category:</span>{' '}
|
||||||
|
{details.category}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Typography className={classes.metaDetail}>
|
||||||
|
<span style={{ color: '#504F4F' }}>Posted:</span> {details.posted}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.descContianer}>
|
||||||
|
<h2 style={{ color: '#000', fontWeight: 500 }}>
|
||||||
|
Listing Description
|
||||||
|
</h2>
|
||||||
|
<p style={{ float: 'left' }}>{details.description}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import { makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
|
root: {
|
||||||
|
position: 'absolute',
|
||||||
|
width: '100%',
|
||||||
|
backgroundColor: '#F9F9F9',
|
||||||
|
height: '100%',
|
||||||
|
margin: 'auto',
|
||||||
|
textAlign: 'center',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
},
|
||||||
|
hidden: {
|
||||||
|
display: 'none',
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
background: 'red',
|
||||||
|
width: '100%',
|
||||||
|
height: '30%',
|
||||||
|
},
|
||||||
|
closeButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
background: '#fff',
|
||||||
|
outline: 'none',
|
||||||
|
color: '#838383',
|
||||||
|
top: 10,
|
||||||
|
left: 5,
|
||||||
|
border: 'none',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
alignItems: 'center',
|
||||||
|
borderRadius: 50,
|
||||||
|
'&:hover': {
|
||||||
|
background: '#fff',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
editButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
top: 10,
|
||||||
|
right: 5,
|
||||||
|
color: '#838383',
|
||||||
|
fontSize: '18px',
|
||||||
|
fontWeight: 500,
|
||||||
|
padding: 5,
|
||||||
|
outline: 'none',
|
||||||
|
width: '55',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: 10,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
category: {
|
||||||
|
background: '#2bad85',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 10,
|
||||||
|
right: 100,
|
||||||
|
color: '#fff',
|
||||||
|
fontSize: '18px',
|
||||||
|
fontWeight: 500,
|
||||||
|
padding: 7,
|
||||||
|
outline: 'none',
|
||||||
|
width: '55',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: 10,
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
width: '90%',
|
||||||
|
margin: 'auto',
|
||||||
|
},
|
||||||
|
titleSection: {
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '20px',
|
||||||
|
},
|
||||||
|
listingTitle: {
|
||||||
|
textAlign: 'left',
|
||||||
|
width: '90%',
|
||||||
|
margin: 'auto',
|
||||||
|
marginTop: '5px',
|
||||||
|
color: '#000',
|
||||||
|
fontWeight: 600,
|
||||||
|
fontSize: '32px',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
borderBottom: '3px solid #838383',
|
||||||
|
},
|
||||||
|
priceContainer: {
|
||||||
|
background: '#FF4747',
|
||||||
|
borderRadius: 10,
|
||||||
|
color: '#fff',
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
marginTop: 35,
|
||||||
|
padding: 5,
|
||||||
|
},
|
||||||
|
metaContainer: {
|
||||||
|
width: '90%',
|
||||||
|
marginTop: '3em',
|
||||||
|
},
|
||||||
|
metaSection: {
|
||||||
|
display: 'block',
|
||||||
|
width: '90%',
|
||||||
|
paddingBottom: 5,
|
||||||
|
borderBottom: '2px solid #838383',
|
||||||
|
},
|
||||||
|
metaDetail: {
|
||||||
|
color: '#000',
|
||||||
|
textAlign: 'left',
|
||||||
|
fontWeight: 600,
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
},
|
||||||
|
descContianer: {
|
||||||
|
float: 'left',
|
||||||
|
fontSize: '18',
|
||||||
|
color: '#504F4F',
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default useStyles;
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
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';
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
|
||||||
root: {
|
|
||||||
width: '100%',
|
|
||||||
backgroundColor: '#262525',
|
|
||||||
},
|
|
||||||
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'
|
|
||||||
/>
|
|
||||||
</BottomNavigation>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { TextField, Button, InputBase } from '@material-ui/core';
|
||||||
|
import useStyles from './search.styles';
|
||||||
|
|
||||||
|
import AddIcon from '@material-ui/icons/Add';
|
||||||
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||||
|
import SearchIcon from '@material-ui/icons/Search';
|
||||||
|
import { useListingModal } from '../../hooks/useListingModal';
|
||||||
|
|
||||||
|
const SelloutSearch = () => {
|
||||||
|
const [search, setSearch] = useState('');
|
||||||
|
|
||||||
|
const { modal, setModal } = useListingModal();
|
||||||
|
|
||||||
|
const handleModal = () => {
|
||||||
|
setModal(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const classes = useStyles();
|
||||||
|
return (
|
||||||
|
<div className={classes.searchContainer}>
|
||||||
|
<div className={classes.header}>
|
||||||
|
<h2 className={classes.headerTitle}>Marketplace</h2>
|
||||||
|
<div className={classes.search}>
|
||||||
|
<div className={classes.searchIcon}>
|
||||||
|
<SearchIcon style={{ color: '#838383' }} />
|
||||||
|
</div>
|
||||||
|
<InputBase
|
||||||
|
placeholder='Search'
|
||||||
|
classes={{
|
||||||
|
root: classes.inputRoot,
|
||||||
|
input: classes.inputInput,
|
||||||
|
}}
|
||||||
|
inputProps={{ 'aria-label': 'search' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={classes.subMenu}>
|
||||||
|
<Button className={classes.subMenuButton}>
|
||||||
|
Sort {<ExpandMoreIcon />}
|
||||||
|
</Button>
|
||||||
|
<Button className={classes.subMenuButton} onClick={handleModal}>
|
||||||
|
Add {<AddIcon />}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SelloutSearch;
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import { fade, makeStyles, Theme } from '@material-ui/core/styles';
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme: Theme) => ({
|
||||||
|
headerTitle: {
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
fontSize: 32,
|
||||||
|
textAlign: 'left',
|
||||||
|
paddingLeft: 25,
|
||||||
|
textShadow: '0px 3px #504F4F',
|
||||||
|
},
|
||||||
|
searchContainer: {
|
||||||
|
width: '100%',
|
||||||
|
margin: 'auto',
|
||||||
|
textAlign: 'center',
|
||||||
|
height: 250,
|
||||||
|
background:
|
||||||
|
'linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(242,112,156,1) 0%, rgba(255,148,114,1) 46%)',
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
paddingTop: 10,
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
searchInput: {
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
|
rootInput: {
|
||||||
|
color: '#000',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
borderRadius: 20,
|
||||||
|
height: 25,
|
||||||
|
fontFamily: "'Libre Franklin', sans-serif",
|
||||||
|
},
|
||||||
|
subMenu: {
|
||||||
|
marginTop: 40,
|
||||||
|
width: '85%',
|
||||||
|
margin: 'auto',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
subMenuButton: {
|
||||||
|
display: 'flex',
|
||||||
|
boxShadow: '0px 4px 4px 0px rgba(0, 0, 0, 0.25)',
|
||||||
|
justifyContent: 'space-around',
|
||||||
|
alignItems: 'center',
|
||||||
|
backgroundColor: '#fff',
|
||||||
|
color: '#838383',
|
||||||
|
height: 30,
|
||||||
|
fontSize: 16,
|
||||||
|
'&:hover': {
|
||||||
|
background: '#ddd',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textFieldInput: {
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
inputRoot: {
|
||||||
|
color: '#fff',
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
|
inputInput: {
|
||||||
|
padding: theme.spacing(1, 0, 1, 0),
|
||||||
|
transition: theme.transitions.create('width'),
|
||||||
|
width: '100%',
|
||||||
|
color: '#000',
|
||||||
|
fontWeight: 500,
|
||||||
|
height: '30px',
|
||||||
|
},
|
||||||
|
search: {
|
||||||
|
position: 'relative',
|
||||||
|
borderRadius: 20,
|
||||||
|
backgroundColor: fade(theme.palette.common.white, 1.0),
|
||||||
|
'&:hover': {
|
||||||
|
backgroundColor: fade(theme.palette.common.white, 1.0),
|
||||||
|
},
|
||||||
|
color: '#838383',
|
||||||
|
margin: 'auto',
|
||||||
|
textAlign: 'center',
|
||||||
|
width: '90%',
|
||||||
|
},
|
||||||
|
searchIcon: {
|
||||||
|
color: '#838383',
|
||||||
|
padding: theme.spacing(0, 0.5),
|
||||||
|
height: '100%',
|
||||||
|
position: 'absolute',
|
||||||
|
pointerEvents: 'none',
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export default useStyles;
|
||||||
@@ -1,8 +1,20 @@
|
|||||||
import { atom } from "recoil";
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
export const selloutState = {
|
export const selloutState = {
|
||||||
listing: atom({
|
listing: atom({
|
||||||
key: "listing",
|
key: 'listing',
|
||||||
default: [],
|
default: null,
|
||||||
})
|
}),
|
||||||
|
listingModal: atom({
|
||||||
|
key: 'listingModal',
|
||||||
|
default: false,
|
||||||
|
}),
|
||||||
|
listingDetails: atom({
|
||||||
|
key: 'listingDetails',
|
||||||
|
default: null,
|
||||||
|
}),
|
||||||
|
itemModal: atom({
|
||||||
|
key: 'itemModal',
|
||||||
|
default: false,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
|
||||||
|
export const useItemModal = () => {
|
||||||
|
const [itemModal, setItemModal] = useRecoilState(selloutState.itemModal);
|
||||||
|
return { itemModal, setItemModal };
|
||||||
|
};
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
import { useRecoilValue } from "recoil";
|
import { useRecoilValue } from 'recoil';
|
||||||
import { selloutState } from "./state";
|
import { selloutState } from './state';
|
||||||
|
|
||||||
export const useListing = () => {
|
import { ListingProps } from '../../../common/typings/listings';
|
||||||
const listing = useRecoilValue(selloutState.listing);
|
|
||||||
return { listing };
|
interface ListingHook {
|
||||||
|
listings: ListingProps[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useListing = (): ListingHook => {
|
||||||
|
const listings = useRecoilValue(selloutState.listing);
|
||||||
|
return { listings };
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilState } from 'recoil';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
|
||||||
|
export const useListingDetails = () => {
|
||||||
|
const [details, setDetails] = useRecoilState(selloutState.listingDetails);
|
||||||
|
return { details, setDetails };
|
||||||
|
};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilState } from "recoil";
|
||||||
|
import {selloutState} from "./state";
|
||||||
|
|
||||||
|
export const useListingModal = () => {
|
||||||
|
const [ modal, setModal ] = useRecoilState(selloutState.listingModal);
|
||||||
|
return { modal, setModal }
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export interface ListingProps {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
phone_number: string;
|
||||||
|
title: string;
|
||||||
|
url: string;
|
||||||
|
description: string;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
@@ -26,8 +26,7 @@ onNet(events.CONTACTS_ADD_CONTACT_SUCCESS, () => {
|
|||||||
|
|
||||||
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
|
RegisterNuiCallbackType(events.CONTACTS_UPDATE_CONTACT);
|
||||||
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
|
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
|
||||||
const contact = data;
|
emitNet(events.CONTACTS_UPDATE_CONTACT, data)
|
||||||
emitNet(events.CONTACTS_UPDATE_CONTACT, contact)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
||||||
@@ -36,14 +35,14 @@ onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
|||||||
|
|
||||||
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
|
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
|
||||||
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any) => {
|
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any) => {
|
||||||
const contact = data;
|
emitNet(events.CONTACTS_DELETE_CONTACT, data)
|
||||||
emitNet(events.CONTACTS_DELETE_CONTACT, contact)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
|
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
|
||||||
emitNet(events.CONTACTS_GET_CONTACTS)
|
emitNet(events.CONTACTS_GET_CONTACTS)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/*
|
||||||
onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
||||||
SendNuiMessage(
|
SendNuiMessage(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
@@ -52,4 +51,4 @@ onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
|||||||
data: result
|
data: result
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
})
|
})*/
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import events from '../utils/events';
|
import events from '../utils/events';
|
||||||
import { Message, MessageGroup } from '../../phone/src/common/interfaces/messages';
|
import { Message, MessageGroup } from '../../phone/src/common/typings/messages';
|
||||||
import { sendMessageEvent } from '../utils/messages';
|
import { sendMessageEvent } from '../utils/messages';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,24 @@
|
|||||||
import events from '../utils/events';
|
import events from '../utils/events';
|
||||||
import { ESX } from './server';
|
import {ESX} from './server';
|
||||||
import { getSource } from "./functions";
|
import {getSource, useIdentifier} from "./functions";
|
||||||
import { pool } from './db';
|
import {pool} from './db';
|
||||||
import { Transfer, Credentials } from '../../phone/src/common/interfaces/bank';
|
import {IBankCredentials, Transfer} from '../../phone/src/common/typings/bank';
|
||||||
import { useIdentifier } from './functions';
|
|
||||||
import { type } from 'os';
|
|
||||||
|
|
||||||
|
|
||||||
async function fetchAllTransactions(identifier: string): Promise<Transfer[]> {
|
async function fetchAllTransactions(identifier: string): Promise<Transfer[]> {
|
||||||
const query = "SELECT * FROM npwd_bank_transfers WHERE identifier = ? ORDER BY id DESC"
|
const query = "SELECT * FROM npwd_bank_transfers WHERE identifier = ? ORDER BY id DESC"
|
||||||
const [ results ] = await pool.query(query, [identifier])
|
const [ results ] = await pool.query(query, [identifier])
|
||||||
const transactions = <Transfer[]>results;
|
return <Transfer[]>results;
|
||||||
|
|
||||||
return transactions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchCredentials(): Credentials {
|
function fetchCredentials(): IBankCredentials {
|
||||||
const name = ESX.GetPlayerFromId(getSource()).getName();
|
const name = ESX.GetPlayerFromId(getSource()).getName();
|
||||||
const balance = ESX.GetPlayerFromId(getSource()).getAccount('bank').money
|
const balance = ESX.GetPlayerFromId(getSource()).getAccount('bank').money
|
||||||
|
|
||||||
const result = {
|
return {
|
||||||
name,
|
name,
|
||||||
balance
|
balance
|
||||||
}
|
};
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addTransfer(identifier: string, transfer: Transfer): Promise<any> {
|
async function addTransfer(identifier: string, transfer: Transfer): Promise<any> {
|
||||||
@@ -86,11 +80,10 @@ onNet(events.BANK_FETCH_TRANSACTIONS, async () => {
|
|||||||
|
|
||||||
onNet(events.BANK_ADD_TRANSFER, async (transfer: Transfer) => {
|
onNet(events.BANK_ADD_TRANSFER, async (transfer: Transfer) => {
|
||||||
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
||||||
const targetSource = xTarget.source;
|
|
||||||
try {
|
try {
|
||||||
const _identifier = await useIdentifier()
|
const _identifier = await useIdentifier()
|
||||||
const transferNotify = await addTransfer(_identifier, transfer)
|
const transferNotify = await addTransfer(_identifier, transfer)
|
||||||
emitNet(events.BANK_TRANSACTION_NOTIFICATION, targetSource, transferNotify)
|
emitNet(events.BANK_TRANSACTION_NOTIFICATION, xTarget, transferNotify)
|
||||||
emitNet(events.BANK_ADD_TRANSFER_SUCCESS, getSource());
|
emitNet(events.BANK_ADD_TRANSFER_SUCCESS, getSource());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), false)
|
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), false)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ESX } from "./server";
|
import {ESX} from "./server";
|
||||||
import { pool } from "./db";
|
import {pool} from "./db";
|
||||||
import events from "../utils/events";
|
import events from "../utils/events";
|
||||||
import { useIdentifier, getSource } from './functions'
|
import {getSource, useIdentifier} from './functions'
|
||||||
|
|
||||||
interface Contacts {
|
interface Contacts {
|
||||||
id?: number;
|
id?: number;
|
||||||
@@ -18,8 +18,7 @@ interface ContactId {
|
|||||||
async function fetchAllContacts(identifier: string): Promise<Contacts[]> {
|
async function fetchAllContacts(identifier: string): Promise<Contacts[]> {
|
||||||
const query = "SELECT * FROM npwd_phone_contacts WHERE identifier = ?";
|
const query = "SELECT * FROM npwd_phone_contacts WHERE identifier = ?";
|
||||||
const [results] = await pool.query(query, [identifier]);
|
const [results] = await pool.query(query, [identifier]);
|
||||||
const contacts = <Contacts[]>results;
|
return <Contacts[]>results;
|
||||||
return contacts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addContact(
|
async function addContact(
|
||||||
@@ -70,12 +69,13 @@ onNet(events.CONTACTS_ADD_CONTACT, async (number: string, display: string, avata
|
|||||||
try {
|
try {
|
||||||
const _source = (global as any).source;
|
const _source = (global as any).source;
|
||||||
const _identifier = await useIdentifier()
|
const _identifier = await useIdentifier()
|
||||||
addContact(_identifier, number, display, avatar);
|
await addContact(_identifier, number, display, avatar);
|
||||||
emitNet(events.CONTACTS_ADD_CONTACT_SUCCESS, _source)
|
emitNet(events.CONTACTS_ADD_CONTACT_SUCCESS, _source)
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_SUCCESS')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_SUCCESS')
|
||||||
|
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_FAILED')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_FAILED')
|
||||||
|
console.log(error)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,21 +83,23 @@ onNet(events.CONTACTS_UPDATE_CONTACT, async (contact: Contacts) => {
|
|||||||
try {
|
try {
|
||||||
const _source = (global as any)._source
|
const _source = (global as any)._source
|
||||||
const _identifier = await useIdentifier()
|
const _identifier = await useIdentifier()
|
||||||
updateContact(contact, _identifier)
|
await updateContact(contact, _identifier)
|
||||||
emitNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, _source)
|
emitNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, _source)
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_UPDATE_SUCCESS')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_UPDATE_SUCCESS')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_UPDATE_FAILED')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_UPDATE_FAILED')
|
||||||
|
console.log(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onNet(events.CONTACTS_DELETE_CONTACT, async (contact: ContactId) => {
|
onNet(events.CONTACTS_DELETE_CONTACT, async (contact: ContactId) => {
|
||||||
try {
|
try {
|
||||||
const _identifier = await useIdentifier()
|
const _identifier = await useIdentifier()
|
||||||
deleteContact(contact, _identifier)
|
await deleteContact(contact, _identifier)
|
||||||
emitNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, getSource())
|
emitNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, getSource())
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_DELETE_SUCCESS')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_DELETE_SUCCESS')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_DELETE_FAILED')
|
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_DELETE_FAILED')
|
||||||
|
console.log(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import md5 from 'md5';
|
import md5 from 'md5';
|
||||||
|
|
||||||
import events from '../utils/events';
|
import events from '../utils/events';
|
||||||
import { Message, MessageGroup, CreateMessageGroupResult } from '../../phone/src/common/interfaces/messages';
|
import { Message, MessageGroup, CreateMessageGroupResult } from '../../phone/src/common/typings/messages';
|
||||||
import { pool, withTransaction } from "./db";
|
import { pool, withTransaction } from "./db";
|
||||||
import { getSource, useIdentifier } from './functions';
|
import { getSource, useIdentifier } from './functions';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import events from "../utils/events";
|
import events from "../utils/events";
|
||||||
import { pool } from "./db";
|
import {pool} from "./db";
|
||||||
import { useIdentifier, getSource } from "./functions";
|
import {getSource, useIdentifier} from "./functions";
|
||||||
import { Note, NoteId } from "../../phone/src/common/interfaces/notes";
|
import {Note, NoteId} from "../../phone/src/common/typings/notes";
|
||||||
|
|
||||||
async function addNote(identifier: string, note: Note): Promise<any> {
|
async function addNote(identifier: string, note: Note): Promise<any> {
|
||||||
const query =
|
const query =
|
||||||
@@ -13,8 +13,7 @@ async function fetchAllNotes(identifier: string): Promise<Note[]> {
|
|||||||
const query =
|
const query =
|
||||||
"SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
|
"SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
|
||||||
const [result] = await pool.query(query, [identifier]);
|
const [result] = await pool.query(query, [identifier]);
|
||||||
const notes = <Note[]>result;
|
return <Note[]>result;
|
||||||
return notes;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteNote(noteId: number, identifier: string) {
|
async function deleteNote(noteId: number, identifier: string) {
|
||||||
@@ -31,7 +30,7 @@ async function updateNote(note: Note, identifier: string): Promise<any> {
|
|||||||
onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
onNet(events.NOTE_ADD_NOTE, async (note: Note) => {
|
||||||
try {
|
try {
|
||||||
const _identifier = await useIdentifier();
|
const _identifier = await useIdentifier();
|
||||||
addNote(_identifier, note);
|
await addNote(_identifier, note);
|
||||||
emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource());
|
emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("NOTES ERROR: ", error);
|
console.log("NOTES ERROR: ", error);
|
||||||
@@ -63,7 +62,7 @@ onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => {
|
|||||||
const _source = (global as any).source;
|
const _source = (global as any).source;
|
||||||
try {
|
try {
|
||||||
const _identifier = await useIdentifier();
|
const _identifier = await useIdentifier();
|
||||||
updateNote(note, _identifier);
|
await updateNote(note, _identifier);
|
||||||
emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, _source);
|
emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, _source);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
emitNet(events.NOTE_UPDATE_NOTE_FAILURE, _source);
|
emitNet(events.NOTE_UPDATE_NOTE_FAILURE, _source);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import events from '../utils/events';
|
import events from '../utils/events';
|
||||||
import { ESX, getSource } from './server';
|
import {getSource} from './server';
|
||||||
import { pool } from './db';
|
import {pool} from './db';
|
||||||
import { useIdentifier } from './functions';
|
import {useIdentifier} from './functions';
|
||||||
import { IPhoto } from '../../phone/src/common/interfaces/photo';
|
import {IPhoto} from '../../phone/src/common/typings/photo';
|
||||||
|
|
||||||
async function uploadPhoto(identifier: string, image: string) {
|
async function uploadPhoto(identifier: string, image: string) {
|
||||||
const query = 'INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)';
|
const query = 'INSERT INTO npwd_phone_gallery (identifier, image) VALUES (?, ?)';
|
||||||
@@ -12,8 +12,7 @@ async function uploadPhoto(identifier: string, image: string) {
|
|||||||
async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
|
async function getPhotosByIdentifier(identifier: string): Promise<IPhoto[]> {
|
||||||
const query = "SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
|
const query = "SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
|
||||||
const [ results ] = await pool.query(query, [identifier]);
|
const [ results ] = await pool.query(query, [identifier]);
|
||||||
const photos = <IPhoto[]>results;
|
return <IPhoto[]>results;
|
||||||
return photos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deletePhoto(photo: IPhoto, identifier: string) {
|
async function deletePhoto(photo: IPhoto, identifier: string) {
|
||||||
|
|||||||
@@ -4,26 +4,27 @@ import { ESX } from './server';
|
|||||||
import { getSource } from "./functions";
|
import { getSource } from "./functions";
|
||||||
import { pool } from './db';
|
import { pool } from './db';
|
||||||
import { usePhoneNumber } from './functions';
|
import { usePhoneNumber } from './functions';
|
||||||
|
import { Listings} from "../../phone/src/common/typings/listings";
|
||||||
|
|
||||||
|
|
||||||
interface Listing {
|
/*
|
||||||
title: string;
|
Fetches all the listings and returns an array of objects
|
||||||
name: string;
|
*/
|
||||||
url?: string;
|
async function fetchAllListings(): Promise<Listings[]> {
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function fetchAllListings(): Promise<Listing[]> {
|
|
||||||
const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC";
|
const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC";
|
||||||
|
|
||||||
const [ results ] = await pool.query(query);
|
const [ results ] = await pool.query(query);
|
||||||
const listings = <Listing[]>results;
|
return <Listings[]>results;
|
||||||
|
|
||||||
return listings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addListing(identifier: string, name: string, number: any, listing: Listing): Promise<any> {
|
/**
|
||||||
|
* Adds the note to the database with the player identifier and the note.
|
||||||
|
* @param identifier A players unique identifier
|
||||||
|
* @param name The player in-game name
|
||||||
|
* @param number The players phone number
|
||||||
|
* @param listing The listing object
|
||||||
|
*/
|
||||||
|
async function addListing(identifier: string, name: string, number: string, listing: Listings): Promise<any> {
|
||||||
const query = "INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)"
|
const query = "INSERT INTO npwd_sellout_listings (identifier, name, number, title, url, description) VALUES (?, ?, ?, ?, ?, ?)"
|
||||||
await pool.query(query, [
|
await pool.query(query, [
|
||||||
identifier,
|
identifier,
|
||||||
@@ -35,6 +36,9 @@ async function addListing(identifier: string, name: string, number: any, listing
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Event that sends the listings to client, which sends to NUI
|
||||||
|
*/
|
||||||
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
||||||
try {
|
try {
|
||||||
const _source = (global as any).source;
|
const _source = (global as any).source;
|
||||||
@@ -46,7 +50,10 @@ onNet(events.SELLOUT_FETCH_LISTING, async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
/*
|
||||||
|
Event
|
||||||
|
*/
|
||||||
|
onNet(events.SELLOUT_ADD_LISTING, async (listing: Listings) => {
|
||||||
try {
|
try {
|
||||||
const xPlayer = ESX.GetPlayerFromId(getSource())
|
const xPlayer = ESX.GetPlayerFromId(getSource())
|
||||||
const _identifier = xPlayer.getIdentifier()
|
const _identifier = xPlayer.getIdentifier()
|
||||||
@@ -57,4 +64,8 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Failed to add contact: ", error)
|
console.log("Failed to add contact: ", error)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onNet('phone:createExternalProccess', async () => {
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
export default {
|
export default {
|
||||||
TWITTER: "TWITTER",
|
TWITTER: "TWITTER",
|
||||||
MESSAGES: "MESSAGES"
|
MESSAGES: "MESSAGES",
|
||||||
|
NOTES: "NOTES",
|
||||||
|
CAMERA: "CAMERA",
|
||||||
|
BANK: "BANK",
|
||||||
|
DAILER: "DAILER",
|
||||||
|
MARKET: "MARKET",
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user