From 425fe5611e335a4867f411f09a7ab0c0e06fd954 Mon Sep 17 00:00:00 2001 From: Swarup Hegde Date: Mon, 2 Dec 2019 11:52:37 +0530 Subject: [PATCH 01/15] feat: added prizes section --- .env.example | 1 + .github/labeler.yml | 16 ++ README.md | 3 + backend/settings.py | 25 ++ backend/urls.py | 3 +- hackathon/api/urls.py | 10 +- hackathon/api/views.py | 38 ++- .../migrations/0005_auto_20191207_0928.py | 28 +++ hackathon/models.py | 9 + package-lock.json | 126 ++++++++++ package.json | 5 + public/index.html | 86 +++---- requirements.txt | 3 +- src/App.js | 26 +- src/actions/index.js | 6 + src/components/ErrorPages/ErrorBoundary.jsx | 32 +++ .../ErrorPages/InternalServerError.css | 33 +++ .../ErrorPages/InternalServerError.jsx | 30 +++ .../ErrorPages/PageNotFoundError.css | 15 ++ .../ErrorPages/PageNotFoundError.jsx | 23 ++ src/components/about.css | 18 ++ src/components/about.jsx | 56 +---- src/components/faq.css | 28 +++ src/components/faq.jsx | 115 +++++++++ src/components/landingPage.jsx | 105 +++++--- src/components/navbar.jsx | 3 + src/components/prizes.jsx | 57 +++++ src/components/schedule.jsx | 160 ++++++------ src/components/theme.css | 11 + src/components/theme.jsx | 14 ++ src/constants/index.js | 8 + src/css/landing.css | 34 ++- src/css/prizes.css | 191 +++++++++++++++ src/css/schedule.css | 228 +++++++++--------- src/fonts/Perfect DOS VGA 437.ttf | Bin 0 -> 81192 bytes src/fonts/dos-vga-437-win.ttf | Bin 0 -> 82676 bytes src/img/about-world.png | Bin 0 -> 181046 bytes src/img/qa.png | Bin 0 -> 5983 bytes src/index.js | 27 ++- src/js/popout.js | 10 + src/reducers/appStatus.js | 11 + src/reducers/index.js | 10 + src/reducers/isLogged.js | 10 + src/services/hackathon.js | 11 + 44 files changed, 1294 insertions(+), 331 deletions(-) create mode 100644 .github/labeler.yml create mode 100644 hackathon/migrations/0005_auto_20191207_0928.py create mode 100644 src/actions/index.js create mode 100644 src/components/ErrorPages/ErrorBoundary.jsx create mode 100644 src/components/ErrorPages/InternalServerError.css create mode 100644 src/components/ErrorPages/InternalServerError.jsx create mode 100644 src/components/ErrorPages/PageNotFoundError.css create mode 100644 src/components/ErrorPages/PageNotFoundError.jsx create mode 100644 src/components/about.css create mode 100644 src/components/faq.css create mode 100644 src/components/faq.jsx create mode 100644 src/components/prizes.jsx create mode 100644 src/components/theme.css create mode 100644 src/components/theme.jsx create mode 100644 src/constants/index.js create mode 100644 src/css/prizes.css create mode 100644 src/fonts/Perfect DOS VGA 437.ttf create mode 100644 src/fonts/dos-vga-437-win.ttf create mode 100644 src/img/about-world.png create mode 100644 src/img/qa.png create mode 100644 src/js/popout.js create mode 100644 src/reducers/appStatus.js create mode 100644 src/reducers/index.js create mode 100644 src/reducers/isLogged.js create mode 100644 src/services/hackathon.js diff --git a/.env.example b/.env.example index 8bbcfa7..26c4eba 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ SECRET_KEY=somerandomtext DATABASE_URL=postgres://postgres@localhost/test_db +APP_STATUS=live diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..2b2384b --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,16 @@ +repo: + - ./* + +# Add '@domain/core' label to any change within the 'core' package +backend: + - backend/* + - hackathon/* + - account/* + +frontend: + - src/* + - public/* + +# Add 'test' label to any change to *.spec.js files within the source dir +test: + - test.py diff --git a/README.md b/README.md index 6ef8c6a..e7cd4bc 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,9 @@ To avoid any conflicts you can ask secret key from admin or use your own. And se If you followed the same procedure as mentioned in Database configuration section then the URL will be same just like this, else if you have choosen different username then edit those fields. Now you have everything set up. +Update: There is another environment variable which needs to be there called `APP_STATUS`, for local testing +it will be `APP_STATUS=testing` + There is one more configuration which is `PRODUCTION=False`, but if you will not type anything or ignore it then also it will work fine. Note: When working in git version control system, we have one file called `.gitignore`, this tells us that what files we need to ignore when pushing the changes. So currently we add `.env` in gitignore file so that this particular file will never be uploaded in repository and by this you will avoid publishing your secrets. diff --git a/backend/settings.py b/backend/settings.py index 2ee9052..508406f 100644 --- a/backend/settings.py +++ b/backend/settings.py @@ -18,6 +18,7 @@ production = False debug_setting = True +app_status = 'down' if config('PRODUCTION', default='False').lower() == 'true': production = True @@ -25,9 +26,22 @@ if config('DEBUG', default='True').lower() == 'false': debug_setting = False +if config('APP_STATUS', default='down').lower() == 'down': + app_status = 'down' +elif config('APP_STATUS').lower() == 'live': + app_status = 'live' +elif config('APP_STATUS').lower() == 'maintenance': + app_status = 'maintenance' +elif config('APP_STATUS').lower() == 'testing': + app_status = 'testing' +else: + app_status = 'down' + print('=' * 30) print('PRODUCTION:', production) +print('HTTPS:', production) print('DEBUG:', debug_setting) +print('APP STATUS:', app_status) if production: print('SENTRY SETTINGS: ON') @@ -97,6 +111,11 @@ # Application definition +CORS_ORIGIN_WHITELIST = ( + 'http://localhost:8000', + 'http://localhost:3000' +) + INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', @@ -108,10 +127,12 @@ 'rest_framework', 'account', 'hackathon', + 'corsheaders', 'raven.contrib.django.raven_compat' ] MIDDLEWARE = [ + 'corsheaders.middleware.CorsMiddleware', 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -202,6 +223,10 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'build', 'static') STATICFILES_DIRS = [] +if production: + SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + SECURE_SSL_REDIRECT = True + # If you want to serve user uploaded files add these settings MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'build', 'media') diff --git a/backend/urls.py b/backend/urls.py index 9308084..137c2be 100644 --- a/backend/urls.py +++ b/backend/urls.py @@ -25,5 +25,6 @@ re_path(r'^api/v1/hackathon/', include('hackathon.api.urls')), re_path(r'^api/v1/docs/', include_docs_urls(title='Isohack API', permission_classes=[], public=True)), path('', index, name='index'), - re_path(r'^(?:.*)/?$', index) + re_path(r'^(?:.*)/?$', index), + ] diff --git a/hackathon/api/urls.py b/hackathon/api/urls.py index d7507d2..724c685 100644 --- a/hackathon/api/urls.py +++ b/hackathon/api/urls.py @@ -1,13 +1,17 @@ from django.urls import path, re_path from .views import (ProblemCategoryAPIView, HackathonEventAPIView, - HackathonCommitVersion, HackathonLastUpdated) + HackathonCommitVersion, HackathonLastUpdated, + HackathonAppStatus,ProblemCategoryClass) from rest_framework_jwt.views import obtain_jwt_token urlpatterns = [ - path('version/', HackathonCommitVersion.as_view(), name='hackathon-version'), - path('version/timestamp/', HackathonLastUpdated.as_view(), name='hackathon-last-updated'), + path('release/version/', HackathonCommitVersion.as_view(), name='hackathon-version'), + path('release/date/', HackathonLastUpdated.as_view(), name='hackathon-last-updated'), + path('status/', HackathonAppStatus.as_view(), name='hackathon-app-status'), path('categories/', ProblemCategoryAPIView.as_view(), name='hackathon-problem-category'), path('events/', HackathonEventAPIView.as_view(), name='hackathon-event'), + path('problem/category', ProblemCategoryClass.get_problem_category, name='hackathon-problem-categoryAPI'), + path('problem/category/', ProblemCategoryClass.get_problem_statements, name='hackathon-problem_statementAPI'), ] diff --git a/hackathon/api/views.py b/hackathon/api/views.py index faa0b2f..f3cc921 100644 --- a/hackathon/api/views.py +++ b/hackathon/api/views.py @@ -1,8 +1,10 @@ from rest_framework.filters import OrderingFilter from rest_framework.pagination import LimitOffsetPagination +from django.http import HttpResponse, JsonResponse + from rest_framework.views import APIView from rest_framework.response import Response -from backend.settings import LATEST_COMMIT_VERSION, LATEST_COMMIT_DATE +from backend.settings import LATEST_COMMIT_VERSION, LATEST_COMMIT_DATE, app_status from hackathon.models import (ProblemStatement, ProblemCategory, @@ -36,6 +38,13 @@ def get(self, request): return Response({'date': LATEST_COMMIT_DATE}) +class HackathonAppStatus(APIView): + permission_classes = [] + + def get(self, request): + return Response({'status': app_status}) + + class ProblemCategoryAPIView(generics.ListAPIView): serializer_class = ProblemCategorySerializer permission_classes = (IsAdminOrSuperUser,) @@ -59,3 +68,30 @@ class HackathonEventAPIView(generics.ListAPIView): def get_queryset(self): return HackathonEvent.objects.all() + + +class ProblemCategoryClass(HttpResponse): + serializer_class = ProblemCategorySerializer + + def get_problem_category(request): + if request.method == 'GET': + category = ProblemCategory.objects.all().values('id','category','description','created_at') + # serializer = ProblemCategorySerializer(category,many=True) + listed = list(category) + return JsonResponse(listed, safe=False) + else: + print("Only GET is allowed") + + def get_problem_statements(request, category_id): + if request.method == 'GET': + statements = ProblemStatement.objects.filter(category=category_id).values("id","statement","description","created_at","category_id") + # serializer = ProblemCategorySerializer(category, many=True) + listed = list(statements) + return JsonResponse(listed, safe=False) + else: + print("Only GET is allowed") + + + + + diff --git a/hackathon/migrations/0005_auto_20191207_0928.py b/hackathon/migrations/0005_auto_20191207_0928.py new file mode 100644 index 0000000..560f07d --- /dev/null +++ b/hackathon/migrations/0005_auto_20191207_0928.py @@ -0,0 +1,28 @@ +# Generated by Django 3.0 on 2019-12-07 03:58 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('hackathon', '0004_hackathonevent'), + ] + + operations = [ + migrations.CreateModel( + name='ProblemDomain', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('name', models.CharField(max_length=127)), + ('description', models.TextField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ], + ), + migrations.AddField( + model_name='problemstatement', + name='domain', + field=models.ManyToManyField(to='hackathon.ProblemDomain'), + ), + ] diff --git a/hackathon/models.py b/hackathon/models.py index 3622acd..609c130 100644 --- a/hackathon/models.py +++ b/hackathon/models.py @@ -10,12 +10,19 @@ class ProblemCategory(models.Model): created_at = models.DateTimeField(auto_now_add=True) +class ProblemDomain(models.Model): + id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + name = models.CharField(max_length=127) + description = models.TextField() + created_at = models.DateTimeField(auto_now_add=True) + class ProblemStatement(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) category = models.ForeignKey(ProblemCategory, on_delete=models.CASCADE) statement = models.TextField() description = models.TextField() created_at = models.DateTimeField(auto_now_add=True) + domain = models.ManyToManyField(ProblemDomain) class HackathonTeam(models.Model): @@ -54,3 +61,5 @@ class HackathonEvent(models.Model): end_time = models.DateTimeField() location = models.CharField(max_length=80) created_at = models.DateTimeField(auto_now_add=True) + + diff --git a/package-lock.json b/package-lock.json index d4e62f0..9159f27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1157,6 +1157,63 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz", "integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==" }, + "@sentry/browser": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-5.10.0.tgz", + "integrity": "sha512-E3vat2B94MfmGJ3xS202xClCaxcSO67h4tMCpyk13xPzZxIbftJ4dpDmXNlvrxzv9URCQPDOA6v8ZbvGHxJ1xQ==", + "requires": { + "@sentry/core": "5.10.0", + "@sentry/types": "5.10.0", + "@sentry/utils": "5.10.0", + "tslib": "^1.9.3" + } + }, + "@sentry/core": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.10.0.tgz", + "integrity": "sha512-sPtgZIRFDKgIvmASi5/kLn+bTRuqhj/NkBlY2SkVgCKfo4Plu1uLJt4zEFF7UC3+MP+2PQA4F6gnAwWIqisbXQ==", + "requires": { + "@sentry/hub": "5.10.0", + "@sentry/minimal": "5.10.0", + "@sentry/types": "5.10.0", + "@sentry/utils": "5.10.0", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.10.0.tgz", + "integrity": "sha512-GJjsmu6oI02uL+HnO504XvExhsD6TW7qwOKuIdy27Apq9d/+ZGsjnMigI9bR9UT3JqVQr3OzreDC4LBCGehTqw==", + "requires": { + "@sentry/types": "5.10.0", + "@sentry/utils": "5.10.0", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.10.0.tgz", + "integrity": "sha512-ZZd+IJewSZDuxKKQgzLdSKGNDsDIL6IW/9jGHY+uX1D9t7NnZIBmfpaIUsMPe1rJxag+fEk0FJH+g/z4uIZI2w==", + "requires": { + "@sentry/hub": "5.10.0", + "@sentry/types": "5.10.0", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.10.0.tgz", + "integrity": "sha512-TW20GzkCWsP6uAxR2JIpIkiitCKyIOfkyDsKBeLqYj4SaZjfvBPnzgNCcYR0L0UsP1/Es6oHooZfIGSkp6GGxQ==" + }, + "@sentry/utils": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.10.0.tgz", + "integrity": "sha512-wcxwqtAomr1O65aXx41oHsgl/AGJTJ9C4c03FAMg9wHWEfzEby0el6BZCMq3IAG09zY7vY43zhEFWFghI5u2eg==", + "requires": { + "@sentry/types": "5.10.0", + "tslib": "^1.9.3" + } + }, "@svgr/babel-plugin-add-jsx-attribute": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/@svgr/babel-plugin-add-jsx-attribute/-/babel-plugin-add-jsx-attribute-4.2.0.tgz", @@ -1897,6 +1954,43 @@ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" }, + "axios": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.0.tgz", + "integrity": "sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ==", + "requires": { + "follow-redirects": "1.5.10", + "is-buffer": "^2.0.2" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "=3.1.0" + } + }, + "is-buffer": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + } + } + }, "axobject-query": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.0.2.tgz", @@ -10424,11 +10518,29 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.3.tgz", "integrity": "sha512-bOUvMWFQVk5oz8Ded9Xb7WVdEi3QGLC8tH7HmYP0Fdp4Bn3qw0tRFmr5TW6mvahzvmrK4a6bqWGfCevBflP+Xw==" }, + "react-ga": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/react-ga/-/react-ga-2.7.0.tgz", + "integrity": "sha512-AjC7UOZMvygrWTc2hKxTDvlMXEtbmA0IgJjmkhgmQQ3RkXrWR11xEagLGFGaNyaPnmg24oaIiaNPnEoftUhfXA==" + }, "react-is": { "version": "16.11.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.11.0.tgz", "integrity": "sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw==" }, + "react-redux": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.1.3.tgz", + "integrity": "sha512-uI1wca+ECG9RoVkWQFF4jDMqmaw0/qnvaSvOoL/GA4dNxf6LoV8sUAcNDvE5NWKs4hFpn0t6wswNQnY3f7HT3w==", + "requires": { + "@babel/runtime": "^7.5.5", + "hoist-non-react-statics": "^3.3.0", + "invariant": "^2.2.4", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-is": "^16.9.0" + } + }, "react-router": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/react-router/-/react-router-5.1.2.tgz", @@ -10615,6 +10727,15 @@ "minimatch": "3.0.4" } }, + "redux": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.4.tgz", + "integrity": "sha512-vKv4WdiJxOWKxK0yRoaK3Y4pxxB0ilzVx6dszU2W8wLxlb2yikRph4iV/ymtdJ6ZxpBLFbyrxklnT5yBbQSl3Q==", + "requires": { + "loose-envify": "^1.4.0", + "symbol-observable": "^1.2.0" + } + }, "regenerate": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", @@ -12028,6 +12149,11 @@ "util.promisify": "~1.0.0" } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==" + }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", diff --git a/package.json b/package.json index f939241..be6d3fe 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,16 @@ "version": "0.1.0", "private": true, "dependencies": { + "@sentry/browser": "^5.10.0", + "axios": "^0.19.0", "materialize-css": "^1.0.0-rc.2", "react": "^16.11.0", "react-dom": "^16.11.0", + "react-ga": "^2.7.0", + "react-redux": "^7.1.3", "react-router-dom": "^5.1.2", "react-scripts": "3.2.0", + "redux": "^4.0.4", "simplebar-react": "^2.0.10" }, "scripts": { diff --git a/public/index.html b/public/index.html index 7efbb4d..9d37b75 100644 --- a/public/index.html +++ b/public/index.html @@ -1,50 +1,50 @@ - + - - - - - - - - - - - - - - - - IsoHack + + + + + + + + + + + + + + + + IsoHack - + - -
- - + +
+ + - + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a54a2b7..ac13812 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ coreapi==2.3.3 dj-database-url==0.5.0 -Django==2.2.6 +django>=2.2.8 django-heroku==0.3.1 djangorestframework==3.10.3 djangorestframework-jwt==1.11.0 +django-cors-headers==3.2.0 gunicorn==19.9.0 psycopg2==2.8.4 python-decouple==3.1 diff --git a/src/App.js b/src/App.js index d101414..f70fed2 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,9 @@ import React, { Component } from 'react'; +import ReactGA from 'react-ga'; import LandingPage from './components/landingPage' import LoadingFire from './components/loadingFire' import M from 'materialize-css' +import ErrorBoundary from "./components/ErrorPages/ErrorBoundary"; class App extends Component { state = { @@ -13,8 +15,12 @@ class App extends Component { opacity: 1 }, loading: true - }; + }; + initializeReactGA() { + ReactGA.initialize('UA-154119463-1'); + ReactGA.pageview('/'); + } componentDidMount() { M.AutoInit(); setTimeout(() => { @@ -39,20 +45,22 @@ class App extends Component { }, 3000); } - render() { + render() { return (
+ opacity={this.state.loadingFireBackground.opacity} + height={this.state.loadingFireBackground.height} + itemOpacity={this.state.loadingFireItem.opacity} />
- + + +
); } } - - -export default App; \ No newline at end of file + + +export default App; diff --git a/src/actions/index.js b/src/actions/index.js new file mode 100644 index 0000000..6877909 --- /dev/null +++ b/src/actions/index.js @@ -0,0 +1,6 @@ +export const changeAppStatus = status => { + return { + type: 'CHANGE', + payload: status + }; +}; \ No newline at end of file diff --git a/src/components/ErrorPages/ErrorBoundary.jsx b/src/components/ErrorPages/ErrorBoundary.jsx new file mode 100644 index 0000000..cef7a3f --- /dev/null +++ b/src/components/ErrorPages/ErrorBoundary.jsx @@ -0,0 +1,32 @@ +import React, { Component } from 'react' +import InternalServerError from "./InternalServerError"; + +class ErrorBoundary extends Component { + constructor(props) { + super(props); + this.state = {error: null}; + } + + componentDidCatch(error, errorInfo) { + console.log('YESSSS'); + this.setState({error}); + // Raven.captureException(error, {extra: errorInfo}); + } + + render() { + if (this.state.error) { + return ( +
Raven.lastEventId() && Raven.showReportDialog()} + > + +
+ ); + } else { + //when there's not an error, render children untouched + return this.props.children; + } + } +} +export default ErrorBoundary; \ No newline at end of file diff --git a/src/components/ErrorPages/InternalServerError.css b/src/components/ErrorPages/InternalServerError.css new file mode 100644 index 0000000..327ad5d --- /dev/null +++ b/src/components/ErrorPages/InternalServerError.css @@ -0,0 +1,33 @@ +@font-face { + font-family: 'DosFont'; + src: local('DosFont'), url(../../fonts/dos-vga-437-win.ttf) format('truetype'); +} + +@media only screen and (max-width: 1000px) { + .server-error-body p { + color: white; + font-family: 'DosFont', Fallback, sans-serif !important; + font-size: 1rem !important; + } +} + +.server-error-background { + position: absolute; + width: 100vw; + height: 100vh; + background-color: rgb(1, 0, 173); +} + +.server-error-body { + margin: 10vh 5vw; +} + +.server-error-body p { + color: white; + font-family: 'DosFont', Fallback, sans-serif !important; + font-size: 1.5rem; +} + +.server-error-focus { + font-weight: 500; +} \ No newline at end of file diff --git a/src/components/ErrorPages/InternalServerError.jsx b/src/components/ErrorPages/InternalServerError.jsx new file mode 100644 index 0000000..bc46105 --- /dev/null +++ b/src/components/ErrorPages/InternalServerError.jsx @@ -0,0 +1,30 @@ +import React, {Component} from 'react'; +import './InternalServerError.css'; +import '../../fonts/dos-vga-437-win.ttf'; + +class InternalServerError extends Component { + state = {}; + + componentDidMount() { + } + + + render() { + return ( +
+
+

A problem has been detected and the website has been shut down to prevent damage to your eyes and brain.

+

500 INTERNAL SERVER ERROR

+

If this is the first time you've seen this error screen, try reloading this page again in a day, a week or a year.

+

Technical Information:

+

*** Potato server got crashed

+

Contact (in case of emergency):

+

isohack.atc@gmail.com

+
+
+ + ); + } +} + +export default InternalServerError; \ No newline at end of file diff --git a/src/components/ErrorPages/PageNotFoundError.css b/src/components/ErrorPages/PageNotFoundError.css new file mode 100644 index 0000000..408fad1 --- /dev/null +++ b/src/components/ErrorPages/PageNotFoundError.css @@ -0,0 +1,15 @@ +.page-not-found-error-background { + position: absolute; + width: 100vw; + height: 100vh; + background-color: rgb(0, 125, 254); + color: white; +} + +.page-not-found-error-body { + margin: 0 10vw; +} + +.page-not-found-character { + font-size: 5rem; +} \ No newline at end of file diff --git a/src/components/ErrorPages/PageNotFoundError.jsx b/src/components/ErrorPages/PageNotFoundError.jsx new file mode 100644 index 0000000..e179554 --- /dev/null +++ b/src/components/ErrorPages/PageNotFoundError.jsx @@ -0,0 +1,23 @@ +import React, {Component} from 'react'; +import './PageNotFoundError.css'; + +class PageNotFoundError extends Component { + state = {}; + + componentDidMount() { + } + + render() { + return ( +
+
+

( ._.)

+

404 Page not found

+
+
+ + ); + } +} + +export default PageNotFoundError; \ No newline at end of file diff --git a/src/components/about.css b/src/components/about.css new file mode 100644 index 0000000..0fa8796 --- /dev/null +++ b/src/components/about.css @@ -0,0 +1,18 @@ +.about-body { + margin-left: 5vw; + margin-right: 5vw; +} + +.about-body-background { + background-image: linear-gradient(rgb(2, 36, 74), black); +} + +.about-header { + color: white; + font-weight: 800; +} + +.about-world { + margin: 5vw; + height: 30vw; +} \ No newline at end of file diff --git a/src/components/about.jsx b/src/components/about.jsx index a706cfc..367dfa4 100644 --- a/src/components/about.jsx +++ b/src/components/about.jsx @@ -1,16 +1,16 @@ import React from "react"; +import './about.css'; +import AboutWorld from "../img/about-world.png"; const About = () => (
-
+
-

About

+

Promising to give best user experience in hackathon

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad @@ -20,50 +20,10 @@ const About = () => ( pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

- Sed ut - perspiciatis unde omnis iste natus error sit voluptatem accusantium - doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo - inventore veritatis et quasi architecto beatae vitae dicta sunt - explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut - odit aut fugit, sed quia consequuntur magni dolores eos qui ratione - voluptatem sequi nesciunt. -

- Neque porro quisquam est, qui dolorem ipsum - quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam - eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat - voluptatem. -

- Ut enim ad minima veniam, quis nostrum exercitationem - ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi - consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate - velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum - fugiat quo voluptas nulla pariatur?

-
-
-
-

- Venue: Acropolis - Technical Campus -

-

-
-

- Date: February 7 - February 9, 2020 -

-
- -
-
-
- network +
+ world
diff --git a/src/components/faq.css b/src/components/faq.css new file mode 100644 index 0000000..b54c2fb --- /dev/null +++ b/src/components/faq.css @@ -0,0 +1,28 @@ +.fa { + margin-left: 50%; + margin-bottom: 5%; +} + +.faqback { + background: linear-gradient(-45deg, #f7997d, #4d59c7, #23a6d5, #23d5ab); + align-items: center; + justify-content: center; + margin: 0; + min-height: 100vh; + padding: 0; + position: relative; +} + +.faqtext { + font-family: Open Sans, sans-serif; + font-weight: bolder; + line-height: 1.3; +} + +.faqbody { + background: wheat; +} + +.imstyles { + margin-left: 25%; +} \ No newline at end of file diff --git a/src/components/faq.jsx b/src/components/faq.jsx new file mode 100644 index 0000000..dba585f --- /dev/null +++ b/src/components/faq.jsx @@ -0,0 +1,115 @@ +import React, {Component} from 'react'; +import ic from '../img/qa.png'; +import './faq.css'; +import M from "materialize-css"; +class Faq extends Component { + + componentDidMount(){ + document.addEventListener('DOMContentLoaded', function() { + var elems = document.querySelectorAll('.collapsible'); + M.Collapsible.init(elems, { + accordion: false + }); + }); + } + + render() + { + return( + +
+
+
+
+ faq +
+
+
+
+
+
+ At IsoHack, We encourage Teamwork and creativity.We Strive to bring together developers to participate + in the hackathon and innovate with full enthusiasm. + we work on motto of Eat-Code-Drink you just code else we took care of. +
+
+
+
+
+
    +
  • +
    addWho could participate
    +
    Anyone with enthusiam to code and passion to innovate.
    +
  • +
+
+
+
    +
  • +
    addHow Big a Team Can Be?
    +
    You could have max 4 members or you could submit
    +
  • +
+
+
+
+
+
    +
  • +
    addIs there any registraton fees?
    +
    No, there is no registration fees
    +
  • +
+
+
+
    +
  • +
    addWhat is the Code of Conduct
    +
    All you need to know
    +
  • +
+
+
+
+
+
    +
  • +
    addDo you provide accomodation?
    +
    Yes, you just need to pack your stuff and reach to us.
    +
  • +
+
+
+
    +
  • +
    addDo you provide travel reimbursement?
    +
    You can reach us at mailid
    +
  • +
+
+
+
+
+
    +
  • +
    addWhat are Perks of participating?
    +
    We have a big prize pool
    +
  • +
+
+
+
    +
  • +
    add404:Question Not Found
    +
    You can reach us at mailid
    +
  • +
+
+
+
+ + ); + } +} + +export default Faq; diff --git a/src/components/landingPage.jsx b/src/components/landingPage.jsx index ec71bef..7b84217 100644 --- a/src/components/landingPage.jsx +++ b/src/components/landingPage.jsx @@ -1,4 +1,4 @@ -import React, { Component } from "react"; +import React, {Component} from "react"; import "../css/landing.css"; import "../css/timeGradient.css"; import M from "materialize-css"; @@ -6,6 +6,7 @@ import Navbar from "./navbar"; import Footer from "./Footer"; import About from "./about"; import Schedule from "./schedule"; +import Faq from "./faq"; import LightGrass from "../img/light-grass.png"; import DarkGrass from "../img/dark-grass.png"; import Mountains from "../img/mountains.png"; @@ -18,6 +19,12 @@ import TestPage from "./TestPage"; import SimpleBar from 'simplebar-react'; import "../css/customScroll.css"; +import {getAppStatus} from '../services/hackathon'; + +import {connect} from 'react-redux'; +import {changeAppStatus} from "../actions"; +import Prizes from "./prizes"; + class LandingPage extends Component { state = { Tent: Tent, @@ -26,6 +33,14 @@ class LandingPage extends Component { componentDidMount() { M.AutoInit(); + getAppStatus().then((data) => { + this.props.changeAppStatus(data); + }).catch((err) => { + console.log(err); + M.toast({html: 'Error connecting to backend', classes: 'rounded'}); + // this.setState(() => { throw err; }); + }); + const currentDate = new Date(); const hours = currentDate.getHours(); const sky = document.getElementsByClassName("landing-sky")[0]; @@ -62,45 +77,61 @@ class LandingPage extends Component { }; render() { + const appStatus = this.props.appStatus; + let webapp_status; + if (appStatus === 'live') { + webapp_status = Live; + } else if (appStatus === 'maintenance') { + webapp_status = + Maintenance; + } else if (appStatus === 'down') { + webapp_status = Down; + } else if (appStatus === 'testing') { + webapp_status = Testing; + } else if (appStatus === 'offline'){ + webapp_status = Offline; + } return ( <> - - -
-
- IsoHack -

- This season, hack for a reason -

-
+ + +
+
+ IsoHack +

+ This season, hack for a reason +

+
- - - - - - - -
-
-
+ + + + + + + +
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
+ {webapp_status}
-
- + +
-