Skip to content

Commit 876bcf2

Browse files
committed
Refactor file types to use them globally
1 parent a2aad3c commit 876bcf2

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/components/content-tab-import-export.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { sprintf, __ } from '@wordpress/i18n';
44
import { Icon, download } from '@wordpress/icons';
55
import { useI18n } from '@wordpress/react-i18n';
66
import { useRef } from 'react';
7-
import { STUDIO_DOCS_URL_IMPORT_EXPORT } from '../constants';
7+
import { ACCEPTED_IMPORT_FILE_TYPES, STUDIO_DOCS_URL_IMPORT_EXPORT } from '../constants';
88
import { useConfirmationDialog } from '../hooks/use-confirmation-dialog';
99
import { useDragAndDropFile } from '../hooks/use-drag-and-drop-file';
1010
import { useImportExport } from '../hooks/use-import-export';
@@ -233,7 +233,7 @@ const ImportSite = ( props: { selectedSite: SiteDetails } ) => {
233233
className="hidden"
234234
type="file"
235235
data-testid="backup-file"
236-
accept=".zip,.sql,.tar,.gz,.wpress"
236+
accept={ `${ ACCEPTED_IMPORT_FILE_TYPES.join( ',' ) },.sql` }
237237
onChange={ onFileSelected }
238238
/>
239239
</div>

‎src/components/site-form.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n';
44
import { tip, warning, trash, chevronRight, chevronDown, chevronLeft } from '@wordpress/icons';
55
import { useI18n } from '@wordpress/react-i18n';
66
import { FormEvent, useRef, useState } from 'react';
7-
import { STUDIO_DOCS_URL_IMPORT_EXPORT } from '../constants';
7+
import { ACCEPTED_IMPORT_FILE_TYPES, STUDIO_DOCS_URL_IMPORT_EXPORT } from '../constants';
88
import { cx } from '../lib/cx';
99
import { getIpcApi } from '../lib/get-ipc-api';
1010
import Button from './button';
@@ -192,7 +192,7 @@ function FormImportComponent( {
192192
className="hidden"
193193
type="file"
194194
data-testid="backup-file"
195-
accept=".zip,.tar,.gz,.wpress"
195+
accept={ ACCEPTED_IMPORT_FILE_TYPES.join( ',' ) }
196196
onChange={ handleFileChange }
197197
/>
198198
</div>

‎src/constants.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const CHAT_MESSAGES_STORE_KEY = 'ai_chat_messages';
2525

2626
//Import file constants
2727

28-
export const ACCEPTED_IMPORT_FILE_TYPES = [ '.zip', '.gz', '.gzip', '.tar', '.tar.gz' ];
28+
export const ACCEPTED_IMPORT_FILE_TYPES = [ '.zip', '.gz', '.gzip', '.tar', '.tar.gz', '.wpress' ];
2929

3030
// OAuth constants
3131
export const CLIENT_ID = '95109';

0 commit comments

Comments
 (0)