discourse/app/assets/javascripts/admin/addon/components/images-uploader.js
David Taylor 32665cf9dd
DEV: Consolidate i18n import paths (#29804)
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
2024-11-19 20:45:18 +00:00

28 lines
753 B
JavaScript

import Component from "@ember/component";
import { getOwner } from "@ember/owner";
import { tagName } from "@ember-decorators/component";
import UppyUpload from "discourse/lib/uppy/uppy-upload";
import { i18n } from "discourse-i18n";
@tagName("span")
export default class ImagesUploader extends Component {
uppyUpload = new UppyUpload(getOwner(this), {
id: "images-uploader",
type: "avatar",
validateUploadedFilesOptions: {
imagesOnly: true,
},
uploadDone: (upload) => {
this.done(upload);
},
});
get uploadingOrProcessing() {
return this.uppyUpload.uploading || this.uppyUpload.processing;
}
get uploadButtonText() {
return this.uploadingOrProcessing ? i18n("uploading") : i18n("upload");
}
}