Skip to content

Commit

Permalink
Merge branch 'main' into ticket-317
Browse files Browse the repository at this point in the history
  • Loading branch information
jessherlitz authored Jul 13, 2024
2 parents 8d63ebc + 4999e06 commit 69cb85a
Show file tree
Hide file tree
Showing 27 changed files with 427 additions and 32 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/auto-author-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Author Assign

on:
pull_request_target:
types: [opened, reopened]

permissions:
pull-requests: write

jobs:
assign-author:
runs-on: ubuntu-latest
steps:
- uses: toshimaru/[email protected]
5 changes: 5 additions & 0 deletions CONTRIBUTORS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@
- kkellybonilla
- ciaracade
- arelymartinez16
- efloresz
- lianarosa
- nicholasg2001
- nayoseph
- savazques
29 changes: 16 additions & 13 deletions apps/admin-dashboard/app/routes/_dashboard.applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function ApplicationsTable() {

const columns: TableColumnProps<ApplicationInView>[] = [
{
displayName: 'First Name',
displayName: 'Full Name',
render: (application) => {
return (
<Link
Expand All @@ -148,16 +148,11 @@ function ApplicationsTable() {
search,
}}
>
{application.firstName}
{application.firstName} {application.lastName}
</Link>
);
},
size: '200',
},
{
displayName: 'Last Name',
size: '200',
render: (application) => application.lastName,
size: '280',
},
{
displayName: 'Email',
Expand All @@ -183,16 +178,24 @@ function ApplicationsTable() {
},
size: '160',
},
{
displayName: 'School',
size: '360',
render: (application) => application.school || '-',
},
{
displayName: 'Applied On',
size: '240',
render: (application) => application.createdAt,
},
{
displayName: 'Reviewed By',
size: '280',
render: (application) => {
const { reviewedByFirstName, reviewedByLastName } = application;

if (!reviewedByFirstName) {
return '-';
}

return `${reviewedByFirstName} ${reviewedByLastName}`;
},
},
];

return (
Expand Down
1 change: 1 addition & 0 deletions apps/member-profile/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ STUDENT_PROFILE_URL=http://localhost:3000

# Optional for development, but won't be able to run certain features...

# AIRTABLE_API_KEY=
# CRUNCHBASE_BASIC_API_KEY=
# GITHUB_OAUTH_CLIENT_ID=
# GITHUB_OAUTH_CLIENT_SECRET=
Expand Down
53 changes: 49 additions & 4 deletions apps/member-profile/app/routes/_profile.companies_.$id.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import {
listCompanyReviews,
} from '@oyster/core/employment.server';
import { cx, Divider, getTextCn, ProfilePicture, Text } from '@oyster/ui';
import {
Tooltip,
TooltipContent,
TooltipText,
TooltipTrigger,
} from '@oyster/ui/tooltip';

import { Card } from '@/shared/components/card';
import { CompanyReview } from '@/shared/components/company-review';
Expand All @@ -37,6 +43,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
'companies.id',
'companies.imageUrl',
'companies.name',
'companies.levelsFyiSlug',
],
where: { id },
}),
Expand All @@ -63,6 +70,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
'workExperiences.locationType',
'workExperiences.startDate',
'workExperiences.title',
'workExperiences.id as workExperienceId',
],
where: { companyId: id, memberId: user(session) },
}),
Expand Down Expand Up @@ -103,6 +111,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
return {
...review,
date: `${startMonth} - ${endMonth}`,
editable: review.reviewerId === user(session),
reviewedAt: dayjs().to(createdAt),
};
}
Expand Down Expand Up @@ -130,9 +139,15 @@ export default function CompanyPage() {
</div>

<div>
<Text variant="2xl" weight="500">
{company.name}
</Text>
<div className="flex items-center gap-2">
<Text variant="2xl" weight="500">
{company.name}
</Text>

{company.levelsFyiSlug && (
<LevelsFyiLink slug={company.levelsFyiSlug} />
)}
</div>

<DomainLink domain={company.domain} />
</div>
Expand Down Expand Up @@ -166,6 +181,34 @@ function DomainLink({ domain }: Pick<CompanyInView, 'domain'>) {
);
}

type LevelsFyiLinkProps = {
slug: string;
};

function LevelsFyiLink({ slug }: LevelsFyiLinkProps) {
return (
<Tooltip>
<TooltipTrigger asChild>
<a
className="mt-1"
href={`https://www.levels.fyi/companies/${slug}/salaries`}
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Levels.fyi Logo"
className="h-4 w-4 cursor-pointer rounded-sm hover:opacity-90"
src="/images/levels-fyi.png"
/>
</a>
</TooltipTrigger>
<TooltipContent>
<TooltipText>View Salary Information on Levels.fyi</TooltipText>
</TooltipContent>
</Tooltip>
);
}

