Skip to content

Commit

Permalink
Merge pull request #35 from agiledev-students-spring2024/master
Browse files Browse the repository at this point in the history
update branch
  • Loading branch information
Ella-zizzzy authored Mar 28, 2024
2 parents 850c087 + a8ca111 commit 57169f8
Show file tree
Hide file tree
Showing 23 changed files with 223 additions and 10 deletions.
5 changes: 4 additions & 1 deletion back-end/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// import and instantiate express
const express = require("express") // CommonJS import style!
const cors = require('cors')
const app = express() // instantiate an Express object

// we will put some server logic here later...

app.use(express.json());
app.use(cors())
app.use('/public', express.static('public'));
// export the express app we created to make it available to other modules
module.exports = app
7 changes: 7 additions & 0 deletions back-end/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"dependencies": {
"cors": "^2.8.5",
"express": "^4.19.2"
},
"devDependencies": {
"nodemon": "^3.1.0"
},
"scripts": {
"start": "nodemon server.js"
}
}
Binary file added back-end/public/accessories/accessory_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back-end/public/accessories/accessory_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back-end/public/accessories/accessory_3.webp
Binary file not shown.
Binary file added back-end/public/jackets/jacket_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back-end/public/jackets/jacket_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back-end/public/jackets/jacket_3.webp
Binary file not shown.
Binary file added back-end/public/pants/brown_pants.webp
Binary file not shown.
Binary file added back-end/public/pants/comfy.webp
Binary file not shown.
Binary file added back-end/public/pants/extra_pants.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added back-end/public/shirts/casual_shirt.webp
Binary file not shown.
Binary file added back-end/public/shirts/favorite_shirt.webp
Binary file not shown.
Binary file added back-end/public/shirts/formal_shirt.webp
Binary file not shown.
Binary file added back-end/public/shoes/shoes_1.avif
Binary file not shown.
Binary file added back-end/public/shoes/shoes_2.webp
Binary file not shown.
Binary file added back-end/public/shoes/shoes_3.webp
Binary file not shown.
Binary file added back-end/public/skirts/skirt_1.webp
Binary file not shown.
Binary file added back-end/public/skirts/skirt_2.webp
Binary file not shown.
Binary file added back-end/public/skirts/skirt_3.webp
Binary file not shown.
182 changes: 181 additions & 1 deletion back-end/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,189 @@

const server = require("./app") // load up the web server

const port = 3000 // the port to listen to for incoming requests
const port = 3001 // the port to listen to for incoming requests

// call express's listen function to start listening to the port
const accounts = [
{
"username": "tester",
"password": "tester"
},
{
"username": "example",
"password": "login"
}
];

const shirts = [
{ name: 'Casual Shirt',
brand: 'Awesome Brand',
type: 'Casual',
img: '/public/shirts/casual_shirt.webp'
},
{ name: 'Formal Shirt',
brand: 'Formal Brand',
type: 'Formal',
img: '/public/shirts/formal_shirt.webp'
},
{ name: 'Favorite Shirt',
brand: 'Awesome Brand',
type: 'Casual',
img: '/public/shirts/favorite_shirt.webp'
}
]

const pants = [
{ name: 'Casual Pants',
brand: 'Awesome Brand',
type: 'Casual',
img: '/public/pants/brown_pants.webp'
},
{ name: 'Least Favorite Pants',
brand: 'Fake Brand 3',
type: 'Casual',
img: '/public/pants/extra_pants.jpg'
},
{ name: 'Favorite Pants',
brand: 'Cool Brand',
type: 'Casual',
img: '/public/pants/comfy.webp'
}
]

const skirts = [
{ name: 'Best Dress',
brand: 'Awesome Brand',
type: 'Formal',
img: '/public/skirts/skirt_1.webp'
},
{ name: 'Least Favorite Dress',
brand: 'Fake Brand 170',
type: 'Formal',
img: '/public/skirts/skirt_2.webp'
},
{ name: '2nd Favorite Dress',
brand: 'Cool Brand',
type: 'Formal',
img: '/public/skirts/skirt_3.webp'
}
]

const jackets = [
{ name: 'Ugly Jacket',
brand: 'Awful Brand',
type: 'Casual',
img: '/public/jackets/jacket_1.jpg'
},
{ name: 'Coolest Jacket',
brand: 'Fake Brand 170',
type: 'Formal',
img: '/public/jackets/jacket_2.jpg'
},
{ name: 'Okay Jacket',
brand: 'Cool Brand',
type: 'Casual',
img: '/public/jackets/jacket_3.webp'
}
]

