Skip to content

Commit

Permalink
Added more actions to profile dropdown (#84)
Browse files Browse the repository at this point in the history
* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed bug that occurs when user submit google drive video link (#72)

* added functionality to format youtube video url to embedable format

* made video url optional

* switched image upload location from cloudinary to digital ocean spaces

* added functionality to automatically delete image from digitalocean space once image is deleted from db

* added image count indicator and made video optional. also added project create button to navbar

* removed .ssl from git

* untracked .ssl-data

* added support for various forms of youtube video url, vimeo and google drive

* fixed issues #35, #33, #32, #30, #29

* fixed issue #46

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed issue #68

* separated docker-compose files into dev and prod in preparation for CI/CD (#75)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* switched handling of ssl back to valian/docker-nginx-auto-ssl

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* phase 2 partial ------ 3 (#73)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed bug that occurs when user submit google drive video link (#72)

* added functionality to format youtube video url to embedable format

* made video url optional

* switched image upload location from cloudinary to digital ocean spaces

* added functionality to automatically delete image from digitalocean space once image is deleted from db

* added image count indicator and made video optional. also added project create button to navbar

* removed .ssl from git

* untracked .ssl-data

* added support for various forms of youtube video url, vimeo and google drive

* fixed issues #35, #33, #32, #30, #29

* fixed issue #46

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* fixed issue #68

* separated docker-compose files into dev and prod in preparation for CI/CD

* separated docker-compose files into dev and prod in preparation for CI/CD -- backend

* separated docker-compose files into dev and prod in preparation for CI/CD --- patch (#77)

* domain setup step 1 test 5

* domain setup step 2(backend) test 1

* domain setup step2(backend) test2

* removed .ssl-data from .dockerignore

* added custom nginx container to handle reverse proxying and https requests

* made important changes to deploy_frontend.sh, added google tracking code to index.html, enabled crawling

* switched handling of ssl back to valian/docker-nginx-auto-ssl

* separated docker-compose files into dev and prod in preparation for CI/CD

* separated docker-compose files into dev and prod in preparation for CI/CD -- backend

* separated docker-compose files into dev and prod in preparation for CI/CD --- patch

* made deploy_frontend.sh more explanatory

* Code Refactor (#67)

* phase2 patial ----- 2 (#66)

* added description to the video url field in project creation form issue #50 (#61)

* new deployment changes (#62)

* increased pagination limit from 6 to 20 (#63)

* phase2 patial ----- 2 (#65)

switched handling of ssl back to valian/docker-nginx-auto-ssl

* Issue #54: switched from class based views to function based views, moved styles to seprate files and changed the general structure of the project to be more intuitive

* more refactoring

* more refactor -- added new prettier rules and prettified more files not being covered by prettier initially

* Customized form submission error (#80)

* fixed issue #25 --- initial

* prettified

* fixed issue #34: Increased upload image size, added image compression and functionality to remove image metadata (#79)

* Removed line behind dob field label on the signup page (#81)

* fixed issue #26: removed line behind DOB input label

* fixed issue #26: removed line behind DOB field text in signup --- patch

* fixed issue #52: Added help text to project creation desc field (#82)

* fixed issue #59: Added projects, followers and following links to profile dropdown menu
  • Loading branch information
NdibeRaymond authored Jan 22, 2021
1 parent e27329f commit 271408a
Show file tree
Hide file tree
Showing 18 changed files with 452 additions and 140 deletions.
6 changes: 6 additions & 0 deletions zubhub_frontend/zubhub/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ services:
container_name: zubhub_frontend
build:
context: .
<<<<<<< HEAD
dockerfile: Dockerfile
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
=======
dockerfile: Dockerfile.prod
volumes:
- ./nginx/prod/default.conf:/etc/nginx/conf.d/default.conf
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
restart: on-failure
ports:
- "80"
Expand Down
4 changes: 4 additions & 0 deletions zubhub_frontend/zubhub/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ services:
- ./nginx/dev/default.conf:/etc/nginx/conf.d/default.conf
restart: on-failure
ports:
<<<<<<< HEAD
- "80:80"
=======
- "3000:3000"
>>>>>>> e27329f26fe2cff77464c3965a2859d1d6c0b01f
27 changes: 27 additions & 0 deletions zubhub_frontend/zubhub/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion zubhub_frontend/zubhub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@testing-library/user-event": "^12.2.2",
"aws-sdk": "^2.813.0",
"classnames": "^2.2.6",
"compressorjs": "^1.0.7",
"date-fns": "^2.16.1",
"formik": "^2.2.5",
"nanoid": "^3.1.20",
Expand All @@ -27,6 +28,7 @@
"redux-thunk": "^2.3.0",
"slick-carousel": "^1.8.1",
"web-vitals": "^0.2.4",
"workerize-loader": "^1.3.0",
"yup": "^0.29.3"
},
"scripts": {
Expand Down Expand Up @@ -55,6 +57,6 @@
]
},
"devDependencies": {
"prettier": "2.2.1"
"prettier": "^2.2.1"
}
}
39 changes: 39 additions & 0 deletions zubhub_frontend/zubhub/src/assets/js/Compress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Compressor from 'compressorjs';

const Compress = (images, state, handleSetState) => {
let compressed = [];

for (let index = 0; index < images.length; index += 1) {
let image = images[index];

if (image && image.type.split('/')[1] !== 'gif') {
new Compressor(image, {
quality: 0.6,
convertSize: 100000,
success: result => {
compressed.push(result);
shouldSetImages(compressed, images, state, handleSetState);
},
error: error => {
console.warn(error.message);
compressed.push(image);
shouldSetImages(compressed, images, state, handleSetState);
},
});
} else {
compressed.push(image);
shouldSetImages(compressed, images, state, handleSetState);
}
}
};

const shouldSetImages = (compressed, images, state, handleSetState) => {
if (compressed.length === images.length) {
const { image_upload } = state;
image_upload.images_to_upload = compressed;

handleSetState(image_upload);
}
};

export default Compress;
62 changes: 62 additions & 0 deletions zubhub_frontend/zubhub/src/assets/js/removeMetaDataWorker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export const removeMetaData = imageArr => {
let newImageArr = [];

for (let index = 0; index < imageArr.length; index++) {
let fr = new FileReader();
fr.onload = process;
fr.mainFile = imageArr[index];
fr.readAsArrayBuffer(imageArr[index]);
}

function process() {
let dv = new DataView(this.result);
let offset = 0,
recess = 0;
let pieces = [];
let i = 0;
if (dv.getUint16(offset) === 0xffd8) {
offset += 2;
let app1 = dv.getUint16(offset);
offset += 2;
while (offset < dv.byteLength) {
if (app1 === 0xffe1) {
pieces[i] = { recess: recess, offset: offset - 2 };
recess = offset + dv.getUint16(offset);
i++;
} else if (app1 === 0xffda) {
break;
}
offset += dv.getUint16(offset);
app1 = dv.getUint16(offset);
offset += 2;
}

if (pieces.length > 0) {
let newPieces = [];
pieces.forEach(function (v) {
newPieces.push(this.result.slice(v.recess, v.offset));
}, this);
newPieces.push(this.result.slice(recess));
newImageArr.push(
new Blob(newPieces, { type: imageArr[newImageArr.length].type }),
);

if (newImageArr.length === imageArr.length) {
postMessage(newImageArr);
}
} else {
newImageArr.push(this.mainFile);

if (newImageArr.length === imageArr.length) {
postMessage(newImageArr);
}
}
} else {
newImageArr.push(this.mainFile);

if (newImageArr.length === imageArr.length) {
postMessage(newImageArr);
}
}
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ const styles = theme => ({
},
},
},
DOBInputStyle: {
'&.MuiOutlinedInput-root fieldset legend': {
width: '75.5px !important',
},
},
secondaryLink: {
color: '#00B8C4',
'&:hover': {
Expand Down
91 changes: 22 additions & 69 deletions zubhub_frontend/zubhub/src/store/actions/authActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,14 @@ export const login = props => {
return API.login(props.values)
.then(res => {
if (!res.key) {
res = Object.keys(res)
.map(key => res[key])
.join('\n');
throw new Error(res);
throw new Error(JSON.stringify(res));
}
dispatch({
type: 'SET_AUTH_USER',
payload: { token: res.key },
});
})
.then(() => props.history.push('/profile'))
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
.then(() => props.history.push('/profile'));
};
};

Expand Down Expand Up @@ -85,95 +72,61 @@ export const signup = props => {
return API.signup(props.values)
.then(res => {
if (!res.key) {
res = Object.keys(res)
.map(key => res[key])
.join('\n');
throw new Error(res);
throw new Error(JSON.stringify(res));
}
dispatch({
type: 'SET_AUTH_USER',
payload: { token: res.key },
});
})
.then(() => props.history.push('/profile'))
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
.then(() => props.history.push('/profile'));
};
};

export const send_email_confirmation = (props, key) => {
return () => {
return API.send_email_confirmation(key)
.then(res => {
return API.send_email_confirmation(key).then(res => {
if (res.detail !== 'ok') {
throw new Error(res.detail);
} else {
toast.success('Congratulations!, your email has been confirmed!');
setTimeout(() => {
props.history.push('/');
}, 4000);
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
}
});
};
};

export const send_password_reset_link = props => {
return () => {
return API.send_password_reset_link(props.values.email)
.then(res => {
return API.send_password_reset_link(props.values.email).then(res => {
if (res.detail !== 'Password reset e-mail has been sent.') {
throw new Error(JSON.stringify(res));
} else {
toast.success('We just sent a password reset link to your email!');
setTimeout(() => {
props.history.push('/');
}, 4000);
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
}
});
};
};

export const password_reset_confirm = props => {
return () => {
return API.password_reset_confirm(props)
.then(res => {
return API.password_reset_confirm(props).then(res => {
if (res.detail !== 'Password has been reset with the new password.') {
throw new Error(JSON.stringify(res));
} else {
toast.success(
'Congratulations! your password reset was successful! you will now be redirected to login',
);
setTimeout(() => {
props.history.push('/login');
}, 4000);
})
.catch(error => {
if (error.message.startsWith('Unexpected')) {
return {
error:
'An error occured while performing this action. Please try again later',
};
} else {
return { error: error.message };
}
});
}
});
};
};

Expand Down
Loading

0 comments on commit 271408a

Please sign in to comment.