Skip to content

Commit

Permalink
convert rest of type="file"
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiAbdou committed Jul 25, 2024
1 parent 0c3892e commit c099607
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 18 deletions.
14 changes: 10 additions & 4 deletions apps/admin-dashboard/app/routes/_dashboard.events.$id.import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ import { z } from 'zod';

import { db } from '@oyster/db';
import { Email, EventAttendee } from '@oyster/types';
import { Button, Form, getErrors, Modal, validateForm } from '@oyster/ui';
import {
Button,
FileUploader,
Form,
getErrors,
Modal,
validateForm,
} from '@oyster/ui';
import { id } from '@oyster/utils';

import { getEvent, job, parseCsv } from '@/admin-dashboard.server';
Expand Down Expand Up @@ -181,12 +188,11 @@ function ImportEventAttendeesForm() {
return (
<RemixForm className="form" method="post" encType="multipart/form-data">
<Form.Field error={errors.file} labelFor={keys.file} required>
<input
accept=".csv"
<FileUploader
accept={['text/csv']}
id={keys.file}
name={keys.file}
required
type="file"
/>
</Form.Field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { db } from '@oyster/db';
import { Email, Program, ProgramParticipant } from '@oyster/types';
import {
Button,
FileUploader,
Form,
getErrors,
Modal,
Expand Down Expand Up @@ -211,12 +212,11 @@ function ImportProgramsForm() {
labelFor={keys.file}
required
>
<input
accept=".csv"
<FileUploader
accept={['text/csv']}
id={keys.file}
name={keys.file}
required
type="file"
/>
</Form.Field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { db } from '@oyster/db';
import { Email, Resource, ResourceUser } from '@oyster/types';
import {
Button,
FileUploader,
Form,
getErrors,
Modal,
Expand Down Expand Up @@ -230,12 +231,11 @@ function ImportResourcesForm() {
labelFor={keys.file}
required
>
<input
accept=".csv"
<FileUploader
accept={['text/csv']}
id={keys.file}
name={keys.file}
required
type="file"
/>
</Form.Field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ import {
ScholarshipRecipient,
type ScholarshipType,
} from '@oyster/types';
import { Button, Form, getErrors, Modal, validateForm } from '@oyster/ui';
import {
Button,
FileUploader,
Form,
getErrors,
Modal,
validateForm,
} from '@oyster/ui';
import { id } from '@oyster/utils';

import { parseCsv } from '@/admin-dashboard.server';
Expand Down Expand Up @@ -202,12 +209,11 @@ function ImportScholarshipsForm() {
labelFor={keys.file}
required
>
<input
accept=".csv"
<FileUploader
accept={['text/csv']}
id={keys.file}
name={keys.file}
required
type="file"
/>
</Form.Field>

Expand Down
14 changes: 10 additions & 4 deletions apps/admin-dashboard/app/routes/_dashboard.surveys.$id.import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import {
import { z } from 'zod';

import { db } from '@oyster/db';
import { Button, Form, getErrors, Modal, validateForm } from '@oyster/ui';
import {
Button,
FileUploader,
Form,
getErrors,
Modal,
validateForm,
} from '@oyster/ui';

import { importSurveyResponses } from '@/admin-dashboard.server';
import { Route } from '@/shared/constants';
Expand Down Expand Up @@ -118,12 +125,11 @@ function ImportSurveyResponsesForm() {
return (
<RemixForm className="form" method="post" encType="multipart/form-data">
<Form.Field error={errors.file} labelFor={keys.file} required>
<input
accept=".csv"
<FileUploader
accept={['text/csv']}
id={keys.file}
name={keys.file}
required
type="file"
/>
</Form.Field>

Expand Down

0 comments on commit c099607

Please sign in to comment.