Преглед на файлове

Fix `@uppy/unsplash` upload (#3272)

- Fix upload by calling `Provider.initPlugin` in the `@uppy/unsplash` class
- Tweak styling for author and file size in dashboard.

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Merlijn Vos преди 3 години
родител
ревизия
f6f07b164a

+ 1 - 1
packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.js

@@ -98,8 +98,8 @@ module.exports = function FileInfo (props) {
     >
       {renderFileName(props)}
       <div className="uppy-Dashboard-Item-status">
-        {renderFileSize(props)}
         {renderAuthor(props)}
+        {renderFileSize(props)}
         {ReSelectButton(props)}
         <ErrorButton
           file={props.file}

+ 1 - 0
packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.scss

@@ -24,6 +24,7 @@
   font-weight: normal;
   display: inline-block;
   line-height: 1;
+  margin-bottom: 5px;
 
   a {
     color: $gray-600;

+ 7 - 7
packages/@uppy/unsplash/src/index.js

@@ -1,6 +1,6 @@
 const { UIPlugin } = require('@uppy/core')
 const { h } = require('preact')
-const { SearchProvider } = require('@uppy/companion-client')
+const { SearchProvider, Provider } = require('@uppy/companion-client')
 const { SearchProviderViews } = require('@uppy/provider-views')
 
 /**
@@ -14,7 +14,9 @@ module.exports = class Unsplash extends UIPlugin {
     super(uppy, opts)
     this.id = this.opts.id || 'Unsplash'
     this.title = this.opts.title || 'Unsplash'
-    this.type = 'acquirer'
+
+    Provider.initPlugin(this, opts, {})
+
     this.icon = () => (
       <svg viewBox="0 0 32 32" height="32" width="32" aria-hidden="true">
         <path d="M46.575 10.883v-9h12v9zm12 5h10v18h-32v-18h10v9h12z" fill="#fff" />
@@ -23,14 +25,12 @@ module.exports = class Unsplash extends UIPlugin {
       </svg>
     )
 
-    const defaultOptions = {}
-    this.opts = { ...defaultOptions, ...opts }
-    this.hostname = this.opts.companionUrl
-
-    if (!this.hostname) {
+    if (!this.opts.companionUrl) {
       throw new Error('Companion hostname is required, please consult https://uppy.io/docs/companion')
     }
 
+    this.hostname = this.opts.companionUrl
+
     this.provider = new SearchProvider(uppy, {
       companionUrl: this.opts.companionUrl,
       companionHeaders: this.opts.companionHeaders,