-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
427 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,8 @@ | |
- kkellybonilla | ||
- ciaracade | ||
- arelymartinez16 | ||
- efloresz | ||
- lianarosa | ||
- nicholasg2001 | ||
- nayoseph | ||
- savazques |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 108 additions & 0 deletions
108
apps/member-profile/app/routes/_profile.resume-books.$id.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Oops, something went wrong.