Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/Feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default function Feed({ filters }) {
.then((res) => res.json())
.then((json) => {
json.data && setData(json.data);
console.log(json.data);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of console.log() statements for prod

setIsLoading(false);
})
.catch((e) => {
Expand Down
12 changes: 10 additions & 2 deletions app/components/accounts/Onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styles from '../../styles/Account.module.css';
import AccountContext from '../../utils/AccountContext';
import OrgSelection from './OrgSelection';
import Form from '../../components/Form';
import emailjs from 'emailjs-com';

const STAGES = Object.freeze({
DEFAULT: 'DEFAULT',
Expand All @@ -15,7 +16,13 @@ export default function Onboarding({ user }) {
const [selectedToJoin, setSelectedToJoin] = React.useState(undefined);

const { account, setAccount } = React.useContext(AccountContext);


const formatMessage = (data) => {
// Edit this method to make a new string that is more readable containing changes made to the data.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, notes about things that should get done soon should start with TODO:

// TODO: Edit this method to make a new string that is more readable containing changes made to the data.

return JSON.parse(JSON.stringify(data));
}

//START HERE
const handleSubmitOrg = async (submission) => {
const { formData } = submission;

Expand All @@ -32,11 +39,12 @@ export default function Onboarding({ user }) {
const json = await res.json();
if (json?.data?.id) {
setAccount({ ...account, orgId: json.data.id });
emailjs.send('service_2cqk6gm', 'template_6z1qve1', {'message': formatMessage(data)}, 'user_4ilUAq4zJ8J7iYZTlGs2l');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Email.js keys should be put into .env.local for now. We can load them in as environment variables in the vercel deploy to keep them hidden from the public.

} else {
console.error('Post Failed');
}
};

//END HERE
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete

let content = (
<div className={styles.actionGrid}>
<div>
Expand Down
7 changes: 7 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"@rjsf/core": "^2.5.1",
"@yaireo/tagify": "^3.23.1",
"bootstrap": "3.3.0",
"child_process": "^1.0.2",
"dotenv": "^8.2.0",
"emailjs": "^3.6.0",
"emailjs-com": "^3.2.0",
"gmail-send": "^1.8.14",
"gray-matter": "^4.0.3",
"mongodb": "^3.6.4",
"mongoose": "^5.11.19",
Expand All @@ -27,5 +31,8 @@
"react-jsonschema-form": "^1.8.1",
"react-loading-skeleton": "^2.2.0",
"react-markdown": "^6.0.1"
},
"browser": {
"child_process": false
}
}
33 changes: 33 additions & 0 deletions app/pages/account/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { withPageAuthRequired } from '@auth0/nextjs-auth0';
import Onboarding from '../../components/accounts/Onboarding';
import Layout from '../../components/Layout';

import emailjs from 'emailjs-com';


function Account() {
const [isLoading, setIsLoading] = React.useState(true);
const { user } = useUser();
Expand All @@ -25,13 +28,43 @@ function Account() {
return null;
}

const formatMessage = (data) => {
// Edit this method to make a new string that is more readable containing changes made to the data.
return JSON.parse(JSON.stringify(data));
}

const handleFormSubmit = async (submission) => {
const { formData: data } = submission;
const res = await fetch('/api/accounts/org', {
method: 'PATCH',
body: JSON.stringify({ ...data, email: account.email }),
});
const json = await res.json();
//Notify founders of change
var obj = formatMessage(data);
var name = "NAME: " + obj.name;
var description = "DESCRIPTION: " + obj.description;
var founded_date = "FOUNDED DATE: " + obj.founded;
var category = "CATEGORY: " + obj.categories;
var stage = "STAGE: " + obj.stage;
var size = "SIZE: " + obj.size;
var biography = "BIOGRAPHY: " + obj.biography;
var is_hiring = "HIRING: " + obj.isHiring;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of declaring a new variable for each of these, let's consider using a more programmatic approach. Realistically, we can simply pass obj into the emailjs.send() method:

emailjs.send('service_2cqk6gm', 'template_6z1qve1', obj, 'user_4ilUAq4zJ8J7iYZTlGs2l');

And then change the corresponding template in emailjs

A startup has updated it's info! Here is the updated version:

NAME: {{name}}
DESCRIPTION: {{description}}
...



console.log(name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, delete console.log statements

console.log(description);
console.log(founded_date);
console.log(category);
console.log(stage);
console.log(size);
console.log(biography);
console.log(is_hiring);
emailjs.send('service_2cqk6gm', 'template_6z1qve1', {'name': name, 'description': description, 'founded_date': founded_date, 'category': category, 'stage': stage, 'size': size, 'biography': biography, 'is_hiring': is_hiring}, 'user_4ilUAq4zJ8J7iYZTlGs2l');
console.log(json);
// sendEmail({
// text: data,
// });
setIsLoading(false);
};

Expand Down
36 changes: 32 additions & 4 deletions app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,9 @@ callsites@^3.0.0:
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==

caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179:
version "1.0.30001214"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001214.tgz#70f153c78223515c6d37a9fde6cd69250da9d872"
integrity sha512-O2/SCpuaU3eASWVaesQirZv1MSjUNOvmugaD8zNSJqw6Vv5SGwoOpA9LJs3pNPfM745nxqPvfZY3MQKY4AKHYg==
version "1.0.30001270"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001270.tgz"
integrity sha512-TcIC7AyNWXhcOmv2KftOl1ShFAaHQYcB/EPL/hEyMrcS7ZX0/DvV1aoy6BzV0+16wTpoAyTMGDNAJfSqS/rz7A==

chalk@2.4.2, chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
Expand Down Expand Up @@ -840,6 +840,11 @@ character-reference-invalid@^1.0.0:
resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560"
integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==

child_process@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/child_process/-/child_process-1.0.2.tgz#b1f7e7fc73d25e7fd1d455adc94e143830182b5a"
integrity sha1-sffn/HPSXn/R1FWtyU4UODAYK1o=

chokidar@3.5.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.1.tgz#ee9ce7bbebd2b79f49f304799d5468e31e14e68a"
Expand Down Expand Up @@ -1222,6 +1227,16 @@ elliptic@^6.5.3:
minimalistic-assert "^1.0.1"
minimalistic-crypto-utils "^1.0.1"

emailjs-com@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/emailjs-com/-/emailjs-com-3.2.0.tgz#a53cb22f1bc433c701c84c53d8b56eefd5ce7111"
integrity sha512-Prbz3E1usiAwGjMNYRv6EsJ5c373cX7/AGnZQwOfrpNJrygQJ15+E9OOq4pU8yC977Z5xMetRfc3WmDX6RcjAA==

emailjs@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/emailjs/-/emailjs-3.6.0.tgz#a055d8b8a611a0557488760d36e80ac53f9a56fc"
integrity sha512-dvg/AF2YR50AjNlGLWuA/9zN0FQxuZ6f3aTNm61iJOVTsMLphBwlzWXDyPAG3NK1RC+MVgGvBFk/x2F/Dvd0rQ==

emojis-list@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
Expand Down Expand Up @@ -1398,6 +1413,14 @@ glob-to-regexp@^0.4.1:
resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e"
integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==

gmail-send@^1.8.14:
version "1.8.14"
resolved "https://registry.yarnpkg.com/gmail-send/-/gmail-send-1.8.14.tgz#2d796f41f415f4f83a3d6530966b9d83a8d1bae7"
integrity sha512-hc+4Ej7ZJtw0G5sync10pmWkpPXIabkQ+p/a92lPPTXni3ChEU9sR2wxOvK6Hx+5Ou+2m9h1cVffWEgtR6Gzkw==
dependencies:
lodash "^4.17.21"
nodemailer "^6.6.5"

got@^11.8.0:
version "11.8.2"
resolved "https://registry.yarnpkg.com/got/-/got-11.8.2.tgz#7abb3959ea28c31f3576f1576c1effce23f33599"
Expand Down Expand Up @@ -1837,7 +1860,7 @@ lodash.sortby@^4.7.0:
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=

lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.4:
lodash@^4.17.13, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -2178,6 +2201,11 @@ node-releases@^1.1.69:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"
integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==

nodemailer@^6.6.5:
version "6.6.5"
resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.6.5.tgz#f9f6953cee5cfe82cbea152eeddacf7a0442049a"
integrity sha512-C/v856DBijUzHcHIgGpQoTrfsH3suKIRAGliIzCstatM2cAa+MYX3LuyCrABiO/cdJTxgBBHXxV1ztiqUwst5A==

noop-logger@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2"
Expand Down