├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── ---feature-request---.md │ └── bug_report.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── archive └── pages │ └── hackrplay │ └── 2022 │ └── registration │ ├── [id].js │ └── index.js ├── components ├── Buttons.js ├── Footer.js ├── Hack-R-Play │ ├── IdeaFilter.js │ └── index.js ├── Header.js ├── Ideas │ └── Card.js ├── Layout.js ├── LayoutWrapper.js ├── LinkLabel.js ├── OwnerFilter.js ├── Pagination.js ├── SortButtons.js ├── StatusFilter.js ├── common │ ├── About.js │ ├── CTA.js │ ├── ChallengesAndPrizes.js │ ├── FAQs.js │ ├── Hero.js │ ├── Judges.js │ ├── Partners.js │ ├── Winners.js │ └── index.js ├── form-builder │ └── index.js ├── interactions │ └── index.js └── status-bar │ └── StatusBar.js ├── jsconfig.json ├── next.config.js ├── package-lock.json ├── package.json ├── pages ├── _app.js ├── api │ └── hello.js ├── events │ ├── 22 │ │ └── hackrplay │ │ │ ├── ideas │ │ │ ├── [id].js │ │ │ ├── index.js │ │ │ └── submit │ │ │ │ └── [id].js │ │ │ └── index.js │ └── 23 │ │ └── twoplaysamonth │ │ └── index.js ├── index.js └── tech-credit.js ├── postcss.config.js ├── public ├── 2plays-a-month │ └── og-image-twoplaysamonth.png ├── FooterReactLogo.svg ├── FooterTriangles.svg ├── Idea-List │ ├── completed.svg │ ├── inProgress.svg │ └── notStart.svg ├── Logo.png ├── Nextjs-logo.png ├── ReactPlayLogo.svg ├── common │ ├── DottedAndFilledTriangle.svg │ ├── DottedPattern.svg │ ├── Flower.svg │ ├── GradientAndSmallTriangle.svg │ ├── HeroLines.svg │ ├── Lines.svg │ ├── RadialGradient.svg │ └── ReactPlayLogoDotted.svg ├── favicon.png ├── hackrplay │ ├── BannerLogo.png │ ├── CTAImage.svg │ ├── GradientAndSmallTriangle.svg │ ├── GradientFlower.svg │ ├── HeroCoders.svg │ ├── NavbarLogo.png │ ├── NhostLogo.svg │ ├── PartnersPolygon.svg │ ├── ReactPlayLogoDotted.svg │ ├── og-image.png │ └── partner0.png ├── robots.txt ├── tailwindcss-logotype.svg └── twoplaysamonth │ ├── BannerLogo.png │ ├── CTAImage.svg │ ├── GradientAndSmallTriangle.svg │ ├── GradientFlower.svg │ ├── HeroCoders.svg │ ├── NavbarLogo.png │ ├── PartnersPolygon.svg │ ├── ReactPlayLogoDotted.svg │ ├── og-image.png │ ├── partner0.png │ └── partner0.svg ├── services ├── consts │ ├── registration-fields.js │ ├── registration-update-fields.js │ ├── submission-fields.js │ └── theme.js ├── graphql │ ├── auth.js │ ├── ideas.js │ ├── interactions.js │ └── status.js ├── metadata │ ├── hackrplay.js │ ├── index.js │ └── twoplaysamonth.js ├── nhost │ └── index.js ├── request │ └── index.js └── util │ ├── string.js │ └── time.js ├── styles ├── Common-component.module.css ├── Home.module.css ├── form-control.css ├── globals.css └── idea.module.css └── tailwind.config.js /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: [reactplay] 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/---feature-request---.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "✨ [Feature request]: " 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | /node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # next.js 37 | /.next/ 38 | /out/ 39 | # production 40 | /build 41 | 42 | 43 | # Optional REPL history 44 | .node_repl_history 45 | 46 | # local env files 47 | .env*.local 48 | .env 49 | 50 | # DS Store 51 | .DS_STORE 52 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | ioreactplay@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via [issue](https://github.com/reactplay/activities/issues), 4 | [email](mailto:contact@reactplay.io), or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a [Code of Conduct](https://github.com/reactplay/activities/blob/main/CODE_OF_CONDUCT.md), please follow it in all your interactions with the project. 7 | 8 | ## Pull Request Process 9 | 10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 11 | build. 12 | 2. Update the README.md with details of changes to the interface, this includes new environment 13 | variables, exposed ports, useful file locations and container parameters. 14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this 15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 17 | do not have permission to do that, you may request the second reviewer to merge it for you. 18 | 19 | ## Code of Conduct 20 | 21 | ### Our Pledge 22 | 23 | In the interest of fostering an open and welcoming environment, we as 24 | contributors and maintainers pledge to making participation in our project and 25 | our community a harassment-free experience for everyone, regardless of age, body 26 | size, disability, ethnicity, gender identity and expression, level of experience, 27 | nationality, personal appearance, race, religion, or sexual identity and 28 | orientation. 29 | 30 | ### Our Standards 31 | 32 | Examples of behavior that contributes to creating a positive environment 33 | include: 34 | 35 | * Using welcoming and inclusive language 36 | * Being respectful of differing viewpoints and experiences 37 | * Gracefully accepting constructive criticism 38 | * Focusing on what is best for the community 39 | * Showing empathy towards other community members 40 | 41 | Examples of unacceptable behavior by participants include: 42 | 43 | * The use of sexualized language or imagery and unwelcome sexual attention or 44 | advances 45 | * Trolling, insulting/derogatory comments, and personal or political attacks 46 | * Public or private harassment 47 | * Publishing others' private information, such as a physical or electronic 48 | address, without explicit permission 49 | * Other conduct which could reasonably be considered inappropriate in a 50 | professional setting 51 | 52 | ### Our Responsibilities 53 | 54 | Project maintainers are responsible for clarifying the standards of acceptable 55 | behavior and are expected to take appropriate and fair corrective action in 56 | response to any instances of unacceptable behavior. 57 | 58 | Project maintainers have the right and responsibility to remove, edit, or 59 | reject comments, commits, code, wiki edits, issues, and other contributions 60 | that are not aligned to this Code of Conduct, or to ban temporarily or 61 | permanently any contributor for other behaviors that they deem inappropriate, 62 | threatening, offensive, or harmful. 63 | 64 | ### Scope 65 | 66 | This Code of Conduct applies both within project spaces and in public spaces 67 | when an individual is representing the project or its community. Examples of 68 | representing a project or community include using an official project e-mail 69 | address, posting via an official social media account, or acting as an appointed 70 | representative at an online or offline event. Representation of a project may be 71 | further defined and clarified by project maintainers. 72 | 73 | ### Enforcement 74 | 75 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 76 | reported by contacting the project team at [contact@reactplay.io](mailto:contact@reactplay.io). All 77 | complaints will be reviewed and investigated and will result in a response that 78 | is deemed necessary and appropriate to the circumstances. The project team is 79 | obligated to maintain confidentiality with regard to the reporter of an incident. 80 | Further details of specific enforcement policies may be posted separately. 81 | 82 | Project maintainers who do not follow or enforce the Code of Conduct in good 83 | faith may face temporary or permanent repercussions as determined by other 84 | members of the project's leadership. 85 | 86 | ### Attribution 87 | 88 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 89 | available at [http://contributor-covenant.org/version/1/4][version] 90 | 91 | [homepage]: http://contributor-covenant.org 92 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 ReactPlayIO 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Activities 2 | A `reactplay` hustle 3 | 4 | This is a [Next.js](https://nextjs.org/) project. 5 | 6 | ## Getting Started 7 | 8 | 1. Install dependencies 9 | ```bash 10 | yarn 11 | ``` 12 | **Note**: We do check in yarn.lock file. So it's advised to use `yarn` package manager. If you need to use any other package manager, remove `yarn.lock` file from the local directory first. Also, do not check in any other lock file. 13 | 2. Create a `.env` file at the root of your project folder with the following content, 14 | 15 | ```bash 16 | NEXT_PUBLIC_NHOST_BACKEND_URL=https://rgkjmwftqtbpayoyolwh.nhost.run 17 | NEXT_PUBLIC_NHOST_SUBDOMAIN=rgkjmwftqtbpayoyolwh 18 | NEXT_PUBLIC_NHOST_REGION=ap-southeast-1 19 | NEXT_PUBLIC_NHOST_PROTOCOL=https 20 | NEXT_PUBLIC_NHOST_SERVER=rgkjmwftqtbpayoyolwh.nhost.run 21 | NEXT_PUBLIC_NHOST_VERSION=v1 22 | NEXT_PUBLIC_NHOST_ENDPOINT=graphql 23 | NEXT_PUBLIC_DEV_PORT=3000 24 | NEXT_PUBLIC_PROTOCOL=http 25 | NEXT_PUBLIC_HACKATHON_ID=e606ae64-7c92-4344-94ad-4d0684458bcf 26 | NEXT_PUBLIC_HACKATHON_SUBMIT_STATUS_ID=ec1c0649-3b65-4809-92cf-9c4a6abdff1b 27 | ``` 28 | 3. Run the development server: 29 | 30 | ```bash 31 | npm run dev 32 | # or 33 | yarn dev 34 | ``` 35 | 36 | 4. See your application running 37 | Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 38 | -------------------------------------------------------------------------------- /archive/pages/hackrplay/2022/registration/[id].js: -------------------------------------------------------------------------------- 1 | import { useAuthenticationStatus, useUserData } from '@nhost/nextjs'; 2 | import styles from '@/styles/Home.module.css'; 3 | 4 | import { FiCheckCircle } from 'react-icons/fi'; 5 | import { NHOST } from '@/services/nhost'; 6 | import { useEffect, useState, forwardRef } from 'react'; 7 | import FormBuilder from '@/components/form-builder'; 8 | import { FIELD_TEMPLATE } from '@/services/consts/registration-update-fields'; 9 | import { getAllUsers } from '@/services/graphql/auth'; 10 | import { 11 | assign_member, 12 | get_idea, 13 | insert_idea, 14 | update_ideas_demographic, 15 | update_ideas_member, 16 | } from '@/services/graphql/ideas'; 17 | import { 18 | PrimaryButton, 19 | SecondaryOutlinedButtonDark, 20 | } from '@/components/Buttons'; 21 | import { useRouter } from 'next/router'; 22 | import LayoutWrapper from '@/components/LayoutWrapper'; 23 | import Snackbar from '@mui/material/Snackbar'; 24 | import MuiAlert from '@mui/material/Alert'; 25 | import { submit } from 'json-graphql-parser/v2'; 26 | import { 27 | get_latest_status, 28 | insert_ideas_status, 29 | list_statuses, 30 | update_ideas_status, 31 | } from '@/services/graphql/status'; 32 | import { escape_new_line, unescape_new_line } from '@/services/util/string'; 33 | 34 | const Alert = forwardRef(function Alert(props, ref) { 35 | return ; 36 | }); 37 | 38 | export default function RegistrationEdit() { 39 | const { isAuthenticated, isLoading } = useAuthenticationStatus(); 40 | const [isDataLoading, setIsDataLoading] = useState(true); 41 | const [isSubmitting, setIsSubmitting] = useState(false); 42 | const [storedIdeaData, setStoredIdeaData] = useState({}); 43 | const [formData, setFormData] = useState({}); 44 | const [alertOpen, setAlertOpen] = useState(false); 45 | const [pageDisabled, setPageDisabled] = useState(false); 46 | 47 | const userData = useUserData(); 48 | const router = useRouter(); 49 | const { id } = router.query; 50 | 51 | const initializeData = () => { 52 | if (Object.keys(storedIdeaData).length === 0) { 53 | setIsDataLoading(true); 54 | const all_apis = [ 55 | { name: 'users', method: getAllUsers }, 56 | { 57 | name: 'status', 58 | method: list_statuses, 59 | post_method: remove_submitted_status, 60 | }, 61 | ]; 62 | const promises = []; 63 | 64 | all_apis.forEach((api) => { 65 | promises.push(api.method()); 66 | }); 67 | 68 | promises.push( 69 | get_idea(id).then((r) => { 70 | const status = get_latest_status(r); 71 | r.description = unescape_new_line(r.description); 72 | if ( 73 | status && 74 | status.id === 75 | process.env.NEXT_PUBLIC_HACKATHON_SUBMIT_STATUS_ID 76 | ) { 77 | router.push('../ideas'); 78 | } else { 79 | prepare_idea_object(r); 80 | } 81 | }) 82 | ); 83 | Promise.all(promises) 84 | .then((res) => { 85 | res.forEach((rApi, rApi_ind) => { 86 | try { 87 | const api_obj = all_apis[rApi_ind]; 88 | storedIdeaData[api_obj.name] = rApi; 89 | const anyField = FIELD_TEMPLATE.filter((field) => { 90 | return field.datafield === api_obj.name; 91 | }); 92 | if (anyField.length) { 93 | anyField[0].options = api_obj.post_method 94 | ? api_obj.post_method(rApi) 95 | : rApi; 96 | } 97 | } catch (err) { 98 | // IGNORE 99 | } 100 | }); 101 | 102 | setStoredIdeaData({ ...storedIdeaData }); 103 | }) 104 | .finally(() => { 105 | setIsDataLoading(false); 106 | }); 107 | } 108 | }; 109 | 110 | const remove_submitted_status = (all_statuses) => { 111 | return all_statuses.filter( 112 | (s) => s.id !== process.env.NEXT_PUBLIC_HACKATHON_SUBMIT_STATUS_ID 113 | ); 114 | }; 115 | 116 | const prepare_idea_object = (idea) => { 117 | if (idea.idea_members_map) { 118 | idea.users = idea.idea_members_map.user_id_map.id; 119 | } 120 | if (idea.idea_idea_status_map) { 121 | idea.status = get_latest_status(idea); 122 | const all_statuses = []; 123 | 124 | idea.idea_idea_status_map.forEach((st) => { 125 | all_statuses.push(st.idea_status_status_map); 126 | }); 127 | const last_status = all_statuses[all_statuses.length - 1]; 128 | idea.status = last_status?.id; 129 | } 130 | if (userData.id !== idea.idea_owner_map.id) { 131 | setAlertOpen(true); 132 | setPageDisabled(true); 133 | } 134 | setFormData({ ...idea }); 135 | setStoredIdeaData({ ...idea }); 136 | }; 137 | 138 | useEffect(() => { 139 | if (!isLoading) { 140 | if (!isAuthenticated) { 141 | if (typeof window !== 'undefined') { 142 | const protocol = process.env.NEXT_PUBLIC_PROTOCOL 143 | ? process.env.NEXT_PUBLIC_PROTOCOL 144 | : 'https'; 145 | const host = window.location.hostname; 146 | const port = process.env.NEXT_PUBLIC_DEV_PORT 147 | ? `:${process.env.NEXT_PUBLIC_DEV_PORT}` 148 | : ''; 149 | const external_path = NHOST.AUTH_URL( 150 | `${protocol}://${host}${port}/registration` 151 | ); 152 | window.location = external_path; 153 | } 154 | } else { 155 | initializeData(); 156 | } 157 | } 158 | }, [isLoading]); 159 | 160 | if (isLoading) { 161 | return ( 162 |
163 |
164 |
165 | Loading authentication information. Please wait. 166 |
167 |
168 |
169 | ); 170 | } 171 | 172 | if (isDataLoading) { 173 | return ( 174 |
175 |
176 |
177 | Checking authentication status. Please wait. 178 |
179 |
180 |
181 | ); 182 | } 183 | 184 | const isFieldsAreInValid = () => { 185 | let res = false; 186 | FIELD_TEMPLATE.forEach((tmpl) => { 187 | if (tmpl.required && (!formData || !formData[tmpl.datafield])) { 188 | res = true; 189 | } 190 | }); 191 | return res; 192 | }; 193 | 194 | const onIdeaDataChanged = (data) => { 195 | setFormData({ ...data }); 196 | setStoredIdeaData({ ...data }); 197 | }; 198 | 199 | const onSubmit = () => { 200 | setIsSubmitting(true); 201 | 202 | const idea_object = (({ title, description }) => ({ 203 | title, 204 | description, 205 | }))(storedIdeaData); 206 | idea_object.owner = userData.id; 207 | formData.description = idea_object.description = escape_new_line( 208 | idea_object.description 209 | ); 210 | const promises = []; 211 | 212 | promises.push(update_ideas_demographic(formData)); 213 | promises.push(update_ideas_member(formData)); 214 | if (formData.status) { 215 | promises.push(insert_ideas_status(formData)); 216 | } 217 | 218 | Promise.all(promises).then((res) => { 219 | router.push('../ideas'); 220 | }); 221 | }; 222 | 223 | const onCancelClicked = () => { 224 | router.push('../ideas'); 225 | }; 226 | 227 | return ( 228 | 229 |
230 |
231 |
232 |
233 |

235 | Registration 236 |

237 |
238 |
239 |
240 | {' '} 241 | {alertOpen ? ( 242 | 243 | You cannot edit this idea. Only author 244 | can edit an idea. 245 | 246 | ) : null} 247 |
248 | 253 | onIdeaDataChanged(data) 254 | } 255 | /> 256 | 257 |
258 |
259 |
260 |
261 |
262 |
263 | 265 | onCancelClicked() 266 | }> 267 | Cancel 268 | 269 |
270 |
271 |
272 | onSubmit()} 278 | onClick={() => os()}> 279 | Update Idea 280 | 284 | 285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 | ); 294 | } 295 | -------------------------------------------------------------------------------- /archive/pages/hackrplay/2022/registration/index.js: -------------------------------------------------------------------------------- 1 | import { useAuthenticationStatus, useUserData } from '@nhost/nextjs'; 2 | import styles from '@/styles/Home.module.css'; 3 | 4 | import Link from 'next/link'; 5 | import { FiCheckCircle } from 'react-icons/fi'; 6 | import { NHOST } from '@/services/nhost'; 7 | import { useEffect, useState } from 'react'; 8 | import FormBuilder from '@/components/form-builder'; 9 | import { FIELD_TEMPLATE } from '@/services/consts/registration-fields'; 10 | import { getAllUsers } from '@/services/graphql/auth'; 11 | import { assign_member, insert_idea } from '@/services/graphql/ideas'; 12 | import { 13 | PrimaryButton, 14 | SecondaryOutlinedButtonDark, 15 | } from '@/components/Buttons'; 16 | import { useRouter } from 'next/router'; 17 | import LayoutWrapper from '@/components/LayoutWrapper'; 18 | import { insert_ideas_status } from '@/services/graphql/status'; 19 | import { escape_new_line } from '@/services/util/string'; 20 | 21 | export default function Registration() { 22 | const { isAuthenticated, isLoading } = useAuthenticationStatus(); 23 | const [isDataLoading, setIsDataLoading] = useState(true); 24 | const [isSubmitting, setIsSubmitting] = useState(false); 25 | const [storedIdeaData, setStoredIdeaData] = useState({}); 26 | const [formData, setFormData] = useState({}); 27 | const router = useRouter(); 28 | 29 | const userData = useUserData(); 30 | 31 | const initializeData = () => { 32 | if (Object.keys(storedIdeaData).length === 0) { 33 | setIsDataLoading(true); 34 | const all_apis = [{ name: 'users', method: getAllUsers }]; 35 | const promises = []; 36 | all_apis.forEach((api) => { 37 | promises.push(api.method()); 38 | }); 39 | 40 | Promise.all(promises) 41 | .then((res) => { 42 | res.forEach((rApi, rApi_ind) => { 43 | const api_obj = all_apis[rApi_ind]; 44 | storedIdeaData[api_obj.name] = rApi; 45 | const anyField = FIELD_TEMPLATE.filter((field) => { 46 | return field.datafield === api_obj.name; 47 | }); 48 | if (anyField.length) { 49 | anyField[0].options = rApi; 50 | } 51 | }); 52 | setStoredIdeaData({ ...storedIdeaData }); 53 | }) 54 | .finally(() => { 55 | setIsDataLoading(false); 56 | }); 57 | } 58 | }; 59 | 60 | useEffect(() => { 61 | if (!isLoading) { 62 | if (!isAuthenticated) { 63 | if (typeof window !== 'undefined') { 64 | const protocol = process.env.NEXT_PUBLIC_PROTOCOL 65 | ? process.env.NEXT_PUBLIC_PROTOCOL 66 | : 'https'; 67 | const host = window.location.hostname; 68 | const port = process.env.NEXT_PUBLIC_DEV_PORT 69 | ? `:${process.env.NEXT_PUBLIC_DEV_PORT}` 70 | : ''; 71 | const external_path = NHOST.AUTH_URL( 72 | `${protocol}://${host}${port}/hackrplay/2022/registration` 73 | ); 74 | window.location = external_path; 75 | } 76 | } else { 77 | initializeData(); 78 | } 79 | } 80 | }, [isLoading]); 81 | 82 | if (isLoading) { 83 | return ( 84 |
85 |
86 |
87 | Loading authentication information. Please wait. 88 |
89 |
90 |
91 | ); 92 | } 93 | 94 | if (isDataLoading) { 95 | return ( 96 |
97 |
98 |
99 | Checking authentication status. Please wait. 100 |
101 |
102 |
103 | ); 104 | } 105 | 106 | const isFieldsAreInValid = () => { 107 | let res = false; 108 | FIELD_TEMPLATE.forEach((tmpl) => { 109 | if (tmpl.required && (!formData || !formData[tmpl.datafield])) { 110 | res = true; 111 | } 112 | }); 113 | return res; 114 | }; 115 | 116 | const onIdeaDataChanged = (data) => { 117 | setFormData({ ...data }); 118 | setStoredIdeaData({ ...data }); 119 | }; 120 | 121 | const onSubmit = () => { 122 | setIsSubmitting(true); 123 | let idea_id = storedIdeaData.id; 124 | let selected_users = storedIdeaData.users; 125 | const idea_object = (({ title, description }) => ({ 126 | title, 127 | description, 128 | }))(storedIdeaData); 129 | idea_object.owner = userData.id; 130 | idea_object.description = escape_new_line(idea_object.description); 131 | if (!idea_id) 132 | return insert_idea(idea_object).then((res) => { 133 | idea_id = res.id; 134 | const promises = []; 135 | if (selected_users && selected_users.length) { 136 | if (storedIdeaData.users) { 137 | promises.push( 138 | assign_member(idea_id, storedIdeaData.users) 139 | ); 140 | } 141 | } 142 | formData.status = '63c47cd7-f9c4-41e1-87b6-7ebe7b59f00e'; 143 | formData.id = idea_id; 144 | promises.push(insert_ideas_status(formData)); 145 | return Promise.all(promises).then((res) => { 146 | router.push('ideas'); 147 | setIsSubmitting(false); 148 | }); 149 | }); 150 | }; 151 | const onCancelClicked = () => { 152 | router.back(); 153 | }; 154 | 155 | return ( 156 | 157 |
158 |
159 |
160 |
161 |

163 | Registration 164 |

165 |
166 |
167 |
168 |
169 | Welcome{' '} 170 | 171 | {userData.displayName} 172 | 173 | , register your idea 174 |
175 |
176 | 179 | onIdeaDataChanged(data) 180 | } 181 | /> 182 | 183 |
184 |
185 |
186 |
187 |
188 |
189 | 191 | onCancelClicked() 192 | }> 193 | Cancel 194 | 195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 | ); 205 | } 206 | -------------------------------------------------------------------------------- /components/Buttons.js: -------------------------------------------------------------------------------- 1 | export const PrimaryButton = ({ 2 | children, 3 | handleOnClick, 4 | className, 5 | small = false, 6 | ...props 7 | }) => { 8 | const buttonSize = small 9 | ? "md:pt-1 md:pb-0 md:px-4 py-2 px-4 text-lg" 10 | : "md:py-4 md:px-7 py-3 px-5 text-xl"; 11 | 12 | return ( 13 | 20 | ); 21 | }; 22 | 23 | export const PrimaryLink = ({ 24 | children, 25 | link, 26 | className, 27 | target, 28 | small = false, 29 | ...props 30 | }) => { 31 | const buttonSize = small 32 | ? "md:pt-1 md:pb-0 md:px-4 py-2 px-4 text-lg" 33 | : "md:py-4 md:px-7 py-3 px-5 text-xl"; 34 | 35 | return ( 36 | 42 | {children} 43 | 44 | ); 45 | }; 46 | 47 | export const SecondaryButton = ({ 48 | children, 49 | handleOnClick, 50 | className, 51 | small = false, 52 | }) => { 53 | const buttonSize = small 54 | ? "md:py-3 md:px-5 py-2 px-4 text-lg" 55 | : "md:py-4 md:px-7 py-3 px-5 text-xl"; 56 | 57 | return ( 58 | 64 | ); 65 | }; 66 | 67 | export const SecondaryLink = ({ 68 | children, 69 | link, 70 | className, 71 | target, 72 | small = false, 73 | }) => { 74 | const buttonSize = small 75 | ? "md:py-3 md:px-5 py-2 px-4 text-lg" 76 | : "md:py-4 md:px-7 py-3 px-5 text-xl"; 77 | 78 | return ( 79 | 84 | {children} 85 | 86 | ); 87 | }; 88 | 89 | export const SecondaryOutlinedButton = ({ 90 | children, 91 | handleOnClick, 92 | small = false, 93 | }) => { 94 | const buttonSize = small 95 | ? "md:py-3 md:px-5 py-2 px-4 text-lg" 96 | : "md:py-4 md:px-7 py-3 px-5 text-xl"; 97 | 98 | return ( 99 | 105 | ); 106 | }; 107 | 108 | export const SecondaryOutlinedButtonDark = ({ children, handleOnClick }) => { 109 | return ( 110 | 116 | ); 117 | }; 118 | 119 | export const ToolBarButton = ({ 120 | children, 121 | handleOnClick, 122 | disabled, 123 | selected, 124 | cclas, 125 | }) => { 126 | return ( 127 |
128 | 136 |
137 | ); 138 | }; 139 | -------------------------------------------------------------------------------- /components/Footer.js: -------------------------------------------------------------------------------- 1 | import Image from "next/image"; 2 | 3 | import FooterTriangles from "../public/FooterTriangles.svg"; 4 | import ReactPlayLogo from "../public/ReactPlayLogo.svg"; 5 | import FooterReactLogo from "../public/FooterReactLogo.svg"; 6 | import { FaDiscord, FaTwitter, FaRss } from "react-icons/fa"; 7 | import Link from "next/link"; 8 | 9 | const Footer = () => { 10 | return ( 11 | 71 | ); 72 | }; 73 | 74 | export default Footer; 75 | -------------------------------------------------------------------------------- /components/Hack-R-Play/IdeaFilter.js: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | import { useState, useEffect } from "react"; 3 | import Pagination from "@/components/Pagination"; 4 | import SortButtons from "@/components/SortButtons"; 5 | import OwnerFilter from "@/components/OwnerFilter"; 6 | import StatusFilter from "../StatusFilter"; 7 | 8 | export default function IdeaFilters({ 9 | total, 10 | pagesize, 11 | onChange, 12 | isAuthenticated, 13 | }) { 14 | const [filter, setFilter] = useState({}); 15 | 16 | useEffect(() => {}, [total]); 17 | 18 | const resetFilter = () => { 19 | filter.sort_col = "created_at"; 20 | filter.sort_asc = true; 21 | filter.page = 1; 22 | filter.owner = "all"; 23 | filter.pagesize = pagesize; 24 | filter.status_filter = undefined; 25 | return filter; 26 | }; 27 | 28 | const onPageChanged = (index) => { 29 | const fl = resetFilter(); 30 | fl.page = index; 31 | setFilter({ ...fl }); 32 | invokeChange(fl); 33 | }; 34 | 35 | const onOwnerChanged = (owner) => { 36 | const fl = resetFilter(); 37 | 38 | fl.owner = owner; 39 | setFilter({ ...fl }); 40 | invokeChange(fl); 41 | }; 42 | 43 | const onSortChanged = (button) => { 44 | const fl = resetFilter(); 45 | fl.sort_col = button.field; 46 | fl.sort_asc = button.asc; 47 | setFilter({ ...fl }); 48 | invokeChange(fl); 49 | }; 50 | 51 | const onStatusFilterChanged = (status) => { 52 | const fl = resetFilter(); 53 | fl.status_filter = status; 54 | setFilter({ ...fl }); 55 | invokeChange(fl); 56 | }; 57 | 58 | const invokeChange = (filter) => { 59 | if (onChange) { 60 | onChange(filter); 61 | } 62 | }; 63 | 64 | return ( 65 |
66 | {isAuthenticated ? ( 67 |
68 | onOwnerChanged(r)} 70 | selected={filter.owner} 71 | > 72 |
73 | ) : null} 74 |
75 | onStatusFilterChanged(r)} 77 | selected={filter.status_filter} 78 | > 79 |
80 |
81 | onPageChanged(page)} 85 | > 86 | onSortChanged(b)} 88 | buttons={[ 89 | { label: "Date", field: "created_at" }, 90 | { label: "Name", field: "title" }, 91 | // { label: 'Popularity', field: 'liked' }, 92 | ]} 93 | > 94 |
95 |
96 | ); 97 | } 98 | -------------------------------------------------------------------------------- /components/Hack-R-Play/index.js: -------------------------------------------------------------------------------- 1 | import Hero from "../common/Hero"; 2 | import About from "../common/About"; 3 | import ChallengesAndPrizes from "../common/ChallengesAndPrizes"; 4 | import Judges from "../common/Judges"; 5 | import Partners from "../common/Partners"; 6 | import CTA from "../common/CTA"; 7 | import FAQs from "../common/FAQs"; 8 | 9 | export { Hero, About, ChallengesAndPrizes, Judges, Partners, CTA, FAQs }; 10 | -------------------------------------------------------------------------------- /components/Header.js: -------------------------------------------------------------------------------- 1 | import Link from "next/link"; 2 | import { useState } from "react"; 3 | import { AiOutlineMenu, AiOutlineClose } from "react-icons/ai"; 4 | import { PrimaryButton } from "./Buttons"; 5 | import Image from "next/image"; 6 | 7 | import { useRouter } from "next/router"; 8 | 9 | const MobileHeader = ({ links, setMobileActive, redirectToRegistration }) => { 10 | return ( 11 | <> 12 |
13 |
14 | 20 |
21 | 22 | 34 |
35 | 36 | ); 37 | }; 38 | 39 | const Header = ({ links, metainfo, secondary = false }) => { 40 | const [mobileActive, setMobileActive] = useState(false); 41 | const router = useRouter(); 42 | const redirectToRegistration = () => { 43 | router.push("/hackrplay/2022/registration"); 44 | }; 45 | 46 | return ( 47 | <> 48 | {secondary ? ( 49 |
50 |
51 | 52 | 53 | Navbar Logo 58 | 59 | 60 |
61 |
62 | ) : ( 63 |
64 |
65 | {links && 66 | links.map((link, index) => ( 67 | 68 | 69 | {link.name} 70 | 71 | 72 | ))} 73 |
74 | 80 |
81 | )} 82 | {!secondary && mobileActive && ( 83 | 89 | )} 90 | 91 | ); 92 | }; 93 | 94 | export default Header; 95 | -------------------------------------------------------------------------------- /components/Ideas/Card.js: -------------------------------------------------------------------------------- 1 | import styles from '../../styles/idea.module.css'; 2 | import Image from 'next/image'; 3 | import { Grid, Card, Typography } from '@mui/material'; 4 | import InProgress from '/public/Idea-List/inProgress.svg'; 5 | import Complted from '/public/Idea-List/completed.svg'; 6 | import NotStarted from '/public/Idea-List/notStart.svg'; 7 | import { FiThumbsUp } from 'react-icons/fi'; 8 | import { BiComment } from 'react-icons/bi'; 9 | 10 | const IdeaCard = ({ data, onClick }) => { 11 | const get_status_style = (status) => { 12 | const final_status = status || { label: 'Idea Submitted' }; 13 | switch (final_status.label) { 14 | case 'Completed': 15 | return { 16 | image: Complted, 17 | color: '#68FDC6', 18 | }; 19 | case 'In Progress': 20 | return { 21 | image: InProgress, 22 | color: '#FDC668', 23 | }; 24 | case 'Idea Submitted': 25 | default: 26 | return { 27 | image: NotStarted, 28 | color: '#FD6868', 29 | }; 30 | } 31 | }; 32 | return ( 33 | onClick()}> 37 | 41 | 42 | 46 | {data.title} 47 | 48 | 49 |
50 | 54 | {`status 58 | 59 | 63 | {data?.status?.label.toUpperCase() || 64 | 'IDEA SUBMITTED'} 65 | 66 | 67 |
68 | 69 |
71 | {data.description} 72 |
73 |
74 |
75 |
82 | {data.avatarUrl.map((value, index) => { 83 | return ( 84 |
92 | {value && ( 93 | {'user 103 | )} 104 |
105 | ); 106 | })} 107 |
108 |
109 |
110 |
111 | {' '} 112 | 113 |
114 | {data.like_count} 115 |
116 |
117 |
118 | 119 |
120 | {data.comment_count} 121 |
122 |
123 |
124 |
125 |
126 | ); 127 | }; 128 | export default IdeaCard; 129 | -------------------------------------------------------------------------------- /components/Layout.js: -------------------------------------------------------------------------------- 1 | import { ThemeConfig } from "@/services/consts/theme"; 2 | import Head from "next/head"; 3 | import { useRouter } from "next/router"; 4 | import React, { useEffect, useState } from "react"; 5 | import Footer from "./Footer"; 6 | import Header from "./Header"; 7 | 8 | const Layout = ({ children, title, description, metainfo }) => { 9 | const currentPath = useRouter().pathname; 10 | const [secondaryNavbar, setSecondaryNavbar] = useState(false); 11 | const [loading, setLoading] = useState(true); 12 | 13 | useEffect(() => { 14 | if ( 15 | currentPath === "/events/23/hackrplay/2022/home" || 16 | currentPath === "/events/23/twoplaysamonth" 17 | ) { 18 | setSecondaryNavbar(false); 19 | } else { 20 | setSecondaryNavbar(true); 21 | } 22 | if (metainfo?.name) { 23 | setLoading(false); 24 | } 25 | }, []); 26 | 27 | return ( 28 | <> 29 | {!loading ? ( 30 |
31 | 32 | {title} 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 55 | 56 | 57 | 58 | 59 | 60 | 64 | 65 |