"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
/* @flow */
const react_1 = __importStar(require("react"));
const react_dropzone_1 = __importDefault(require("react-dropzone"));
const ErrorBoundary_1 = __importDefault(require("components/hoc/ErrorBoundary"));
const react_2 = require("@lingui/react");
class Accept extends react_1.Component {
    constructor() {
        super(...arguments);
        this.state = {
            accepted: [],
            rejected: [],
        };
    }
    render() {
        return (react_1.default.createElement(ErrorBoundary_1.default, null,
            react_1.default.createElement("section", null,
                react_1.default.createElement("div", { className: "dropzone" },
                    react_1.default.createElement(react_dropzone_1.default, { ref: (node) => {
                            this.dropzoneRef = node;
                        }, accept: "image/jpeg, image/png", onDrop: (accepted, rejected) => {
                            this.setState({ accepted, rejected });
                        } },
                        react_1.default.createElement("p", null,
                            react_1.default.createElement(react_2.Trans, null, "Try dropping some files here, or click to select files to upload.")),
                        react_1.default.createElement("p", null,
                            react_1.default.createElement(react_2.Trans, null, "Only *.jpeg and *.png images will be accepted")))),
                react_1.default.createElement("aside", null,
                    react_1.default.createElement("h2", null,
                        react_1.default.createElement(react_2.Trans, null, "Accepted files")),
                    react_1.default.createElement("ul", null, this.state.accepted.map(f => (react_1.default.createElement("li", { key: f.name },
                        f.name,
                        " - ",
                        f.size,
                        " bytes")))),
                    react_1.default.createElement("h2", null,
                        react_1.default.createElement(react_2.Trans, null, "Rejected files")),
                    react_1.default.createElement("ul", null, this.state.rejected.map(f => (react_1.default.createElement("li", { key: f.name },
                        f.name,
                        " - ",
                        f.size,
                        " bytes"))))),
                react_1.default.createElement("button", { type: "button", onClick: () => {
                        this.dropzoneRef.open();
                    } },
                    react_1.default.createElement(react_2.Trans, null, "Open File Dialog")))));
    }
}
exports.default = Accept;
//# sourceMappingURL=index.js.map