mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-05 06:28:51 +00:00
Feat(Sellout): Base app
This commit is contained in:
1 parent
9e09ce8879
commit
2112bb5555
13 files changed
+307
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,25 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { AppWrapper } from "../../../ui/components/AppWrapper";
|
||||||
|
import { AppContent } from "../../../ui/components/AppContent";
|
||||||
|
import { SelloutTitle } from "./SelloutTitle";
|
||||||
|
import { SelloutListContainer } from "./SelloutList/SelloutListContainer";
|
||||||
|
import { NavigationBar } from "./navigation/NavigationBar";
|
||||||
|
import { Switch, Route } from "react-router-dom";
|
||||||
|
|
||||||
|
import "./Sellout.css";
|
||||||
|
import { ListingFormContainer } from "./form/ListingFormContainer";
|
||||||
|
|
||||||
|
export const SelloutApp = () => {
|
||||||
|
return (
|
||||||
|
<AppWrapper id="sellout-app">
|
||||||
|
<SelloutTitle />
|
||||||
|
<AppContent>
|
||||||
|
<Switch>
|
||||||
|
<Route path="/sellout" exact component={SelloutListContainer} />
|
||||||
|
<Route path="/sellout/new" component={ListingFormContainer} />
|
||||||
|
</Switch>
|
||||||
|
</AppContent>
|
||||||
|
<NavigationBar />
|
||||||
|
</AppWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Typography,
|
||||||
|
Paper,
|
||||||
|
} from "@material-ui/core";
|
||||||
|
import { ImageDisplay } from "../images/ImageDisplay";
|
||||||
|
import { ListItem } from "../../../../ui/components/ListItem";
|
||||||
|
import ChatIcon from "@material-ui/icons/Chat";
|
||||||
|
import PhoneIcon from "@material-ui/icons/Phone";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
overflowX: "hidden",
|
||||||
|
display: "flex",
|
||||||
|
flexFlow: "row nowrap",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
width: "100%",
|
||||||
|
marginTop: "3px",
|
||||||
|
},
|
||||||
|
content: {
|
||||||
|
display: "flex",
|
||||||
|
marginTop: "-10px",
|
||||||
|
flexFlow: "column nowrap",
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
paper: {
|
||||||
|
overflow: "auto",
|
||||||
|
display: "flex",
|
||||||
|
flexFlow: "column",
|
||||||
|
alignItems: "flex",
|
||||||
|
height: "auto",
|
||||||
|
background: "#232323",
|
||||||
|
marginBottom: 20,
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
margin: 10,
|
||||||
|
},
|
||||||
|
headerTypo: {
|
||||||
|
margin: 5,
|
||||||
|
},
|
||||||
|
desc: {
|
||||||
|
padding: 10,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const SelloutItem = (listing) => {
|
||||||
|
const classes = useStyles();
|
||||||
|
return (
|
||||||
|
<ListItem className={classes.root}>
|
||||||
|
<div className={classes.content}>
|
||||||
|
<Paper elevation={2} className={classes.paper}>
|
||||||
|
<div className={classes.header}>
|
||||||
|
<Typography className={classes.headerTypo} variant="h5">
|
||||||
|
{listing.name}
|
||||||
|
</Typography>
|
||||||
|
<Typography
|
||||||
|
className={classes.headerTypo}
|
||||||
|
style={{ borderBottom: "1px solid #f44336" }}
|
||||||
|
>
|
||||||
|
{listing.number}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<ImageDisplay imgURL={listing.img} />
|
||||||
|
<Typography variant="h7" className={classes.desc}>
|
||||||
|
{listing.description}
|
||||||
|
</Typography>
|
||||||
|
<div className={classes.postActions}>
|
||||||
|
<Button>
|
||||||
|
<ChatIcon style={{ color: "#f44336" }} />
|
||||||
|
</Button>
|
||||||
|
<Button>
|
||||||
|
<PhoneIcon style={{ color: "#f44336" }} />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Paper>
|
||||||
|
</div>
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { List } from "../../../../ui/components/List";
|
||||||
|
import { SelloutItem } from "./SelloutItem";
|
||||||
|
|
||||||
|
export const SelloutList = ({ listings }) => {
|
||||||
|
return (
|
||||||
|
<List>
|
||||||
|
{listings.map((listing) => (
|
||||||
|
<SelloutItem key={listing.id} {...listing} />
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useListing } from "../../hooks/useListing";
|
||||||
|
import { SelloutList } from "./SelloutList";
|
||||||
|
|
||||||
|
export const SelloutListContainer = () => {
|
||||||
|
const { listing } = useListing();
|
||||||
|
return <SelloutList listings={listing} />;
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React from "react";
|
||||||
|
import Paper from "@material-ui/core/Paper";
|
||||||
|
import { makeStyles } from "@material-ui/core";
|
||||||
|
import LinkedInIcon from "@material-ui/icons/LinkedIn";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
height: "60px",
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
flexFlow: "row nowrap",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
background: "#424242",
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
color: "#f44336",
|
||||||
|
fontSize: 40,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const SelloutTitle = () => {
|
||||||
|
const classes = useStyles();
|
||||||
|
return (
|
||||||
|
<Paper className={classes.root} square variant="outlined" elevation={24}>
|
||||||
|
<LinkedInIcon className={classes.icon} />
|
||||||
|
</Paper>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { makeStyles, Button, TextField } from "@material-ui/core";
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
width: "100%",
|
||||||
|
margin: "auto",
|
||||||
|
textAlign: "center",
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
marginBottom: 25,
|
||||||
|
},
|
||||||
|
textFieldInput: {
|
||||||
|
fontSize: 22,
|
||||||
|
},
|
||||||
|
multilineFieldInput: {
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
postButton: {
|
||||||
|
display: "block",
|
||||||
|
margin: "auto",
|
||||||
|
background: "#f44336",
|
||||||
|
width: "80%",
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
export const ListingForm = () => {
|
||||||
|
const classes = useStyles();
|
||||||
|
return (
|
||||||
|
<div className={classes.root}>
|
||||||
|
<h1>New Listing</h1>
|
||||||
|
<TextField
|
||||||
|
className={classes.input}
|
||||||
|
placeholder="Title on listing.."
|
||||||
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
|
style={{ width: "80%" }}
|
||||||
|
size="medium"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className={classes.input}
|
||||||
|
placeholder="Image URL"
|
||||||
|
inputProps={{ className: classes.textFieldInput }}
|
||||||
|
style={{ width: "80%" }}
|
||||||
|
size="medium"
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
className={classes.input}
|
||||||
|
placeholder="Description"
|
||||||
|
inputProps={{ className: classes.multilineFieldInput }}
|
||||||
|
style={{ width: "80%" }}
|
||||||
|
size="medium"
|
||||||
|
multiline
|
||||||
|
rows={4}
|
||||||
|
variant="outlined"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Button className={classes.postButton}>Post</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { ListingForm } from './ListingForm';
|
||||||
|
|
||||||
|
export const ListingFormContainer = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ListingForm />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export const ImageDisplay = ({ imgURL }) => {
|
||||||
|
return <img src={imgURL} alt="Image" style={{height: 200, width: 350, margin: "auto"}}/>
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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 HomeIcon from '@material-ui/icons/Home';
|
||||||
|
import AddCircleIcon from '@material-ui/icons/AddCircle';
|
||||||
|
import FaceIcon from '@material-ui/icons/Face';
|
||||||
|
|
||||||
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
width: '100%'
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
color: "#f44336"
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
|
||||||
|
export const NavigationBar = () => {
|
||||||
|
const classes = useStyles();
|
||||||
|
const [activePage, setActivePage] = useState(0);
|
||||||
|
return (
|
||||||
|
<BottomNavigation
|
||||||
|
valule={activePage}
|
||||||
|
onChange={(event, newPage) => {
|
||||||
|
setActivePage(newPage)
|
||||||
|
}}
|
||||||
|
showLabels
|
||||||
|
className={classes.root}
|
||||||
|
>
|
||||||
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<HomeIcon />}
|
||||||
|
to="/sellout"
|
||||||
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<AddCircleIcon />}
|
||||||
|
to="/sellout/new"
|
||||||
|
/>
|
||||||
|
<BottomNavigationAction
|
||||||
|
component={Link}
|
||||||
|
icon={<FaceIcon />}
|
||||||
|
to="/sellout/profile"
|
||||||
|
/>
|
||||||
|
</BottomNavigation>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
export const selloutState = {
|
||||||
|
listing: atom({
|
||||||
|
key: 'listing',
|
||||||
|
default: null
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import { useRecoilValue } from 'recoil';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
|
||||||
|
export const useListing = () => {
|
||||||
|
const listing = useRecoilValue(selloutState.listing);
|
||||||
|
return { listing };
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||||
|
import { selloutState } from './state';
|
||||||
|
import { useListing } from './useListing';
|
||||||
|
import { useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
|
export const useSelloutService = () => {
|
||||||
|
const setSellout = useSetRecoilState(selloutState.listing);
|
||||||
|
useNuiEvent('SELLOUT', 'setListings', setSellout);
|
||||||
|
return useListing()
|
||||||
|
}
|
||||||
Reference in new issue
Block a user