Skip to content

Commit

Permalink
Remove Wharton applications from user profile (and update branch) (#641)
Browse files Browse the repository at this point in the history
* Update main.ts

* Update frontend dependencies (#616)

Upgrade from Node 14 to Node 20 and bump frontend dependency versions to current.

---------

Co-authored-by: Julian Weng <julian.weng.us@gmail.com>

* Update README.md

* Update README backend instructions and intro blurb

* Fix admin page access on frontend. (#626)

Add frontend check for existing pre-loaded permissions on /admin.

* Removed deprecated QuestionResponse model and duplicate line (#625)

* Remove deprecated QuestionResponse model

* remove duplicate line: 'rank field in Club'

* made migrations after deleting QuestionResponse

* Streamline django storages config (#618)

* Add staticfiles

* Fix AWS bucket routing for boto

* Try setting credentials through env vars

* Try renaming env vars?

* Set AWS region

* add back staticfiles

* Remove region and signature version

* Move credentials to new API

* Use env variables and remove staticfiles

* Add back staticfiles

* Make code look pretty

---------

Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>

* Add hour to displayed application deadline (#628)

* Add hour for application due dates

* Make linter happy

* Specify Eastern time zone

* Display username if name is empty (#637)

* finished changes

* Remove Wharton applications from user profile

* Fix weird artifacts from merge

---------

Co-authored-by: Joy Liu <34288846+joyliu-q@users.noreply.github.com>
Co-authored-by: Julian Weng <julian.weng.us@gmail.com>
Co-authored-by: Rohan Moniz <60864468+rm03@users.noreply.github.com>
Co-authored-by: Thomas Ngulube <47449914+Porcupine1@users.noreply.github.com>
Co-authored-by: Owen Lester <owlester@sas.upenn.edu>
  • Loading branch information
6 people authored Mar 20, 2024
1 parent bbb55b5 commit f0ad4cb
Show file tree
Hide file tree
Showing 122 changed files with 9,540 additions and 10,356 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
uses: pennlabs/shared-actions/.github/workflows/react-check.yaml@v0.1
with:
path: frontend
nodeVersion: 20.11.1

build-backend:
name: Build backend
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
[![Build and Deploy](https://github.com/pennlabs/penn-clubs/workflows/Build%20and%20Deploy/badge.svg)](https://github.com/pennlabs/penn-clubs/actions)
[![Coverage Status](https://codecov.io/gh/pennlabs/penn-clubs/branch/master/graph/badge.svg)](https://codecov.io/gh/pennlabs/penn-clubs)

Official React-based website for Penn Labs' club directory and events listings.
The REST API written in Django for Penn Clubs infrastructure.
Official platform for club discovery, recruitment, and events at Penn.
React/Next.js frontend and Django-based REST API.

## Installation

You will need to start both the backend and the frontend to do Penn Clubs development.
You will need to start both the backend and the frontend to develop on Penn Clubs. Clubs supports Mac and Linux/WSL development.

Questions? Check out our [extended guide](https://github.com/pennlabs/penn-clubs/wiki/Development-Guide#windows-development) for FAQs for both Mac and Windows.
Questions? Check out our [extended guide](https://github.com/pennlabs/penn-clubs/wiki/Development-Guide) for FAQs.

### Backend

Running the backend requires [Python 3](https://www.python.org/downloads/).
Running the backend requires [Python 3.11](https://www.python.org/downloads/) and [Pipenv](https://pipenv.pypa.io/en/latest/).

In production, you will need to set the following environment variables:

Expand Down Expand Up @@ -42,13 +42,13 @@ dependencies, you can revisit later if not)
- `$ echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc`
- `$ export LDFLAGS="-L/usr/local/opt/openssl@3/lib"`
- `$ export CPPFLAGS="-I/usr/local/opt/openssl@3/include"`
- Windows
- Linux/WSL
- `$ apt-get install gcc python3-dev libpq-dev`

Now, you can run

- `$ pipenv install` to install Python dependencies. This may take a few
minutes. Optionally include the `--dev` argument if you are installing locally
minutes. Include the `--dev` argument if you are installing locally
for development. If you skipped installing `psycopg2` earlier, you might see
an error with locking -- this is expected!
- `$ pipenv shell`
Expand All @@ -63,8 +63,8 @@ Now, you can run
Running the frontend requires [Node.js](https://nodejs.org/en/) and
[Yarn](https://yarnpkg.com/getting-started/install).

**Please ensure you are using Node 14**. Our codebase does not support other
versions of Node (v14.21.3 is stable).
**Please ensure you are using Node 20**. Our codebase does not support other
versions of Node (v20.11.1 is stable).

You will need to set the following environment variables on the frontend:

Expand Down
16 changes: 16 additions & 0 deletions backend/clubs/migrations/0096_delete_questionresponse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 5.0.2 on 2024-03-06 01:23

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("clubs", "0095_rm_field_add_count"),
]

operations = [
migrations.DeleteModel(
name="QuestionResponse",
),
]
12 changes: 0 additions & 12 deletions backend/clubs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ class Club(models.Model):
# cache club rankings
rank = models.IntegerField(default=0)

# cache club rankings
rank = models.IntegerField(default=0)

created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)

Expand Down Expand Up @@ -1776,15 +1773,6 @@ class Meta:
unique_together = (("question", "submission"),)


class QuestionResponse(models.Model):
"""
Represents a response to a question on a custom application
"""

question = models.ForeignKey(ApplicationQuestion, on_delete=models.CASCADE)
response = models.TextField(blank=True)


@receiver(models.signals.pre_delete, sender=Asset)
def asset_delete_cleanup(sender, instance, **kwargs):
if instance.file:
Expand Down
2 changes: 1 addition & 1 deletion backend/clubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ def directory(self, request, *args, **kwargs):
@action(detail=False, methods=["get"])
def constitutions(self, request, *args, **kwargs):
"""
A special endpoint for SAC affilaited clubs to check if
A special endpoint for SAC affiliated clubs to check if
they have uploaded a club constitution.
---
operationId: List Club Constitutions
Expand Down
12 changes: 4 additions & 8 deletions backend/pennclubs/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@
# Upload file storage
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY")
AWS_STORAGE_BUCKET_NAME = os.getenv("AWS_STORAGE_BUCKET_NAME")
AWS_DEFAULT_ACL = "public-read"
AWS_QUERYSTRING_AUTH = False

STORAGES = {
"default": {
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"bucket_name": os.getenv("AWS_STORAGE_BUCKET_NAME"),
"default_acl": "public-read",
"querystring_auth": False,
},
},
"default": {"BACKEND": "storages.backends.s3boto3.S3Boto3Storage"},
"staticfiles": {"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage"},
}

Expand Down
24 changes: 9 additions & 15 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
{
"presets": [
"next/babel"
],
"plugins": [
"istanbul"
],
"env": {
"production": {
"plugins": [["styled-components", { "ssr": true }]]
},
"development": {
"plugins": [
"babel-plugin-styled-components"
]
}
"presets": ["next/babel"],
"plugins": ["istanbul"],
"env": {
"production": {
"plugins": [["styled-components", { "ssr": true }]]
},
"development": {
"plugins": ["babel-plugin-styled-components"]
}
}
}
1 change: 1 addition & 0 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
}
],
"no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports-ts": "error",
"camelcase": ["warn", { "ignoreDestructuring": true }],
Expand Down
12 changes: 6 additions & 6 deletions frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all"
"endOfLine": "lf",
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all"
}
10 changes: 3 additions & 7 deletions frontend/.storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"presets": [
"next/babel"
],
"plugins": [
"styled-components"
]
}
"presets": ["next/babel"],
"plugins": ["styled-components"]
}
8 changes: 6 additions & 2 deletions frontend/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
module.exports = {
stories: ['../components/**/*.stories.@(js|ts|mdx|tsx)'],
addons: ['@storybook/addon-actions/register', '@storybook/addon-links/register', '@storybook/addon-docs'],
stories: ['../components/**/*.stories.@(js|ts|mdx|tsx)'],
addons: [
'@storybook/addon-actions/register',
'@storybook/addon-links/register',
'@storybook/addon-docs',
],
}
4 changes: 2 additions & 2 deletions frontend/.storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.0/css/bulma.min.css"
integrity="sha256-aPeK/N8IHpHsvPBCf49iVKMdusfobKo2oxF8lRruWJg="
crossOrigin="anonymous"
crossorigin="anonymous"
/>
<!-- Fonts-->
<link
Expand Down Expand Up @@ -31,4 +31,4 @@
.prismjs .token.plain-text {
color: white;
}
</style>
</style>
38 changes: 19 additions & 19 deletions frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.next": true,
"**/.nyc_output": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/coverage": true
}
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/.next": true,
"**/.nyc_output": true
},
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true,
"**/coverage": true
}
}
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.14.0-buster-slim
FROM node:20.11.1-buster-slim

LABEL maintainer="Penn Labs"

Expand Down
49 changes: 24 additions & 25 deletions frontend/components/Applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const MainInfo = styled.div`
flex-direction: row;
`
type CardProps = {
readonly hovering?: boolean
readonly $hovering?: boolean
className?: string
}

Expand All @@ -63,7 +63,7 @@ const Card = styled.div<CardProps>`
transition: all ${ANIMATION_DURATION}ms ease;
border-radius: ${BORDER_RADIUS};
box-shadow: 0 0 0 ${WHITE};
background-color: ${({ hovering }) => (hovering ? HOVER_GRAY : WHITE)};
background-color: ${({ $hovering }) => ($hovering ? HOVER_GRAY : WHITE)};
border: 1px solid ${ALLBIRDS_GRAY};
justify-content: space-between;
height: auto;
Expand Down Expand Up @@ -105,35 +105,34 @@ function ApplicationsPage({ whartonapplications }): ReactElement {
{whartonapplications != null && whartonapplications.length > 0 ? (
whartonapplications.map((application) => (
<CardWrapper className={'column is-half-desktop'}>
<Link href={application.external_url}>
<a target="_blank">
<Card className="card">
<MainInfo>
<div>
<ClubName>{application.name}</ClubName>
<DateInterval
start={application.application_start_time}
end={application.application_end_time}
/>
</div>
<div>
{application.club_image_url != null &&
application.club_image_url !== '' && (
<LazyLoad>
<Image src={application.club_image_url} />
</LazyLoad>
)}
</div>
</MainInfo>
{application.description && application.description.length && (
<Link href={application.external_url} target="_blank">
<Card className="card">
<MainInfo>
<div>
<ClubName>{application.name}</ClubName>
<DateInterval
start={application.application_start_time}
end={application.application_end_time}
/>
</div>
<div>
{application.club_image_url != null &&
application.club_image_url !== '' && (
<LazyLoad>
<Image src={application.club_image_url} />
</LazyLoad>
)}
</div>
</MainInfo>
{application.description &&
application.description.length && (
<DescriptionWrapper
dangerouslySetInnerHTML={{
__html: application.description,
}}
></DescriptionWrapper>
)}
</Card>
</a>
</Card>
</Link>
</CardWrapper>
))
Expand Down
Loading

0 comments on commit f0ad4cb

Please sign in to comment.