Skip to content

Commit 71c23ab

Browse files
Sarah StauberSarah Stauber
Sarah Stauber
authored and
Sarah Stauber
committed
removing aws keys and modifying photo
1 parent 3a1182e commit 71c23ab

File tree

9 files changed

+88
-6
lines changed

9 files changed

+88
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
# misc
1414
.DS_Store
15+
.env
1516
.env.local
1617
.env.development.local
1718
.env.test.local

client/src/components/AddPhotoS3/AddPhotoS3.js

+27-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
import React, { Component } from "react";
22
import {Link} from "react-router-dom";
33
import axios from 'axios';
4+
import PropTypes from 'prop-types';
5+
import { withStyles } from '@material-ui/core/styles';
6+
import Icon from '@material-ui/core/Icon';
7+
import IconButton from '@material-ui/core/IconButton';
8+
import DeleteIcon from '@material-ui/icons/Delete';
9+
import AddShoppingCartIcon from '@material-ui/icons/AddShoppingCart';
10+
import PhotoCamera from '@material-ui/icons/PhotoCamera';
11+
import CameraButton from "../PhotoButton";
12+
13+
const styles = theme => ({
14+
button: {
15+
margin: theme.spacing.unit,
16+
},
17+
input: {
18+
display: 'none',
19+
},
20+
});
421

522
class AddPhotoS3 extends Component{
623
constructor(props){
@@ -60,8 +77,16 @@ class AddPhotoS3 extends Component{
6077
<input
6178
type="file"
6279
name="selectedFile"
80+
id="file-input"
6381
onChange={this.onChange}
82+
className=""
6483
/>
84+
{/* <CameraButton
85+
type="file"
86+
name="selectedFile"
87+
id="file-input"
88+
onChange={this.onChange}/> */}
89+
<br />
6590
<br />
6691
<input
6792
type="text"
@@ -71,7 +96,8 @@ class AddPhotoS3 extends Component{
7196
onChange={this.onChange}
7297
/>
7398
<br />
74-
<button type="submit">Submit</button>
99+
<br />
100+
<button type="submit" className="btn btn-success">Submit</button>
75101
</form>
76102

77103

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React, { Component } from "react";
2+
import {Link} from "react-router-dom";
3+
import axios from 'axios';
4+
5+
import PropTypes from 'prop-types';
6+
import { withStyles } from '@material-ui/core/styles';
7+
import Icon from '@material-ui/core/Icon';
8+
import IconButton from '@material-ui/core/IconButton';
9+
import DeleteIcon from '@material-ui/icons/Delete';
10+
import AddShoppingCartIcon from '@material-ui/icons/AddShoppingCart';
11+
import PhotoCamera from '@material-ui/icons/PhotoCamera';
12+
13+
const styles = theme => ({
14+
button: {
15+
margin: theme.spacing.unit,
16+
},
17+
input: {
18+
display: 'none',
19+
},
20+
});
21+
22+
function PhotoButton(props) {
23+
const { classes } = props;
24+
return (
25+
<div>
26+
27+
<input accept="image/*" className={classes.input} id="icon-button-file" type="file" name="selectedFile" />
28+
<label htmlFor="icon-button-file">
29+
<IconButton color="primary" className={classes.button} component="span" size="large">
30+
<PhotoCamera />
31+
</IconButton>
32+
</label>
33+
</div>
34+
);
35+
}
36+
37+
PhotoButton.propTypes = {
38+
classes: PropTypes.object.isRequired,
39+
};
40+
41+
const CameraButton = withStyles(styles)(PhotoButton);
42+
43+
export default CameraButton;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from "./PhotoButton";

client/src/pages/ChooseContentType/ChooseContentType.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import TitleBar from "../../components/TitleBar";
55
import EndButton from "../../components/EndButton";
66
import AddPhotoS3 from "../../components/AddPhotoS3";
77
import AddTextorPhoto from "../../components/AddTextorPhoto";
8+
import CameraButton from "../../components/PhotoButton";
89

910
class ChooseContentType extends Component {
1011
state = {
@@ -37,14 +38,18 @@ class ChooseContentType extends Component {
3738
<div>
3839
<div className="wrapper">
3940
<TitleBar/>
40-
<AddTextorPhoto />
41+
{/* <AddTextorPhoto /> */}
4142
<br></br>
4243
<p>Story Name: {this.state.story.title}</p>
4344
<AddPhotoS3
4445
key={this.state.story.id}
4546
storyId={this.state.story.id}
4647
title={this.state.story.title}
47-
/>
48+
49+
>
50+
51+
</AddPhotoS3>
52+
4853
</div>
4954
<div>
5055
<EndButton

config/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"development": {
33
"username": "root",
4-
"password": "root",
4+
"password": "",
55
"database": "story_db",
66
"host": "127.0.0.1",
77
"dialect": "mysql"

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"aws-sdk": "^2.238.1",
2323
"axios": "^0.18.0",
2424
"cors": "^2.8.4",
25+
"dotenv": "^5.0.1",
2526
"express": "^4.15.4",
2627
"express-session": "^1.15.6",
2728
"multer": "^1.3.0",

routes/htmlRoutes.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
require('dotenv').config();
12
const express = require('express');
23
var router = express.Router();
34
var AWS = require('aws-sdk');
@@ -7,8 +8,8 @@ var db = require("../models");
78

89
//AWS
910
//aws keys
10-
var accessKeyId = process.env.AWS_ACCESS_KEY || "AKIAJSQNCM5K6YOIRMPA";
11-
var secretAccessKey = process.env.AWS_SECRET_KEY || "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";
11+
var accessKeyId = process.env.aws_access_key_id;
12+
var secretAccessKey = process.env.aws_secret_access_key;
1213
AWS.config.update({
1314
accessKeyId: accessKeyId,
1415
secretAccessKey: secretAccessKey

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,10 @@ dot-prop@^4.1.0:
641641
dependencies:
642642
is-obj "^1.0.0"
643643

644+
dotenv@^5.0.1:
645+
version "5.0.1"
646+
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-5.0.1.tgz#a5317459bd3d79ab88cff6e44057a6a3fbb1fcef"
647+
644648
dottie@^2.0.0:
645649
version "2.0.0"
646650
resolved "https://registry.yarnpkg.com/dottie/-/dottie-2.0.0.tgz#da191981c8b8d713ca0115d5898cf397c2f0ddd0"

0 commit comments

Comments
 (0)