function AverageRating({
averageRating,
}: Pick<CompanyInView, 'averageRating'>) {
Expand All @@ -174,7 +217,7 @@ function AverageRating({
}

return (
<div className="ml-auto mt-auto">
<div className="ml-auto">
<Text>
<span className="text-2xl">{averageRating}</span>/10
</Text>
Expand Down Expand Up @@ -208,6 +251,7 @@ function ReviewsList() {
name: review.companyName || '',
}}
date={review.date}
editable={review.editable}
employmentType={review.employmentType as EmploymentType}
locationCity={review.locationCity}
locationState={review.locationState}
Expand All @@ -223,6 +267,7 @@ function ReviewsList() {
title={review.title || ''}
upvotes={review.upvotes}
upvoted={review.upvoted as boolean}
workExperienceId={review.workExperienceId || ''}
/>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ export async function action({ request }: ActionFunctionArgs) {
return json({ errors }, { status: 400 });
}

if (data.addressState === 'PR') {
return json({
error: `Unfortunately, our swag pack provider, SwagUp, does not support shipments to Puerto Rico. Please reach out to [email protected] for further assistance.`,
errors,
});
}

try {
await claimSwagPack({
addressCity: data.addressCity,
Expand Down
5 changes: 4 additions & 1 deletion apps/member-profile/app/routes/_profile.resources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import dayjs from 'dayjs';
import { Plus } from 'react-feather';

import { isMemberAdmin } from '@oyster/core/admin.server';
import {
ListResourcesOrderBy,
ListResourcesWhere,
Expand Down Expand Up @@ -50,6 +51,8 @@ const ResourcesSearchParams = ListSearchParams.pick({
export async function loader({ request }: LoaderFunctionArgs) {
const session = await ensureUserAuthenticated(request);

const isAdmin = await isMemberAdmin(user(session));

const url = new URL(request.url);

const searchParams = ResourcesSearchParams.parse({
Expand Down Expand Up @@ -113,7 +116,7 @@ export async function loader({ request }: LoaderFunctionArgs) {

// If the logged-in member is the poster of the resource, they should
// be able to edit the resource.
editable: record.posterId === user(session),
editable: record.posterId === user(session) || isAdmin,

// This is a relative time of when the resource was posted,
// ie: "2d" (2 days ago).
Expand Down
108 changes: 108 additions & 0 deletions apps/member-profile/app/routes/_profile.resume-books.$id.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import {
type ActionFunctionArgs,
unstable_composeUploadHandlers as composeUploadHandlers,
unstable_createFileUploadHandler as createFileUploadHandler,
unstable_createMemoryUploadHandler as createMemoryUploadHandler,
json,
type LoaderFunctionArgs,
unstable_parseMultipartFormData as parseMultipartFormData,
redirect,
} from '@remix-run/node';
import { generatePath, Form as RemixForm } from '@remix-run/react';

import { SubmitResumeInput } from '@oyster/core/resume-books';
import { submitResume } from '@oyster/core/resume-books.server';
import { Button, Form, validateForm } from '@oyster/ui';

import { Route } from '@/shared/constants';
import {
commitSession,
ensureUserAuthenticated,
toast,
user,
} from '@/shared/session.server';

export async function loader({ request }: LoaderFunctionArgs) {
await ensureUserAuthenticated(request);

return json({});
}

export async function action({ params, request }: ActionFunctionArgs) {
const session = await ensureUserAuthenticated(request);

const uploadHandler = composeUploadHandlers(
createFileUploadHandler({ maxPartSize: 1_000_000 * 1 }),
createMemoryUploadHandler()
);

let form: FormData;

try {
form = await parseMultipartFormData(request, uploadHandler);
} catch (e) {
return json(
{
errors: {
resume: 'Attachment is too big. Must be less than 1 MB in size.',
} as Record<keyof SubmitResumeInput, string>,
},
{
status: 400,
}
);
}

const resumeBookId = params.id as string;

form.set('memberId', user(session));
form.set('resumeBookId', resumeBookId);

const { data, errors, ok } = await validateForm(form, SubmitResumeInput);

if (!ok) {
return json({ errors }, { status: 400 });
}

await submitResume({
memberId: data.memberId,
resume: data.resume,
resumeBookId: data.resumeBookId,
});

toast(session, {
message: 'Resume submitted!',
type: 'success',
});

return redirect(
generatePath(Route['/resume-books/:id'], { id: resumeBookId }),
{
headers: {
'Set-Cookie': await commitSession(session),
},
}
);
}

export default function ResumeBook() {
return (
<RemixForm className="form" method="post" encType="multipart/form-data">
<Form.Field
description="Must be a PDF less than 1 MB."
error=""
label="Resume"
labelFor="resume"
required
>
<input accept=".pdf" id="resume" name="resume" required type="file" />
</Form.Field>

<Form.ErrorMessage></Form.ErrorMessage>

<Button.Group>
<Button.Submit>Submit</Button.Submit>
</Button.Group>
</RemixForm>
);
}
Loading

0 comments on commit 69cb85a

Please sign in to comment.