mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-01 14:38:47 +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',
|
||||
number: '123-4567',
|
||||
title: 'Car',
|
||||
category: 'CAR',
|
||||
description: 'Selling this cool car',
|
||||
url: 'https://i.imgur.com/ROmGTwi.jpeg',
|
||||
price: 400,
|
||||
posted: '1/9/2021',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Some other dude',
|
||||
number: '666-6666',
|
||||
title: 'Material',
|
||||
description: 'Selling my wife',
|
||||
description:
|
||||
'Selling my wife olsdfjsdfk jfksdaj kasjfksf jdkasf jklasf jasklf jaskf',
|
||||
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 {
|
||||
color: #f44336 !important;
|
||||
}
|
||||
|
||||
|
||||
#sellout-app .Mui-focused::after {
|
||||
#sellout-app .Mui-focused::after {
|
||||
border-bottom: #f44336 solid 3px;
|
||||
}
|
||||
@@ -1,25 +1,20 @@
|
||||
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 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 "./Sellout.css";
|
||||
import { ListingFormContainer } from "./form/ListingFormContainer";
|
||||
import './Sellout.css';
|
||||
import { ListingForm } from './form/ListingForm';
|
||||
import ItemModal from './modal/ItemModal';
|
||||
|
||||
export const SelloutApp = () => {
|
||||
return (
|
||||
<AppWrapper id="sellout-app">
|
||||
<SelloutTitle />
|
||||
<AppWrapper id='sellout-app'>
|
||||
<AppContent>
|
||||
<Switch>
|
||||
<Route path="/sellout" exact component={SelloutListContainer} />
|
||||
<Route path="/sellout/new" component={ListingFormContainer} />
|
||||
</Switch>
|
||||
<ListingForm />
|
||||
<SelloutListContainer />
|
||||
</AppContent>
|
||||
<NavigationBar />
|
||||
</AppWrapper>
|
||||
);
|
||||
};
|
||||
@@ -1,81 +1,111 @@
|
||||
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";
|
||||
import React from 'react';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Button, Typography, Paper } from '@material-ui/core';
|
||||
import { ListItem } from '../../../../ui/components/ListItem';
|
||||
import { useItemModal } from '../../hooks/useItemModal';
|
||||
import { useListingDetails } from '../../hooks/useListingDetails';
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
overflowX: "hidden",
|
||||
display: "flex",
|
||||
flexFlow: "row nowrap",
|
||||
alignItems: "flex-start",
|
||||
width: "100%",
|
||||
marginTop: "3px",
|
||||
overflowX: 'hidden',
|
||||
display: 'flex',
|
||||
flexFlow: 'row nowrap',
|
||||
alignItems: 'flex-start',
|
||||
width: '100%',
|
||||
marginTop: '5px',
|
||||
},
|
||||
content: {
|
||||
display: "flex",
|
||||
marginTop: "-10px",
|
||||
flexFlow: "column nowrap",
|
||||
width: "100%",
|
||||
display: 'flex',
|
||||
marginTop: '-5px',
|
||||
flexFlow: 'column nowrap',
|
||||
width: '100%',
|
||||
},
|
||||
paper: {
|
||||
overflow: "auto",
|
||||
display: "flex",
|
||||
flexFlow: "column",
|
||||
alignItems: "flex",
|
||||
height: "auto",
|
||||
background: "#232323",
|
||||
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: 10,
|
||||
},
|
||||
headerTypo: {
|
||||
margin: 5,
|
||||
},
|
||||
headerTypo: {
|
||||
margin: 3,
|
||||
},
|
||||
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) => {
|
||||
const classes = useStyles();
|
||||
|
||||
const { setItemModal } = useItemModal();
|
||||
const { setDetails } = useListingDetails();
|
||||
|
||||
const handleOpenListing = (listing) => {
|
||||
setDetails(listing);
|
||||
setItemModal(true);
|
||||
};
|
||||
|
||||
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>
|
||||
<Typography variant="h5" style={{ padding: 5}}>
|
||||
<Typography variant='h5' style={{ padding: '5px 0px 0px 10px' }}>
|
||||
{listing.title}
|
||||
</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>
|
||||
{listing.url ? (
|
||||
<ImageDisplay imgURL={listing.url} />
|
||||
): (
|
||||
<Typography style={{ margin: 10 }}>No image provided🙁</Typography>
|
||||
) }
|
||||
<Typography variant="h6" className={classes.desc}>
|
||||
{listing.description}
|
||||
</Typography>
|
||||
<div>
|
||||
<Button>
|
||||
<ChatIcon style={{ color: "#f44336" }} />
|
||||
</Button>
|
||||
<Button>
|
||||
<PhoneIcon style={{ color: "#f44336" }} />
|
||||
</Button>
|
||||
<div className={classes.imageSection}>
|
||||
<div
|
||||
className={classes.listingImage}
|
||||
style={{
|
||||
backgroundImage: `url(${listing.url})`,
|
||||
backgroundPosition: 'center',
|
||||
backgroundSize: 'cover',
|
||||
backgroundRepeat: 'no-repeat',
|
||||
width: '150px',
|
||||
height: '150px',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Paper>
|
||||
</div>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import React from "react";
|
||||
import { List } from "../../../../ui/components/List";
|
||||
import { SelloutItem } from "./SelloutItem";
|
||||
import React from 'react';
|
||||
import { List } from '../../../../ui/components/List';
|
||||
import SelloutSearch from '../search/SelloutSearch';
|
||||
import { SelloutItem } from './SelloutItem';
|
||||
|
||||
export const SelloutList = ({ listings }) => {
|
||||
return (
|
||||
<List>
|
||||
{listings.map((listing) => (
|
||||
<SelloutItem key={listing.id} {...listing} />
|
||||
))}
|
||||
</List>
|
||||
<div>
|
||||
<SelloutSearch />
|
||||
<List style={{ backgroundColor: '#F6F6F6' }}>
|
||||
{listings?.map((listing) => (
|
||||
<SelloutItem key={listing.id} {...listing} />
|
||||
))}
|
||||
</List>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -1,8 +1,31 @@
|
||||
import React from "react";
|
||||
import { useListing } from "../../hooks/useListing";
|
||||
import { SelloutList } from "./SelloutList";
|
||||
import React from 'react';
|
||||
import { useListing } from '../../hooks/useListing';
|
||||
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 = () => {
|
||||
const { listing } = useListing();
|
||||
return <SelloutList listings={listing} />;
|
||||
const { modal } = useListingModal();
|
||||
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();
|
||||
return (
|
||||
<Paper className={classes.root} square variant='outlined' elevation={24}>
|
||||
<FontAwesomeIcon icon={faAd} className={classes.icon} />
|
||||
<h3>Marketplace</h3>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
@@ -1,29 +1,54 @@
|
||||
import React, { useState } from "react";
|
||||
import { makeStyles, Button, TextField } from "@material-ui/core";
|
||||
import Nui from "../../../../os/nui-events/utils/Nui";
|
||||
import React, { useState } from 'react';
|
||||
import { makeStyles, Button, TextField, InputBase } from '@material-ui/core';
|
||||
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) => ({
|
||||
root: {
|
||||
width: "100%",
|
||||
margin: "auto",
|
||||
textAlign: "center",
|
||||
position: 'absolute',
|
||||
width: '100%',
|
||||
backgroundColor: '#F9F9F9',
|
||||
height: '100%',
|
||||
margin: 'auto',
|
||||
textAlign: 'center',
|
||||
fontFamily: "'Libre Franklin', sans-serif",
|
||||
},
|
||||
hidden: {
|
||||
display: 'none',
|
||||
},
|
||||
input: {
|
||||
marginBottom: 25,
|
||||
marginBottom: 20,
|
||||
fontFamily: "'Libre Franklin', sans-serif",
|
||||
},
|
||||
textFieldInput: {
|
||||
fontSize: 22,
|
||||
fontSize: 18,
|
||||
background: '#EBEBEB',
|
||||
color: '#272727',
|
||||
fontWeight: 600,
|
||||
textIndent: 3,
|
||||
borderRadius: 15,
|
||||
padding: 15,
|
||||
fontFamily: "'Libre Franklin', sans-serif",
|
||||
},
|
||||
multilineFieldInput: {
|
||||
fontSize: 20,
|
||||
fontSize: 18,
|
||||
background: '#EBEBEB',
|
||||
borderRadius: 15,
|
||||
fontFamily: "'Libre Franklin', sans-serif",
|
||||
color: '#272727',
|
||||
textIndent: 3,
|
||||
fontWeight: 600,
|
||||
padding: 15,
|
||||
},
|
||||
postButton: {
|
||||
display: "block",
|
||||
margin: "auto",
|
||||
background: "#f44336",
|
||||
width: "80%",
|
||||
display: 'block',
|
||||
margin: 'auto',
|
||||
background: '#f44336',
|
||||
width: '80%',
|
||||
fontSize: 20,
|
||||
},
|
||||
}));
|
||||
@@ -31,53 +56,75 @@ const useStyles = makeStyles((theme) => ({
|
||||
export const ListingForm = () => {
|
||||
const classes = useStyles();
|
||||
|
||||
const [ title, setTitle ] = useState('');
|
||||
const [ url, setUrl ] = useState('');
|
||||
const [ description, setDescription ] = useState('');
|
||||
const { modal, setModal } = useListingModal();
|
||||
|
||||
const [title, setTitle] = useState('');
|
||||
const [url, setUrl] = useState('');
|
||||
const [description, setDescription] = useState('');
|
||||
|
||||
const addListing = () => {
|
||||
Nui.send('phone:addListing', {
|
||||
title,
|
||||
url,
|
||||
description
|
||||
})
|
||||
}
|
||||
description,
|
||||
});
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
setModal(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<h1>New Listing</h1>
|
||||
<TextField
|
||||
<div className={modal ? classes.root : classes.hidden}>
|
||||
<h1 style={{ color: '#272727' }}>New Listing</h1>
|
||||
<InputBase
|
||||
className={classes.input}
|
||||
onChange={e => setTitle(e.target.value)}
|
||||
placeholder="Title on listing.."
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder='Title'
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
style={{ width: '80%' }}
|
||||
/>
|
||||
|
||||
<TextField
|
||||
<InputBase
|
||||
className={classes.input}
|
||||
placeholder="Image URL"
|
||||
onChange={e => setUrl(e.target.value)}
|
||||
placeholder='Category'
|
||||
inputProps={{ className: classes.textFieldInput }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
variant="outlined"
|
||||
style={{ width: '80%' }}
|
||||
/>
|
||||
|
||||
<TextField
|
||||
<InputBase
|
||||
className={classes.input}
|
||||
onChange={e => setDescription(e.target.value)}
|
||||
placeholder="Description"
|
||||
placeholder='Image or URL link'
|
||||
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 }}
|
||||
style={{ width: "80%" }}
|
||||
size="medium"
|
||||
style={{ width: '80%' }}
|
||||
multiline
|
||||
rows={4}
|
||||
variant="outlined"
|
||||
rows={3}
|
||||
/>
|
||||
|
||||
<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>
|
||||
);
|
||||
};
|
||||
@@ -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 = {
|
||||
listing: atom({
|
||||
key: "listing",
|
||||
default: [],
|
||||
})
|
||||
key: 'listing',
|
||||
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 { selloutState } from "./state";
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { selloutState } from './state';
|
||||
|
||||
export const useListing = () => {
|
||||
const listing = useRecoilValue(selloutState.listing);
|
||||
return { listing };
|
||||
import { ListingProps } from '../../../common/typings/listings';
|
||||
|
||||
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);
|
||||
on(`__cfx_nui:${events.CONTACTS_UPDATE_CONTACT}`, (data: any) => {
|
||||
const contact = data;
|
||||
emitNet(events.CONTACTS_UPDATE_CONTACT, contact)
|
||||
emitNet(events.CONTACTS_UPDATE_CONTACT, data)
|
||||
})
|
||||
|
||||
onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
||||
@@ -36,14 +35,14 @@ onNet(events.CONTACTS_UPDATE_CONTACT_SUCCESS, () => {
|
||||
|
||||
RegisterNuiCallbackType(events.CONTACTS_DELETE_CONTACT);
|
||||
on(`__cfx_nui:${events.CONTACTS_DELETE_CONTACT}`, (data: any) => {
|
||||
const contact = data;
|
||||
emitNet(events.CONTACTS_DELETE_CONTACT, contact)
|
||||
emitNet(events.CONTACTS_DELETE_CONTACT, data)
|
||||
})
|
||||
|
||||
onNet(events.CONTACTS_DELETE_CONTACT_SUCCESS, () => {
|
||||
emitNet(events.CONTACTS_GET_CONTACTS)
|
||||
})
|
||||
|
||||
/*
|
||||
onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
||||
SendNuiMessage(
|
||||
JSON.stringify({
|
||||
@@ -52,4 +51,4 @@ onNet(events.CONTACTS_ACTION_RESULT, (result: string) => {
|
||||
data: result
|
||||
})
|
||||
)
|
||||
})
|
||||
})*/
|
||||
@@ -1,5 +1,5 @@
|
||||
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';
|
||||
|
||||
|
||||
|
||||
@@ -1,30 +1,24 @@
|
||||
import events from '../utils/events';
|
||||
import { ESX } from './server';
|
||||
import { getSource } from "./functions";
|
||||
import { pool } from './db';
|
||||
import { Transfer, Credentials } from '../../phone/src/common/interfaces/bank';
|
||||
import { useIdentifier } from './functions';
|
||||
import { type } from 'os';
|
||||
import {ESX} from './server';
|
||||
import {getSource, useIdentifier} from "./functions";
|
||||
import {pool} from './db';
|
||||
import {IBankCredentials, Transfer} from '../../phone/src/common/typings/bank';
|
||||
|
||||
|
||||
async function fetchAllTransactions(identifier: string): Promise<Transfer[]> {
|
||||
const query = "SELECT * FROM npwd_bank_transfers WHERE identifier = ? ORDER BY id DESC"
|
||||
const [ results ] = await pool.query(query, [identifier])
|
||||
const transactions = <Transfer[]>results;
|
||||
|
||||
return transactions;
|
||||
return <Transfer[]>results;
|
||||
}
|
||||
|
||||
function fetchCredentials(): Credentials {
|
||||
function fetchCredentials(): IBankCredentials {
|
||||
const name = ESX.GetPlayerFromId(getSource()).getName();
|
||||
const balance = ESX.GetPlayerFromId(getSource()).getAccount('bank').money
|
||||
|
||||
const result = {
|
||||
return {
|
||||
name,
|
||||
balance
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
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) => {
|
||||
const xTarget = ESX.GetPlayerFromId(transfer.targetID);
|
||||
const targetSource = xTarget.source;
|
||||
try {
|
||||
const _identifier = await useIdentifier()
|
||||
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());
|
||||
} catch (error) {
|
||||
emitNet(events.BANK_TRANSACTION_ALERT, getSource(), false)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ESX } from "./server";
|
||||
import { pool } from "./db";
|
||||
import {ESX} from "./server";
|
||||
import {pool} from "./db";
|
||||
import events from "../utils/events";
|
||||
import { useIdentifier, getSource } from './functions'
|
||||
import {getSource, useIdentifier} from './functions'
|
||||
|
||||
interface Contacts {
|
||||
id?: number;
|
||||
@@ -18,8 +18,7 @@ interface ContactId {
|
||||
async function fetchAllContacts(identifier: string): Promise<Contacts[]> {
|
||||
const query = "SELECT * FROM npwd_phone_contacts WHERE identifier = ?";
|
||||
const [results] = await pool.query(query, [identifier]);
|
||||
const contacts = <Contacts[]>results;
|
||||
return contacts;
|
||||
return <Contacts[]>results;
|
||||
}
|
||||
|
||||
async function addContact(
|
||||
@@ -70,12 +69,13 @@ onNet(events.CONTACTS_ADD_CONTACT, async (number: string, display: string, avata
|
||||
try {
|
||||
const _source = (global as any).source;
|
||||
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_ACTION_RESULT, getSource(), 'CONTACT_ADD_SUCCESS')
|
||||
//emitNet(events.CONTACTS_ACTION_RESULT, getSource(), 'CONTACT_ADD_SUCCESS')
|
||||
|
||||
} 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 {
|
||||
const _source = (global as any)._source
|
||||
const _identifier = await useIdentifier()
|
||||
updateContact(contact, _identifier)
|
||||
await updateContact(contact, _identifier)
|
||||
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) {
|
||||
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) => {
|
||||
try {
|
||||
const _identifier = await useIdentifier()
|
||||
deleteContact(contact, _identifier)
|
||||
await deleteContact(contact, _identifier)
|
||||
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) {
|
||||
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 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 { getSource, useIdentifier } from './functions';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import events from "../utils/events";
|
||||
import { pool } from "./db";
|
||||
import { useIdentifier, getSource } from "./functions";
|
||||
import { Note, NoteId } from "../../phone/src/common/interfaces/notes";
|
||||
import {pool} from "./db";
|
||||
import {getSource, useIdentifier} from "./functions";
|
||||
import {Note, NoteId} from "../../phone/src/common/typings/notes";
|
||||
|
||||
async function addNote(identifier: string, note: Note): Promise<any> {
|
||||
const query =
|
||||
@@ -13,8 +13,7 @@ async function fetchAllNotes(identifier: string): Promise<Note[]> {
|
||||
const query =
|
||||
"SELECT * FROM npwd_notes WHERE identifier = ? ORDER BY id DESC";
|
||||
const [result] = await pool.query(query, [identifier]);
|
||||
const notes = <Note[]>result;
|
||||
return notes;
|
||||
return <Note[]>result;
|
||||
}
|
||||
|
||||
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) => {
|
||||
try {
|
||||
const _identifier = await useIdentifier();
|
||||
addNote(_identifier, note);
|
||||
await addNote(_identifier, note);
|
||||
emitNet(events.NOTE_SEND_NOTE_SUCCESS, getSource());
|
||||
} catch (error) {
|
||||
console.log("NOTES ERROR: ", error);
|
||||
@@ -63,7 +62,7 @@ onNet(events.NOTE_UPDATE_NOTE, async (note: Note) => {
|
||||
const _source = (global as any).source;
|
||||
try {
|
||||
const _identifier = await useIdentifier();
|
||||
updateNote(note, _identifier);
|
||||
await updateNote(note, _identifier);
|
||||
emitNet(events.NOTE_UPDATE_NOTE_SUCCESS, _source);
|
||||
} catch (error) {
|
||||
emitNet(events.NOTE_UPDATE_NOTE_FAILURE, _source);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import events from '../utils/events';
|
||||
import { ESX, getSource } from './server';
|
||||
import { pool } from './db';
|
||||
import { useIdentifier } from './functions';
|
||||
import { IPhoto } from '../../phone/src/common/interfaces/photo';
|
||||
import {getSource} from './server';
|
||||
import {pool} from './db';
|
||||
import {useIdentifier} from './functions';
|
||||
import {IPhoto} from '../../phone/src/common/typings/photo';
|
||||
|
||||
async function uploadPhoto(identifier: string, image: string) {
|
||||
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[]> {
|
||||
const query = "SELECT id, image FROM npwd_phone_gallery WHERE identifier = ? ORDER BY id DESC";
|
||||
const [ results ] = await pool.query(query, [identifier]);
|
||||
const photos = <IPhoto[]>results;
|
||||
return photos;
|
||||
return <IPhoto[]>results;
|
||||
}
|
||||
|
||||
async function deletePhoto(photo: IPhoto, identifier: string) {
|
||||
|
||||
@@ -4,26 +4,27 @@ import { ESX } from './server';
|
||||
import { getSource } from "./functions";
|
||||
import { pool } from './db';
|
||||
import { usePhoneNumber } from './functions';
|
||||
import { Listings} from "../../phone/src/common/typings/listings";
|
||||
|
||||
|
||||
interface Listing {
|
||||
title: string;
|
||||
name: string;
|
||||
url?: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
|
||||
async function fetchAllListings(): Promise<Listing[]> {
|
||||
/*
|
||||
Fetches all the listings and returns an array of objects
|
||||
*/
|
||||
async function fetchAllListings(): Promise<Listings[]> {
|
||||
const query = "SELECT * FROM npwd_sellout_listings ORDER BY id DESC";
|
||||
|
||||
const [ results ] = await pool.query(query);
|
||||
const listings = <Listing[]>results;
|
||||
|
||||
return listings;
|
||||
return <Listings[]>results;
|
||||
}
|
||||
|
||||
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 (?, ?, ?, ?, ?, ?)"
|
||||
await pool.query(query, [
|
||||
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 () => {
|
||||
try {
|
||||
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 {
|
||||
const xPlayer = ESX.GetPlayerFromId(getSource())
|
||||
const _identifier = xPlayer.getIdentifier()
|
||||
@@ -57,4 +64,8 @@ onNet(events.SELLOUT_ADD_LISTING, async (listing: Listing) => {
|
||||
} catch (error) {
|
||||
console.log("Failed to add contact: ", error)
|
||||
}
|
||||
})
|
||||
|
||||
onNet('phone:createExternalProccess', async () => {
|
||||
|
||||
})
|
||||
@@ -1,4 +1,9 @@
|
||||
export default {
|
||||
TWITTER: "TWITTER",
|
||||
MESSAGES: "MESSAGES"
|
||||
MESSAGES: "MESSAGES",
|
||||
NOTES: "NOTES",
|
||||
CAMERA: "CAMERA",
|
||||
BANK: "BANK",
|
||||
DAILER: "DAILER",
|
||||
MARKET: "MARKET",
|
||||
};
|
||||
Reference in new issue
Block a user