Skip to content

Commit

Permalink
Upgrade frontend dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Oct 1, 2023
1 parent 317a5c7 commit b48caa9
Show file tree
Hide file tree
Showing 67 changed files with 6,290 additions and 9,544 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ repos:
require_serial: true
files: ^backend/
args: [--config, backend/setup.cfg]
- id: frontend
name: Yarn Linter
entry: yarn --cwd frontend lint
language: system
files: ^frontend/
require_serial: false
pass_filenames: false
# - id: frontend
# name: Yarn Linter
# entry: yarn --cwd frontend lint
# language: system
# files: ^frontend/
# require_serial: false
# pass_filenames: false
45 changes: 22 additions & 23 deletions frontend/components/Applications.tsx
Original file line number Diff line number Diff line change
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
69 changes: 30 additions & 39 deletions frontend/components/ClubCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,55 +97,46 @@ type ClubCardProps = {
}

const ClubCard = ({ club, fullWidth }: ClubCardProps): ReactElement => {
const {
name,
active,
approved,
subtitle,
tags,
enables_subscription,
code,
} = club
const { name, active, approved, subtitle, tags, enables_subscription, code } =
club
const img = club.image_url
const textDescription = shorten(subtitle || 'This club has no description.')

return (
<CardWrapper className={fullWidth ? '' : 'column is-half-desktop'}>
<Link href={CLUB_ROUTE()} as={CLUB_ROUTE(code)}>
<a target="_blank">
<Card className="card">
<div style={{ display: 'flex' }}>
<div style={{ flex: 1 }}>
<div>
<CardHeader>
<CardTitle className="is-size-5">{name}</CardTitle>
</CardHeader>
</div>
{!active && (
<InactiveTag className="tag is-rounded">Inactive</InactiveTag>
)}
{approved === null && (
<InactiveTag className="tag is-rounded">
Pending Approval
</InactiveTag>
)}
{approved === false && (
<InactiveTag className="tag is-rounded">Rejected</InactiveTag>
)}
<TagGroup tags={tags} />
<Link href={CLUB_ROUTE()} as={CLUB_ROUTE(code)} target="_blank">
<Card className="card">
<div style={{ display: 'flex' }}>
<div style={{ flex: 1 }}>
<div>
<CardHeader>
<CardTitle className="is-size-5">{name}</CardTitle>
</CardHeader>
</div>
{img && (
<LazyLoad height={62} offset={800}>
<Image src={img} alt={`${name} Logo`} />
</LazyLoad>
{!active && (
<InactiveTag className="tag is-rounded">Inactive</InactiveTag>
)}
{approved === null && (
<InactiveTag className="tag is-rounded">
Pending Approval
</InactiveTag>
)}
{approved === false && (
<InactiveTag className="tag is-rounded">Rejected</InactiveTag>
)}
<TagGroup tags={tags} />
</div>
{img && (
<LazyLoad height={62} offset={800}>
<Image src={img} alt={`${name} Logo`} />
</LazyLoad>
)}
</div>

<Description>{textDescription}</Description>
<Description>{textDescription}</Description>

<ClubDetails club={club} />
</Card>
</a>
<ClubDetails club={club} />
</Card>
</Link>
</CardWrapper>
)
Expand Down
11 changes: 4 additions & 7 deletions frontend/components/ClubEditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,10 @@ const ClubForm = ({
<Link
href={isViewButton ? CLUB_ROUTE() : HOME_ROUTE}
as={isViewButton && club ? CLUB_ROUTE(club.code) : HOME_ROUTE}
className="button is-pulled-right is-secondary is-medium"
style={{ fontWeight: 'normal' }}
>
<a
className="button is-pulled-right is-secondary is-medium"
style={{ fontWeight: 'normal' }}
>
{isViewButton ? `View ${OBJECT_NAME_TITLE_SINGULAR}` : 'Back'}
</a>
{isViewButton ? `View ${OBJECT_NAME_TITLE_SINGULAR}` : 'Back'}
</Link>
}
</InfoPageTitle>
Expand All @@ -410,7 +407,7 @@ const ClubForm = ({
<b>Before creating your {OBJECT_NAME_SINGULAR},</b> please check to{' '}
see if it already exists on the{' '}
<Link href={DIRECTORY_ROUTE} as={DIRECTORY_ROUTE}>
<a>directory page</a>
directory page
</Link>
. If your {OBJECT_NAME_SINGULAR} already exists, please email{' '}
<Contact /> to gain access instead of filling out this form.
Expand Down
16 changes: 6 additions & 10 deletions frontend/components/ClubEditPage/ApplicationsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,12 @@ const ApplicationModal = (props: {
committeeChoices,
} = props
// TODO: I'm positive that this is something that Formik should do for me
const [
questionType,
setQuestionType,
] = useState<ApplicationQuestionType | null>()
const [multipleChoices, setMultipleChoices] = useState<
[{ label: string; value: string }]
>()
const [committees, setCommittees] = useState<
[{ label: string; value: string }]
>()
const [questionType, setQuestionType] =
useState<ApplicationQuestionType | null>()
const [multipleChoices, setMultipleChoices] =
useState<[{ label: string; value: string }]>()
const [committees, setCommittees] =
useState<[{ label: string; value: string }]>()
const [committeeQuestion, setCommitteeQuestion] = useState<boolean>()

const validateWordCount = (value) => {
Expand Down
30 changes: 12 additions & 18 deletions frontend/components/ClubEditPage/ApplicationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -369,20 +369,16 @@ export default function ApplicationsPage({
club: Club
}): ReactElement {
const [applications, setApplications] = useState<Array<Application>>([])
const [
currentApplication,
setCurrentApplication,
] = useState<Application | null>(null)
const [currentApplication, setCurrentApplication] =
useState<Application | null>(null)
const [submissions, setSubmissions] = useState<{
[key: number]: Array<ApplicationSubmission>
}>([])
const [showModal, setShowModal] = useState<boolean>(false)
const [showNotifModal, setShowNotifModal] = useState<boolean>(false)
const [showReasonModal, setShowReasonModal] = useState<boolean>(false)
const [
currentSubmission,
setCurrentSubmission,
] = useState<ApplicationSubmission | null>(null)
const [currentSubmission, setCurrentSubmission] =
useState<ApplicationSubmission | null>(null)
const [pageIndex, setPageIndex] = useState<number>(0)
const [statusToggle, setStatusToggle] = useState<boolean>(false)
const [categoriesSelectAll, setCategoriesSelectAll] = useState<Array<string>>(
Expand Down Expand Up @@ -574,7 +570,7 @@ export default function ApplicationsPage({
{
method: 'POST',
body: {
status: status,
status,
submissions: selectedSubmissions,
},
},
Expand Down Expand Up @@ -608,9 +604,8 @@ export default function ApplicationsPage({
categoriesSelectAll.includes(statusLabel)

if (deselecting) {
const newCategoriesSelectAll = categoriesSelectAll.filter(
(e) => e !== statusLabel,
)
const newCategoriesSelectAll =
categoriesSelectAll.filter((e) => e !== statusLabel)
setCategoriesSelectAll(newCategoriesSelectAll)
} else {
const newCategoriesSelectAll = categoriesSelectAll
Expand Down Expand Up @@ -673,12 +668,11 @@ export default function ApplicationsPage({
<ScrollWrapper>
<TableWrapper>
<Table
data={submissions[
currentApplication.id
].map((item, index) =>
item.pk
? { ...item, id: item.pk }
: { ...item, id: index },
data={submissions[currentApplication.id].map(
(item, index) =>
item.pk
? { ...item, id: item.pk }
: { ...item, id: index },
)}
columns={responseTableFields}
searchableColumns={['name']}
Expand Down
57 changes: 25 additions & 32 deletions frontend/components/ClubEditPage/ClubEditCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,29 +195,25 @@ export default function ClubEditCard({
),
)

const [
showSchoolYearProgramming,
setSchoolYearProgramming,
] = useState<boolean>(
!!(
club.target_majors?.length ||
club.target_schools?.length ||
club.target_years?.length ||
club.student_types?.length
),
)
const [showSchoolYearProgramming, setSchoolYearProgramming] =
useState<boolean>(
!!(
club.target_majors?.length ||
club.target_schools?.length ||
club.target_years?.length ||
club.student_types?.length
),
)

const [
showStudentTypeProgramming,
setStudentTypeProgramming,
] = useState<boolean>(
!!(
club.target_majors?.length ||
club.target_schools?.length ||
club.target_years?.length ||
club.student_types?.length
),
)
const [showStudentTypeProgramming, setStudentTypeProgramming] =
useState<boolean>(
!!(
club.target_majors?.length ||
club.target_schools?.length ||
club.target_years?.length ||
club.student_types?.length
),
)

const [showSchoolProgramming, setSchoolProgramming] = useState<boolean>(
!!(
Expand All @@ -243,10 +239,10 @@ export default function ClubEditCard({
)

// sorry ts
const exclusives = (categorizeFilter(
const exclusives = categorizeFilter(
exclusiveEntries,
([key]) => key.match(/^exclusive:(.+?):(.+?)$/)?.[1] ?? 'unknown',
) as unknown) as {
) as unknown as {
year: Array<[string, { checked?: boolean; detail?: string }]>
// major: Array<[string, { checked?: boolean; detail?: string }]>
student_type: Array<[string, { checked?: boolean; detail?: string }]>
Expand Down Expand Up @@ -496,8 +492,7 @@ export default function ClubEditCard({
label: 'Location',
required: false,
type: 'location',
help:
'Remember, this will be available to the public. Please only include information you feel comfortable sharing.',
help: 'Remember, this will be available to the public. Please only include information you feel comfortable sharing.',
},
{
name: 'email',
Expand Down Expand Up @@ -556,11 +551,8 @@ export default function ClubEditCard({
description: SHOW_RANK_ALGORITHM ? (
<Text>
Some of these fields will be used to adjust {OBJECT_NAME_SINGULAR}{' '}
ordering on the home page. Click{' '}
<Link href="/rank">
<a>here</a>
</Link>{' '}
for more details.
ordering on the home page. Click <Link href="/rank">here</Link> for
more details.
</Text>
) : (
<Text>
Expand Down Expand Up @@ -865,7 +857,8 @@ export default function ClubEditCard({
image: FileField,
address: FormikAddressField,
checkboxText: CheckboxTextField,
creatableMultiSelect: CreatableMultipleSelectField,
creatableMultiSelect:
CreatableMultipleSelectField,
}[props.type] ?? TextField
}
{...other}
Expand Down
3 changes: 2 additions & 1 deletion frontend/components/ClubEditPage/ClubFairCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ const ClubFairCard = ({
as={
CLUB_EDIT_ROUTE(item.club.code) + '/settings'
}
className="button is-small"
>
<a className="button is-small">Register</a>
Register
</Link>
</td>
</tr>
Expand Down
10 changes: 6 additions & 4 deletions frontend/components/ClubEditPage/ClubManagementCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@ const ClubManagementCard = ({
{clubs.map((club) => (
<div className="panel-block is-clearfix">
{club.name}{' '}
<Link href={CLUB_ROUTE(club.code)}>
<a className="ml-2" target="_blank">
<Icon name="external-link" />
</a>
<Link
href={CLUB_ROUTE(club.code)}
className="ml-2"
target="_blank"
>
<Icon name="external-link" />
</Link>
<div style={{ marginLeft: 'auto' }}>
<button
Expand Down
Loading

0 comments on commit b48caa9

Please sign in to comment.