Skip to content

Commit

Permalink
PR suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal-Delange committed Dec 18, 2023
1 parent 6dc96fd commit bbcaec1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"i18n-ally.namespace": true,

"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},

"editor.formatOnSave": true,
Expand Down
13 changes: 8 additions & 5 deletions packages/app-builder/src/routes/ressources/cases/upload-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { type CaseDetail } from '@app-builder/models/cases';
import { useBackendInfo } from '@app-builder/services/auth/auth.client';
import { clientServices } from '@app-builder/services/init.client';
import { useNavigation, useRevalidator } from '@remix-run/react';
import * as Sentry from '@sentry/remix';
import clsx from 'clsx';
import { type Namespace } from 'i18next';
import { useEffect, useState } from 'react';
Expand All @@ -14,10 +15,10 @@ import { Button, Modal } from 'ui-design-system';
import { Attachment, Plus } from 'ui-icons';

export const handle = {
i18n: ['common', 'navigation', 'cases', ...casesI18n] satisfies Namespace,
i18n: ['common', 'navigation', ...casesI18n] satisfies Namespace,
};

const MAX_FILE_SIZE_MB = 20;
const MAX_FILE_SIZE_MB = 1;
const MAX_FILE_SIZE = MAX_FILE_SIZE_MB * 1024 * 1024;

export function UploadFile({ caseDetail }: { caseDetail: CaseDetail }) {
Expand Down Expand Up @@ -84,9 +85,10 @@ function UploadFileContent({

const onDrop = async (acceptedFiles: File[]) => {
if (acceptedFiles.length < 1) {
toastError(
`Please select a file of an accepted type and of size less than ${MAX_FILE_SIZE_MB} MB`,
);
toast.error('Please select a file');
// toastError(
// `Please select a file of an accepted type and of size less than ${MAX_FILE_SIZE_MB} MB`,
// );
return;
}
const file = acceptedFiles[0];
Expand All @@ -106,6 +108,7 @@ function UploadFileContent({
},
);
if (!response.ok) {
Sentry.captureException(response.text());
console.error(response);
toastError('An error occurred while trying to upload the file.');
return;
Expand Down
7 changes: 0 additions & 7 deletions packages/marble-api/scripts/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3166,15 +3166,8 @@ components:
- $ref: '#/components/schemas/CaseEventDto'
- type: object
required:
- resource_type
- resource_id
- additional_note
properties:
resource_type:
type: string
resource_id:
type: string
format: uuid
additional_note:
type: string
UpdateCaseBody:
Expand Down
2 changes: 0 additions & 2 deletions packages/marble-api/src/generated/marble-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ export type CaseTagsUpdatedEventDto = {
export type FileAddedEvent = {
event_type: "file_added";
} & CaseEventDtoBase & {
resource_type: string;
resource_id: string;
additional_note: string;
};
export type CaseEventDto = CaseCreatedEvent | CaseStatusUpdatedEvent | DecisionAddedEvent | CommentAddedEvent | NameUpdatedEvent | CaseTagsUpdatedEventDto | FileAddedEvent;
Expand Down

0 comments on commit bbcaec1

Please sign in to comment.