diff --git a/packages/@uppy/locales/src/en_US.ts b/packages/@uppy/locales/src/en_US.ts index 3069e47602..2682160a08 100644 --- a/packages/@uppy/locales/src/en_US.ts +++ b/packages/@uppy/locales/src/en_US.ts @@ -35,6 +35,7 @@ en_US.strings = { aspectRatioPortrait: 'Crop portrait (9:16)', aspectRatioSquare: 'Crop square', authAborted: 'Authentication aborted', + authenticate: 'Connect', authenticateWith: 'Connect to %{pluginName}', authenticateWithTitle: 'Please authenticate with %{pluginName} to select files', @@ -149,14 +150,12 @@ en_US.strings = { pluginNameUrl: 'Link', pluginNameWebdav: 'WebDAV', pluginNameZoom: 'Zoom', + pluginWebdavInputLabel: 'WebDAV, ownCloud, or Nextcloud URL', poweredBy: 'Powered by %{uppy}', processingXFiles: { '0': 'Processing %{smart_count} file', '1': 'Processing %{smart_count} files', }, - publicLinkURLDescription: - 'WebDAV url or an ownCloud or Nextcloud public link', - publicLinkURLLabel: 'URL', recording: 'Recording', recordingLength: 'Recording length %{recording_length}', recordingStoppedMaxSize: diff --git a/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx b/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx index 72fc10dd47..f16af84d00 100644 --- a/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx +++ b/packages/@uppy/provider-views/src/GooglePicker/GooglePickerView.tsx @@ -202,7 +202,7 @@ export default function GooglePickerView({ } pluginIcon={pickerType === 'drive' ? GoogleDriveIcon : GooglePhotosIcon} handleAuth={showPicker} - i18n={uppy.i18nArray} + i18n={uppy.i18n} loading={loading} /> ) diff --git a/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx b/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx index 3a8d5c9377..103e85b596 100644 --- a/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx +++ b/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx @@ -1,7 +1,7 @@ import { h } from 'preact' import { useCallback } from 'preact/hooks' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' -import type Translator from '@uppy/utils/lib/Translator' +import type { I18n } from '@uppy/utils/lib/Translator' import type { Opts } from './ProviderView.ts' import type ProviderViews from './ProviderView.ts' @@ -9,7 +9,7 @@ type AuthViewProps = { loading: boolean | string pluginName: string pluginIcon: () => h.JSX.Element - i18n: Translator['translateArray'] + i18n: I18n handleAuth: ProviderViews['handleAuth'] renderForm?: Opts['renderAuthForm'] } @@ -56,7 +56,7 @@ function DefaultForm({ onAuth, }: { pluginName: string - i18n: Translator['translateArray'] + i18n: I18n onAuth: AuthViewProps['handleAuth'] }) { // In order to comply with Google's brand we need to create a different button @@ -100,7 +100,7 @@ const defaultRenderForm = ({ onAuth, }: { pluginName: string - i18n: Translator['translateArray'] + i18n: I18n onAuth: AuthViewProps['handleAuth'] }) => @@ -121,9 +121,7 @@ export default function AuthView({ })} -
- {renderForm({ pluginName, i18n, loading, onAuth: handleAuth })} -
+ {renderForm({ pluginName, i18n, loading, onAuth: handleAuth })} ) } diff --git a/packages/@uppy/provider-views/src/ProviderView/ProviderView.tsx b/packages/@uppy/provider-views/src/ProviderView/ProviderView.tsx index 8dc9ed28d2..dba9e2fb76 100644 --- a/packages/@uppy/provider-views/src/ProviderView/ProviderView.tsx +++ b/packages/@uppy/provider-views/src/ProviderView/ProviderView.tsx @@ -10,10 +10,10 @@ import type { } from '@uppy/core/lib/Uppy.js' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import type { CompanionFile } from '@uppy/utils/lib/CompanionFile' -import type Translator from '@uppy/utils/lib/Translator' import classNames from 'classnames' import type { ValidateableFile } from '@uppy/core/lib/Restricter.js' import remoteFileObjToLocal from '@uppy/utils/lib/remoteFileObjToLocal' +import type { I18n } from '@uppy/utils/lib/Translator' import AuthView from './AuthView.tsx' import Header from './Header.tsx' import Browser from '../Browser.tsx' @@ -75,7 +75,7 @@ export interface Opts { loadAllFiles: boolean renderAuthForm?: (args: { pluginName: string - i18n: Translator['translateArray'] + i18n: I18n loading: boolean | string onAuth: (authFormData: unknown) => Promise }) => h.JSX.Element @@ -434,7 +434,7 @@ export default class ProviderView { pluginName={this.plugin.title} pluginIcon={pluginIcon} handleAuth={this.handleAuth} - i18n={this.plugin.uppy.i18nArray} + i18n={this.plugin.uppy.i18n} renderForm={opts.renderAuthForm} loading={loading} /> diff --git a/packages/@uppy/provider-views/src/index.ts b/packages/@uppy/provider-views/src/index.ts index bdf3178237..98f6d95e9b 100644 --- a/packages/@uppy/provider-views/src/index.ts +++ b/packages/@uppy/provider-views/src/index.ts @@ -5,4 +5,6 @@ export { export { default as SearchProviderViews } from './SearchProviderView/index.ts' +export { default as SearchInput } from './SearchInput.tsx' + export { default as GooglePickerView } from './GooglePicker/GooglePickerView.tsx' diff --git a/packages/@uppy/webdav/src/Webdav.tsx b/packages/@uppy/webdav/src/Webdav.tsx index 89b1f91bd0..26be66387c 100644 --- a/packages/@uppy/webdav/src/Webdav.tsx +++ b/packages/@uppy/webdav/src/Webdav.tsx @@ -13,14 +13,20 @@ import { tokenStorage, type CompanionPluginOptions, } from '@uppy/companion-client' -import { defaultPickerIcon, ProviderViews } from '@uppy/provider-views' +import { + SearchInput, + defaultPickerIcon, + ProviderViews, +} from '@uppy/provider-views' import type { AsyncStore, UnknownProviderPluginState, Uppy, } from '@uppy/core/lib/Uppy.js' -import type Translator from '@uppy/utils/lib/Translator' +import type { I18n } from '@uppy/utils/lib/Translator' +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore We don't want TS to generate types for the package.json import packageJson from '../package.json' import locale from './locale.ts' @@ -50,49 +56,30 @@ class WebdavSimpleAuthProvider extends Provider< } const AuthForm = ({ - loading, i18n, onAuth, }: { - loading: boolean | string - i18n: Translator['translateArray'] + i18n: I18n onAuth: (arg: { webdavUrl: string }) => void }) => { const [webdavUrl, setWebdavUrl] = useState('') - const onSubmit = useCallback( - (e: Event) => { - e.preventDefault() - onAuth({ webdavUrl: webdavUrl.trim() }) - }, - [onAuth, webdavUrl], - ) + const onSubmit = useCallback(() => { + onAuth({ webdavUrl: webdavUrl.trim() }) + }, [onAuth, webdavUrl]) return ( -
- - - {i18n('publicLinkURLDescription')} - - - -
+ ) } @@ -150,8 +137,8 @@ export default class Webdav showTitles: true, showFilter: true, showBreadcrumbs: true, - renderAuthForm: ({ i18n, loading, onAuth }) => ( - + renderAuthForm: ({ i18n, onAuth }) => ( + ), }) diff --git a/packages/@uppy/webdav/src/locale.ts b/packages/@uppy/webdav/src/locale.ts index 414505937a..cfbed3aaa7 100644 --- a/packages/@uppy/webdav/src/locale.ts +++ b/packages/@uppy/webdav/src/locale.ts @@ -1,8 +1,7 @@ export default { strings: { pluginNameWebdav: 'WebDAV', - publicLinkURLLabel: 'URL', - publicLinkURLDescription: - 'WebDAV url or an ownCloud or Nextcloud public link', + authenticate: 'Connect', + pluginWebdavInputLabel: 'WebDAV, ownCloud, or Nextcloud URL', }, }