const shoes = [
{ name: 'Nice Shoes',
brand: 'Definitely Awesome',
type: 'Casual',
img: '/public/shoes/shoes_1.avif'
},
{ name: 'Decent Shoes',
brand: 'Definitely Awesome',
type: 'Casual',
img: '/public/shoes/shoes_2.webp'
},
{ name: 'Okay Shoes',
brand: 'Definitely Awesome',
type: 'Casual',
img: '/public/shoes/shoes_3.webp'
}
]

const accessories = [
{ name: 'Most Expensive',
brand: 'Cheap-O',
type: 'Formal',
img: '/public/accessories/accessory_1.jpg'
},
{ name: 'Best Accessory',
brand: 'Definitely Awesome',
type: 'Casual',
img: '/public/accessories/accessory_2.jpg'
},
{ name: 'Pretty Cool',
brand: 'Definitely Awesome',
type: 'Casual',
img: '/public/accessories/accessory_3.webp'
}
]

server.post('/login', (req,res) => {
const loginSuccessful = {
'loggedIn': true
};
const loginUnsuccessful = {
'loggedIn': false
};

console.log("login: ", req.body)
for(let i = 0; i < accounts.length; i++){
// console.log(req.body.username, req.body.password);
if(req.body.username == accounts[i].username){
if(req.body.password == accounts[i].password){
return res.json(loginSuccessful);
}
}
}
return res.json(loginUnsuccessful);

})

server.post('/register', (req,res) => {
console.log("register:", req.body)
for(let i = 0; i < accounts.length; i++){
// console.log(req.body.username, req.body.password);
if(req.body.username == accounts[i].username){
return res.json({'message':'Username taken. Please choose a different one','created': false})
}
}
accounts.push(
{ "username": req.body.username,
"password": req.body.password
})
return res.json({'message':'Account created','created': true})
})

server.get('/shirts', (req,res) =>{
return res.json(shirts);
})

server.get('/pants', (req,res) => {
return res.json(pants);
})

server.get('/skirts', (req,res) => {
return res.json(skirts);
})

server.get('/jackets', (req,res) => {
return res.json(jackets);
})

server.get('/shoes', (req,res) => {
return res.json(shoes);
})

server.get('/accessories', (req,res) => {
return res.json(accessories);
})


const listener = server.listen(port, function () {
console.log(`Server running on port: ${port}`)
})
Expand Down
37 changes: 30 additions & 7 deletions front-end/src/screens/Archive.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
import React from 'react';
import '../styles/Archive.css'

function Archive() {
return (
<div classname="Archive">
<div className='banner'>
import OverlayMenu from '../components/OverlayMenu'; // Import the OverlayMenu component

const Outfits = () => {
// Mock data for Pants
const Outfits = [
{ name: 'Casual Pants', brand: 'Brand A', type: 'Casual' },
{ name: 'Shirt', brand: 'Brand B', type: 'Formal' },
{ name: 'Shoes', brand: 'Brand C', type: 'Fashion' },
{ name: 'Hat', brand: 'Brand D', type: 'New' },
// ... add more items and stuff as needed
];

return(
<div className="Outfits">
<OverlayMenu />
<header className='Archive-banner'>
<h1>WARDROBE WIZARD</h1>
<h3>Outfit Archive</h3>
<h3>Pants</h3>
</header>
<div className="Outfit Archive">
{Outfits.map((item, index) => (
<div className="Outfit-item" key={index}>
<div className="Outfit-image"></div> {/* Placeholder for the image */}
<div className="Outfit-info">
<h3>{item.name}</h3>
<p>{item.brand}</p>
<p>{item.type}</p>
</div>
</div>
))}
</div>

</div>
);
}

export default Archive;
export default Outfits;
2 changes: 1 addition & 1 deletion front-end/src/screens/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Home(){
<div className="homeList">
<h3><Link to="/closet">View Closet</Link></h3>
<h3><Link to="/additem">Add Item</Link></h3>
<h3><Link to="/outfit-archive">Outfit Archive</Link></h3>
<h3><Link to="/Archive">Outfit Archive</Link></h3>
<h3><Link to="/generator">Generator Outfit</Link></h3>
</div>
<Footer />
Expand Down

0 comments on commit 57169f8

Please sign in to comment.