diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8394c071..ccdcd678 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Our Responsibilities diff --git a/api/admin.js b/api/admin.js index 28a84754..af6d7862 100644 --- a/api/admin.js +++ b/api/admin.js @@ -16,8 +16,8 @@ router.use(utils.requireAdmin); router.put("/:email", async (req, res) => { const updatedhackerProfile = await models.HackerProfile.update(req.body, { where: { - email: req.params.email - } + email: req.params.email, + }, }); return res.json({ hackerProfile: newHackerProfile }); }); @@ -33,25 +33,25 @@ router.get("/profiles", async (req, res) => { [Op.or]: [ { email: { - [Op.like]: flexQuery - } + [Op.like]: flexQuery, + }, }, { firstName: { - [Op.like]: flexQuery - } + [Op.like]: flexQuery, + }, }, { lastName: { - [Op.like]: flexQuery - } - } - ] + [Op.like]: flexQuery, + }, + }, + ], }, - limit: 50 + limit: 50, }); return res.json({ - profiles + profiles, }); } catch (e) { return res.status(500).json({ error: e.message }); @@ -63,12 +63,12 @@ router.post("/updateRole", async (req, res) => { const { email, role } = req.body; const result = await models.HackerProfile.update( { - role: role + role: role, }, { where: { - email: email - } + email: email, + }, } ); @@ -91,8 +91,8 @@ router.get("/reviewHistory", async (req, res) => { try { const reviews = await models.HackerReview.findAll({ where: { - createdBy: req.user.id - } + createdBy: req.user.id, + }, }); return res.json({ reviews: reviews }); } catch (e) { @@ -106,14 +106,14 @@ router.put("/review/:id", async (req, res) => { "scoreOne", "scoreTwo", "scoreThree", - "comments" + "comments", ]); const formInput = req.body; for (let key of Object.keys(formInput)) { if (!allowedFields.has(key)) { return res.status(400).json({ - error: `${key} is not a supported field` + error: `${key} is not a supported field`, }); } } @@ -121,14 +121,14 @@ router.put("/review/:id", async (req, res) => { try { const result = await models.HackerReview.update(req.body, { where: { - id: requestId - } + id: requestId, + }, }); return res.json({ update: result }); } catch (e) { return res.status(500).json({ - error: e + error: e, }); } }); @@ -138,23 +138,23 @@ router.get("/eligibleProfiles", async (req, res) => { const allProfiles = await models.HackerProfile.findAll({ where: { submittedAt: { - [sequelize.Op.not]: null - } + [sequelize.Op.not]: null, + }, }, include: [ { - model: models.HackerReview - } - ] + model: models.HackerReview, + }, + ], }); - filteredProfiles = allProfiles.filter(profile => { - const reviewsByCurrUser = profile.HackerReviews.filter(review => { + filteredProfiles = allProfiles.filter((profile) => { + const reviewsByCurrUser = profile.HackerReviews.filter((review) => { return review.dataValues.createdBy === req.user.id; }); return reviewsByCurrUser.length === 0 && profile.HackerReviews.length < 1; }); return res.json({ - eligibleReviews: filteredProfiles + eligibleReviews: filteredProfiles, }); } catch (e) { return res.status(500).json({ error: e.message }); @@ -170,7 +170,7 @@ router.post("/review", async (req, res) => { scoreOne: formBody.scoreOne, scoreTwo: formBody.scoreTwo, scoreThree: formBody.scoreThree, - comments: formBody.comments + comments: formBody.comments, }); return res.json({ newReview: newReview }); @@ -186,31 +186,31 @@ router.get("/review", async (req, res) => { include: [ [ sequelize.fn("COUNT", sequelize.col("HackerReviews.id")), - "reviewCount" - ] - ] + "reviewCount", + ], + ], }, include: [ { model: models.HackerReview, - attributes: [] - } + attributes: [], + }, ], - group: ["HackerProfile.userId"] + group: ["HackerProfile.userId"], }); - const acceptableProfile = profilesWCount.find(profile => { + const acceptableProfile = profilesWCount.find((profile) => { return profile.dataValues.reviewCount < 1; }); if (acceptableProfile) { const newReview = await models.HackerReview.create({ hackerId: acceptableProfile.dataValues.userId, - createdBy: req.user.id + createdBy: req.user.id, }); return res.json({ review: newReview, - profile: acceptableProfile + profile: acceptableProfile, }); } else { return res.json({ review: null, profile: null }); // Returns empty when there are no more profiles diff --git a/api/apis.js b/api/apis.js index c4816405..733a19c2 100644 --- a/api/apis.js +++ b/api/apis.js @@ -10,9 +10,9 @@ router.get("/", async (req, res) => { include: [ { model: models.ApiLinks, - as: "links" - } - ] + as: "links", + }, + ], }); return res.json({ success: apis }); @@ -22,14 +22,14 @@ router.get("/event", async (req, res) => { let id = parseInt(Object.keys(req.query)[0].split(",")[1]); const apis = await models.Apis.findAll({ where: { - major_event: id + major_event: id, }, include: [ { model: models.ApiLinks, - as: "links" - } - ] + as: "links", + }, + ], }); return res.json({ success: apis }); diff --git a/api/database/migrations/20200127000435-modify-role-superadmin-volunteer.js b/api/database/migrations/20200127000435-modify-role-superadmin-volunteer.js index f7b35e27..37e21b2e 100644 --- a/api/database/migrations/20200127000435-modify-role-superadmin-volunteer.js +++ b/api/database/migrations/20200127000435-modify-role-superadmin-volunteer.js @@ -5,7 +5,7 @@ module.exports = { return queryInterface.changeColumn("HackerProfiles", "role", { type: Sequelize.ENUM, values: ["hacker", "admin", "sponsor", "volunteer"], - defaultValue: "hacker" + defaultValue: "hacker", }); }, @@ -13,7 +13,7 @@ module.exports = { return queryInterface.changeColumn("HackerProfiles", "role", { type: Sequelize.ENUM, values: ["hacker", "admin", "sponsor", "superadmin"], - defaultValue: "hacker" + defaultValue: "hacker", }); - } + }, }; diff --git a/api/database/migrations/20201012041027-api-directory.js b/api/database/migrations/20201012041027-api-directory.js index c872194c..47122da5 100644 --- a/api/database/migrations/20201012041027-api-directory.js +++ b/api/database/migrations/20201012041027-api-directory.js @@ -7,23 +7,23 @@ module.exports = { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true, - allowNull: false + allowNull: false, }, name: { type: Sequelize.STRING, - allowNull: false + allowNull: false, }, link: { type: Sequelize.STRING, - allowNull: false + allowNull: false, }, api_id: { type: Sequelize.INTEGER, - allowNull: false - } + allowNull: false, + }, }); }, down: (queryInterface, Sequelize) => { return queryInterface.dropTable("ApiLinks"); - } + }, }; diff --git a/api/database/migrations/20201012041350-apis.js b/api/database/migrations/20201012041350-apis.js index cc341a39..5bebc1b6 100644 --- a/api/database/migrations/20201012041350-apis.js +++ b/api/database/migrations/20201012041350-apis.js @@ -7,23 +7,23 @@ module.exports = { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true, - allowNull: false + allowNull: false, }, name: { type: Sequelize.STRING, - allowNull: false + allowNull: false, }, description: { type: Sequelize.BLOB, - allowNull: false + allowNull: false, }, major_event: { type: Sequelize.BOOLEAN, - allowNull: false - } + allowNull: false, + }, }); }, down: (queryInterface, Sequelize) => { return queryInterface.dropTable("Apis"); - } + }, }; diff --git a/api/database/migrations/20201012041524-major_events.js b/api/database/migrations/20201012041524-major_events.js index c862a023..cc4ee377 100644 --- a/api/database/migrations/20201012041524-major_events.js +++ b/api/database/migrations/20201012041524-major_events.js @@ -7,27 +7,27 @@ module.exports = { type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true, - allowNull: false + allowNull: false, }, name: { type: Sequelize.STRING, - allowNull: false + allowNull: false, }, isHackathon: { type: Sequelize.BOOLEAN, - allowNull: false + allowNull: false, }, start_date: { type: Sequelize.DATE, - allowNull: false + allowNull: false, }, end_date: { type: Sequelize.DATE, - allowNull: false - } + allowNull: false, + }, }); }, down: (queryInterface, Sequelize) => { return queryInterface.dropTable("MajorEvents"); - } + }, }; diff --git a/api/database/migrations/20201012051044-change_api_description.js b/api/database/migrations/20201012051044-change_api_description.js index 42817d9a..0df92d59 100644 --- a/api/database/migrations/20201012051044-change_api_description.js +++ b/api/database/migrations/20201012051044-change_api_description.js @@ -4,16 +4,16 @@ module.exports = { up: (queryInterface, Sequelize) => { return Promise.all([ queryInterface.changeColumn("Apis", "description", { - type: Sequelize.STRING - }) + type: Sequelize.STRING, + }), ]); }, down: (queryInterface, Sequelize) => { return Promise.all([ queryInterface.changeColumn("Apis", "description", { - type: Sequelize.BLOB - }) + type: Sequelize.BLOB, + }), ]); - } + }, }; diff --git a/api/models/apiLinks.js b/api/models/apiLinks.js index 66ba3a68..3464e961 100644 --- a/api/models/apiLinks.js +++ b/api/models/apiLinks.js @@ -9,18 +9,18 @@ module.exports = (sequelize, DataTypes) => { id: { type: DataTypes.INTEGER, primaryKey: true, - allowNull: false + allowNull: false, }, name: DataTypes.STRING, link: DataTypes.STRING, - api_id: DataTypes.INTEGER + api_id: DataTypes.INTEGER, }, { - timestamps: false + timestamps: false, } ); - ApiLinks.associate = function(models) { + ApiLinks.associate = function (models) { ApiLinks.belongsTo(models.Apis, { foreignKey: "api_id" }); }; diff --git a/api/models/apis.js b/api/models/apis.js index 371a86c7..e5ed4c60 100644 --- a/api/models/apis.js +++ b/api/models/apis.js @@ -10,18 +10,18 @@ module.exports = (sequelize, DataTypes) => { id: { type: DataTypes.INTEGER, primaryKey: true, - allowNull: false + allowNull: false, }, name: DataTypes.STRING, description: DataTypes.STRING, - major_event: DataTypes.INTEGER + major_event: DataTypes.INTEGER, }, { - timestamps: false + timestamps: false, } ); - Apis.associate = function(models) { + Apis.associate = function (models) { Apis.hasMany(models.ApiLinks, { as: "links", foreignKey: "api_id" }); }; diff --git a/api/models/majorEvents.js b/api/models/majorEvents.js index 1d8ba59b..25640b54 100644 --- a/api/models/majorEvents.js +++ b/api/models/majorEvents.js @@ -8,15 +8,15 @@ module.exports = (sequelize, DataTypes) => { id: { type: DataTypes.INTEGER, primaryKey: true, - allowNull: false + allowNull: false, }, name: DataTypes.STRING, isHackathon: DataTypes.BOOLEAN, start_date: DataTypes.DATE, - end_date: DataTypes.DATE + end_date: DataTypes.DATE, }, { - timestamps: false + timestamps: false, } ); diff --git a/api/models/signups.js b/api/models/signups.js index 35d22b50..0567b5eb 100644 --- a/api/models/signups.js +++ b/api/models/signups.js @@ -8,24 +8,24 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, - allowNull: false + allowNull: false, }, email: { type: DataTypes.STRING, - allowNull: false + allowNull: false, }, ip: { type: DataTypes.STRING, - allowNull: false + allowNull: false, }, created_at: { type: DataTypes.DATE, - allowNull: false - } + allowNull: false, + }, }, { timestamps: false } ); - signups.prototype.getSignUps = function() { + signups.prototype.getSignUps = function () { return sequelize.models.signups.findAll({}); }; return signups; diff --git a/api/points.js b/api/points.js index c1cb3a5d..b9ebd1e4 100644 --- a/api/points.js +++ b/api/points.js @@ -29,13 +29,13 @@ router.post("/tasks", async (req, res) => { "isGroupTask", "isActive", "type", - "isPast" + "isPast", ]); const formInput = req.body; for (let key of Object.keys(formInput)) { if (!allowedFields.has(key)) { return res.status(400).json({ - error: `${key} is not a supported field` + error: `${key} is not a supported field`, }); } } @@ -67,8 +67,8 @@ router.delete("/tasks/:id", async (req, res) => { const id = req.params.id; await models.Task.destroy({ where: { - id: id - } + id: id, + }, }); return res.status(200); } catch (e) { diff --git a/api/projectTeam.js b/api/projectTeam.js index 32de8a29..33bd3596 100644 --- a/api/projectTeam.js +++ b/api/projectTeam.js @@ -6,11 +6,11 @@ const router = express.Router(); router.use(utils.authMiddleware); router.use(utils.preprocessRequest); -const getProjectTeamForSelf = async req => { +const getProjectTeamForSelf = async (req) => { const { id } = req.user; const person = await models.Person.findByPk(id, { - include: [{ model: models.ProjectTeam, required: false }] + include: [{ model: models.ProjectTeam, required: false }], }); if (person) { return person.ProjectTeam; @@ -18,11 +18,11 @@ const getProjectTeamForSelf = async req => { return person; }; -const getPersonForQRID = async qrCodeId => { +const getPersonForQRID = async (qrCodeId) => { const hackerProfile = await models.HackerProfile.findOne({ where: { - qrCodeId: qrCodeId - } + qrCodeId: qrCodeId, + }, }); const userId = hackerProfile.get("userId"); const person = await models.Person.findByPk(userId); @@ -37,12 +37,12 @@ router.get("/self", async (req, res) => { router.put("/join/:name", async (req, res) => { const { name } = req.params; let projectTeam = await models.ProjectTeam.findOne({ - where: { name } + where: { name }, }); if (!projectTeam) { return res.status(400).json({ - error: `Team: ${name} not found` + error: `Team: ${name} not found`, }); } @@ -53,7 +53,7 @@ router.put("/join/:name", async (req, res) => { await projectTeam.addMember(req.user.id); projectTeam = await models.ProjectTeam.findOne({ - where: { name } + where: { name }, }); return res.json({ success: projectTeam }); @@ -80,9 +80,9 @@ router.post("/self", async (req, res) => { return res.status(400).json({ error: "Already has a team" }); } - const result = await models.sequelize.transaction(async t => { + const result = await models.sequelize.transaction(async (t) => { const projectTeam = await models.ProjectTeam.create(body, { - transaction: t + transaction: t, }); await person.setProjectTeam(projectTeam, { transaction: t }); @@ -134,7 +134,7 @@ router.delete("/self/deletePrize/:prizeID", async (req, res) => { await projectTeam.removePrize(prizeID); await projectTeam.save(); projectTeam = await models.ProjectTeam.findOne({ - where: { name } + where: { name }, }); return res.json({ success: projectTeam }); }); diff --git a/api/tasks.js b/api/tasks.js index 5139c37c..c0fdb067 100644 --- a/api/tasks.js +++ b/api/tasks.js @@ -15,31 +15,31 @@ router.get("/list", utils.requireNonHacker, async (req, res) => { if (req.user.role && req.user.role === "admin") { filter.push({ - type: "admin" + type: "admin", }); filter.push({ - type: "volunteer" + type: "volunteer", }); filter.push({ - type: "sponsor" + type: "sponsor", }); } else if (req.user.role && req.user.role === "volunteer") { filter.push({ - type: "volunteer" + type: "volunteer", }); filter.push({ - type: "sponsor" + type: "sponsor", }); } else if (req.user.role && req.user.role === "sponsor") { filter.push({ - type: "sponsor" + type: "sponsor", }); } const tasks = await models.Task.findAll({ where: { - [Op.or]: filter - } + [Op.or]: filter, + }, }); return res.json({ success: tasks }); @@ -52,14 +52,14 @@ router.post("/create", utils.requireAdmin, async (req, res) => { "points", "name", "isGroupTask", - "isActive" + "isActive", ]); const formInput = req.body; for (let key of Object.keys(formInput)) { if (!allowedFields.has(key)) { return res.status(400).json({ - error: `${key} is not a supported field` + error: `${key} is not a supported field`, }); } } @@ -79,8 +79,8 @@ router.delete("/:id", utils.requireAdmin, async (req, res) => { const id = req.params.id; await models.Task.destroy({ where: { - id: id - } + id: id, + }, }); return res.json({ success: null }); }); diff --git a/api/team.js b/api/team.js index 8a2b55df..e75dcef6 100644 --- a/api/team.js +++ b/api/team.js @@ -10,23 +10,23 @@ router.use(utils.preprocessRequest); // - If a hacker is on a team, get that team info router.get("/", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); const team = await hackerProfile.getTeam({ include: [ { model: models.HackerProfile, - attributes: ["firstName", "lastName", "status", "email", "userId"] - } - ] + attributes: ["firstName", "lastName", "status", "email", "userId"], + }, + ], }); if (team) { return res.json({ team }); } else { return res.json({ - message: "User does not currently belong to a team" + message: "User does not currently belong to a team", }); } }); @@ -36,7 +36,7 @@ router.get("/", async (req, res) => { router.get("/:code", async (req, res) => { // Try to find a team with the provided code const team = await models.Team.findOne({ - where: { teamCode: req.params.code || "" } + where: { teamCode: req.params.code || "" }, }); if (!team) { return res @@ -51,7 +51,7 @@ router.get("/:code", async (req, res) => { // - If a hacker is not on a team, create a team router.post("/", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); let team = await hackerProfile.getTeam(); @@ -59,35 +59,29 @@ router.post("/", async (req, res) => { return res.status(500).json({ message: "User already belongs on a team" }); } - let generatedCode = Math.random() - .toString(36) - .slice(4, 8) - .toUpperCase(); + let generatedCode = Math.random().toString(36).slice(4, 8).toUpperCase(); while ( await models.Team.findOne({ - where: { teamCode: generatedCode } + where: { teamCode: generatedCode }, }) ) { // Regenerate code - generatedCode = Math.random() - .toString(36) - .slice(4, 8) - .toUpperCase(); + generatedCode = Math.random().toString(36).slice(4, 8).toUpperCase(); } team = await models.Team.create({ name: req.body.name, teamCode: generatedCode, - ownerId: req.user.id + ownerId: req.user.id, }); await hackerProfile.update({ - teamId: team.id + teamId: team.id, }); return res.json({ - team + team, }); }); @@ -95,7 +89,7 @@ router.post("/", async (req, res) => { // - Attempts to delete a user's current team router.delete("/", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); // Can't join a team if you're already on one! @@ -123,7 +117,7 @@ router.delete("/", async (req, res) => { // - If a hacker is not on a team, attempt to join a team router.post("/join/:code", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); // Can't join a team if you're already on one! @@ -134,7 +128,7 @@ router.post("/join/:code", async (req, res) => { // Try to find a team with the provided code team = await models.Team.findOne({ - where: { teamCode: req.params.code || "" } + where: { teamCode: req.params.code || "" }, }); if (!team) { return res @@ -153,7 +147,7 @@ router.post("/join/:code", async (req, res) => { await hackerProfile.setTeam(team); return res.status(200).json({ - message: "Successfully joined team" + message: "Successfully joined team", }); }); @@ -161,7 +155,7 @@ router.post("/join/:code", async (req, res) => { // - If a hacker is not on a team, attempt to join a team router.post("/kick/:userid", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); // Can't kick someone else from a team if you are not on a team! @@ -172,14 +166,14 @@ router.post("/kick/:userid", async (req, res) => { if (team.ownerId === req.params.userid) { return res.status(400).json({ - message: `Not allowed to kick yourself. Delete the team instead.` + message: `Not allowed to kick yourself. Delete the team instead.`, }); } if (team.ownerId === req.user.id) { // Allow kicking const kickProfile = await models.HackerProfile.findOne({ - where: { userId: req.params.userid } + where: { userId: req.params.userid }, }); let kicked_team = await hackerProfile.getTeam(); @@ -194,7 +188,7 @@ router.post("/kick/:userid", async (req, res) => { } return res.status(400).json({ - message: `Could not kick member with userid ${req.params.userid}.` + message: `Could not kick member with userid ${req.params.userid}.`, }); }); @@ -202,7 +196,7 @@ router.post("/kick/:userid", async (req, res) => { // - If a hacker is not on a team, attempt to join a team router.post("/kick/:userid", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); // Can't kick someone else from a team if you are not on a team! @@ -213,14 +207,14 @@ router.post("/kick/:userid", async (req, res) => { if (team.ownerId === req.params.userid) { return res.status(400).json({ - message: `Not allowed to kick yourself. Delete the team instead.` + message: `Not allowed to kick yourself. Delete the team instead.`, }); } if (team.ownerId === req.user.id) { // Allow kicking const kickProfile = await models.HackerProfile.findOne({ - where: { userId: req.params.userid } + where: { userId: req.params.userid }, }); let kicked_team = await hackerProfile.getTeam(); @@ -235,7 +229,7 @@ router.post("/kick/:userid", async (req, res) => { } return res.status(400).json({ - message: `Could not kick member with userid ${req.params.userid}.` + message: `Could not kick member with userid ${req.params.userid}.`, }); }); @@ -243,7 +237,7 @@ router.post("/kick/:userid", async (req, res) => { // - If a hacker is on a team, attempt to leave that team router.post("/leave", async (req, res) => { const hackerProfile = await models.HackerProfile.findOne({ - where: { userId: req.user.id } + where: { userId: req.user.id }, }); // Can't leave a team if you're not in one! @@ -263,11 +257,11 @@ router.post("/leave", async (req, res) => { // If we're still here, we can leave the team :) await hackerProfile.update({ - teamId: null + teamId: null, }); return res.status(200).json({ - message: "Successfully left team" + message: "Successfully left team", }); }); diff --git a/components/AdminStats.tsx b/components/AdminStats.tsx index f115cf0b..d1c2f30d 100644 --- a/components/AdminStats.tsx +++ b/components/AdminStats.tsx @@ -281,9 +281,9 @@ const AdminStats = ({ profile, showtitle = true }) => { - Genders + Preferred Pronouns - Male:{" "} + He/Him/His:{" "} {profiles && profiles.length > 0 ? profiles.reduce((a, b) => a + (b.gender == "male" ? 1 : 0), 0) @@ -291,7 +291,7 @@ const AdminStats = ({ profile, showtitle = true }) => { - Female:{" "} + She/Her/Hers:{" "} {profiles && profiles.length > 0 ? profiles.reduce( @@ -302,7 +302,7 @@ const AdminStats = ({ profile, showtitle = true }) => { - Non-Binary:{" "} + They/Them/Theirs:{" "} {profiles && profiles.length > 0 ? profiles.reduce( diff --git a/components/BattlePass.tsx b/components/BattlePass.tsx index 808447ec..467839b4 100644 --- a/components/BattlePass.tsx +++ b/components/BattlePass.tsx @@ -28,7 +28,7 @@ const bpItem: React.SFC = ({ userPoints = 0, itemTier = 0, minimum, - projSubmitted + projSubmitted, }) => { let locked = !unlocked; let showOverlay = false; @@ -62,13 +62,19 @@ const bpItem: React.SFC = ({ const useBattlepassItems = (bp: Battlepass, userPoints: number) => { return useMemo(() => { - const premiumItems = bp && bp.length > 0 ? bp.filter(item => { - return item.isPremium; - }) : []; - - const basicItems = bp && bp.length > 0 ? bp.filter(item => { - return !item.isPremium; - }): []; + const premiumItems = + bp && bp.length > 0 + ? bp.filter((item) => { + return item.isPremium; + }) + : []; + + const basicItems = + bp && bp.length > 0 + ? bp.filter((item) => { + return !item.isPremium; + }) + : []; if (premiumItems && premiumItems.length > 0) { premiumItems.reduce( @@ -120,14 +126,14 @@ const useBattlepassItems = (bp: Battlepass, userPoints: number) => { basicItems, premiumItems, currentTier, - pointsTillNextTier + pointsTillNextTier, }; }, [bp, userPoints]); }; const BattlePass = ({ bp, userPoints, - projSubmitted + projSubmitted, }: { bp: Battlepass; userPoints: number; @@ -137,7 +143,7 @@ const BattlePass = ({ basicItems, premiumItems, currentTier, - pointsTillNextTier + pointsTillNextTier, } = useBattlepassItems(bp, userPoints || 0); const bptable = ( @@ -154,7 +160,7 @@ const BattlePass = ({ premium: false, projSubmitted, ...item, - currentTier: index === currentTier + currentTier: index === currentTier, }) : ""; }) @@ -173,7 +179,7 @@ const BattlePass = ({ premium: true, projSubmitted, ...item, - currentTier: index === currentTier + currentTier: index === currentTier, }) : ""; }) diff --git a/components/Head.tsx b/components/Head.tsx index 68ec20ce..7c878d86 100644 --- a/components/Head.tsx +++ b/components/Head.tsx @@ -32,7 +32,7 @@ const Head = ({ title }: HeadProps) => { s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '2475646642710223'); - fbq('track', 'PageView');` + fbq('track', 'PageView');`, }} /> @@ -43,7 +43,7 @@ const Head = ({ title }: HeadProps) => { function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-127488741-2'); - ` + `, }} /> diff --git a/components/results/Accepted.tsx b/components/results/Accepted.tsx index 3610e70f..e49b003d 100644 --- a/components/results/Accepted.tsx +++ b/components/results/Accepted.tsx @@ -9,7 +9,7 @@ import { Form, FormGroup, RadioChoice, - RadioChoiceLabel + RadioChoiceLabel, } from "../../styles"; import Select from "../Select"; @@ -26,7 +26,7 @@ const travelOptions = [ { label: "HackSC Bus", value: "bus" }, { label: "Flying", value: "flying" }, { label: "USC Student (N/A)", value: "usc" }, - { label: "Other", value: "other" } + { label: "Other", value: "other" }, ]; const shirtSizeOptions = [ @@ -34,10 +34,10 @@ const shirtSizeOptions = [ { label: "Small", value: "s" }, { label: "Medium", value: "m" }, { label: "Large", value: "l" }, - { label: "X-Large", value: "xl" } + { label: "X-Large", value: "xl" }, ]; -const Accepted: React.FunctionComponent = props => { +const Accepted: React.FunctionComponent = (props) => { const [travelMethod, setTravelMethod] = useState(null); const [travelFile, setTravelFile] = useState(null); @@ -57,13 +57,13 @@ const Accepted: React.FunctionComponent = props => { nutAllergy: useRef(null), lactoseIntolerant: useRef(null), glutenFree: useRef(null), - other: useRef(null) + other: useRef(null), }, codeOfConduct: useRef(null), - noBusCheck: useRef(null) + noBusCheck: useRef(null), }; - const checkFile = e => { + const checkFile = (e) => { const { travelPlan } = formRefs; if (travelPlan.current && !travelPlan.current.files[0]) { @@ -77,7 +77,7 @@ const Accepted: React.FunctionComponent = props => { setError(null); }; - const handleSubmit = async e => { + const handleSubmit = async (e) => { e.preventDefault(); if (submitting) { @@ -91,7 +91,7 @@ const Accepted: React.FunctionComponent = props => { shirtSize, dietaryRestrictions, codeOfConduct, - noBusCheck + noBusCheck, } = formRefs; const reqBody = { @@ -124,16 +124,16 @@ const Accepted: React.FunctionComponent = props => { dietaryRestrictions.glutenFree.current.checked, other: dietaryRestrictions.other.current && - dietaryRestrictions.other.current.value + dietaryRestrictions.other.current.value, }, - noBusCheck: noBusCheck.current && noBusCheck.current.checked + noBusCheck: noBusCheck.current && noBusCheck.current.checked, }; const formData = jsonToFormData(reqBody); setSubmitting(true); const response = await fetch("/api/profile/confirm", { method: "POST", - body: formData + body: formData, }); setSubmitting(false); @@ -149,7 +149,7 @@ const Accepted: React.FunctionComponent = props => { const handleDecline = async () => { await fetch("/api/profile/decline", { - method: "POST" + method: "POST", }); await Router.push("/dashboard"); diff --git a/components/steps/Profile.tsx b/components/steps/Profile.tsx index 94c47670..7ba8dfd4 100644 --- a/components/steps/Profile.tsx +++ b/components/steps/Profile.tsx @@ -8,7 +8,7 @@ import { RadioChoiceLabel, Flex, Column, - Button + Button, } from "../../styles"; import Select from "../Select"; @@ -31,7 +31,7 @@ const yearOptions = [ { label: "Sophomore", value: "sophomore" }, { label: "Junior", value: "junior" }, { label: "Senior", value: "senior" }, - { label: "Graduate", value: "graduate" } + { label: "Graduate", value: "graduate" }, ]; const gradDateOptions = [ @@ -43,40 +43,40 @@ const gradDateOptions = [ { label: "Fall 2022", value: "fall-2022" }, { label: "Spring 2023", value: "spring-2023" }, { label: "Fall 2023", value: "fall-2023" }, - { label: "Other", value: "other" } + { label: "Other", value: "other" }, ]; /** TODO: Add Not Listed / custom input option */ const genderOptions = [ - { label: "Male", value: "male" }, - { label: "Female", value: "female" }, - { label: "Non-Binary", value: "non-binary" }, + { label: "He/Him/His", value: "male" }, + { label: "She/Her/Hers", value: "female" }, + { label: "They/Them/Theirs", value: "non-binary" }, { label: "Other", value: "other" }, - { label: "Prefer not to say", value: "no-say" } + { label: "Prefer not to say", value: "no-say" }, ]; const skillLevelOptions = [ { label: "Beginner - First time hacker or still learning", - value: "beginner" + value: "beginner", }, { label: "Intermediate - Not your first rodeo but still lots to learn", - value: "intermediate" + value: "intermediate", }, - { label: "Advanced - Hacker who knows the game", value: "advanced" } + { label: "Advanced - Hacker who knows the game", value: "advanced" }, ]; -const uploadResume = async resumeFile => { +const uploadResume = async (resumeFile) => { var resumeForm = new FormData(); resumeForm.append("file", resumeFile); await fetch("/api/profile/resume", { method: "POST", - body: resumeForm + body: resumeForm, }); }; -const ProfileStep: React.FunctionComponent = props => { +const ProfileStep: React.FunctionComponent = (props) => { const { profile } = props; const [hasChanged, setHasChanged] = useState( !!profile && !!profile.submittedAt @@ -114,7 +114,7 @@ const ProfileStep: React.FunctionComponent = props => { if (process.browser) { if (hasChanged) { - window.onbeforeunload = function(event) { + window.onbeforeunload = function (event) { var message = "Important: Please click on 'Save' button to leave this page."; if (typeof event == "undefined") { @@ -133,7 +133,7 @@ const ProfileStep: React.FunctionComponent = props => { return profile ? (
{ + onSubmit={(e) => { if (userResume && userResume.files[0]) { uploadResume(userResume.files[0]); } @@ -316,7 +316,7 @@ const ProfileStep: React.FunctionComponent = props => {

Demographics

- + { + onChange={(e) => { setS1(e.target.value); }} value={s1} @@ -271,7 +271,7 @@ const AppReview = ({ hackerProfile, reviewHistory, totalReviews }) => { { + onChange={(e) => { setS2(e.target.value); }} value={s2} @@ -292,10 +292,10 @@ const AppReview = ({ hackerProfile, reviewHistory, totalReviews }) => { { + onChange={(e) => { setS3(e.target.value); }} - onKeyUp={e => { + onKeyUp={(e) => { if (e.key === "e") { e.preventDefault(); } @@ -323,7 +323,7 @@ const AppReview = ({ hackerProfile, reviewHistory, totalReviews }) => { ); }; -AppReview.getInitialProps = async ctx => { +AppReview.getInitialProps = async (ctx) => { const { req } = ctx; const profile = await getProfile(req); @@ -338,7 +338,7 @@ AppReview.getInitialProps = async ctx => { return { hackerProfile: profileReview, reviewHistory, - totalReviews + totalReviews, }; }; diff --git a/pages/application.tsx b/pages/application.tsx index eb097229..d4e6b3a1 100644 --- a/pages/application.tsx +++ b/pages/application.tsx @@ -44,7 +44,6 @@ Application.getInitialProps = async ({ req }) => { const profile = await getProfile(req); //const houses = await getHouses(req); const houses = []; - //console.log(req); // Null profile means user is not logged in if (!profile) { @@ -59,7 +58,6 @@ Application.getInitialProps = async ({ req }) => { if (profile && profile.status == "checkedIn") { //const houseInfo = await getHouseInfo(req, 1); - //console.log(houseInfo); } /* diff --git a/pages/battlepassManager.tsx b/pages/battlepassManager.tsx index 12dd1051..d56fc83e 100644 --- a/pages/battlepassManager.tsx +++ b/pages/battlepassManager.tsx @@ -5,7 +5,7 @@ import { handleLoginRedirect, getProfile } from "../lib/authenticate"; import { getCurrentUnlockables, saveUnlockable, - updateUnlockable + updateUnlockable, } from "../lib/live"; import { Head, Navbar, Footer } from "../components"; @@ -23,7 +23,7 @@ const EditableCell = ({ unlockable }) => { type="number" placeholder="tier" value={currUnlockable.tier} - onChange={e => { + onChange={(e) => { setCurrUnlockable({ ...currUnlockable, tier: e.target.value }); }} /> @@ -31,19 +31,19 @@ const EditableCell = ({ unlockable }) => { type="number" placeholder="pointThreshold" value={currUnlockable.pointThreshold} - onChange={e => { + onChange={(e) => { setCurrUnlockable({ ...currUnlockable, - pointThreshold: e.target.value + pointThreshold: e.target.value, }); }} /> { + onChange={(e) => { setNewUnlockable({ ...newUnlockable, - tier: e.target.value + tier: e.target.value, }); }} /> { + onChange={(e) => { setNewUnlockable({ ...newUnlockable, - pointThreshold: e.target.value + pointThreshold: e.target.value, }); }} /> { + onChange={(e) => { setNewHouse({ ...newHouse, - name: e.target.value + name: e.target.value, }); }} /> { + onChange={(e) => { setNewHouse({ ...newHouse, - color: e.target.value + color: e.target.value, }); }} /> @@ -130,7 +130,7 @@ houseManager.getInitialProps = async ({ req }) => { return { profile, - currentHouses + currentHouses, }; }; diff --git a/pages/judgingManager.tsx b/pages/judgingManager.tsx index a55365b5..3fd5e969 100644 --- a/pages/judgingManager.tsx +++ b/pages/judgingManager.tsx @@ -27,14 +27,14 @@ const judgingManager = ({}) => { const [verticalJudges, setVerticalJudges] = useState({}); const [verticalCount, setVerticalCount] = useState({}); - const tablesBlocks = Object.keys(tables).map(table => { + const tablesBlocks = Object.keys(tables).map((table) => { return ( {table} {tables[table]}