"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
/*
 *  This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
const directory_listing_1 = __importDefault(require("./directory-listing"));
const file_contents_1 = __importDefault(require("./file-contents"));
const loading_1 = __importDefault(require("./loading"));
function PathContents({ id, isdir, listing, content, relativePath, path, truncated, }) {
    if (isdir) {
        if (listing == null)
            return (0, jsx_runtime_1.jsx)(loading_1.default, { style: { fontSize: "30px" } });
        return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Truncated, { truncated: truncated }), (0, jsx_runtime_1.jsx)(directory_listing_1.default, { id: id, listing: listing, relativePath: relativePath })] }));
    }
    else {
        return ((0, jsx_runtime_1.jsxs)("div", { style: {
                padding: "20px 15px",
            }, children: [(0, jsx_runtime_1.jsx)(Truncated, { truncated: truncated }), (0, jsx_runtime_1.jsx)(file_contents_1.default, { id: id, content: content, path: path, relativePath: relativePath })] }));
    }
}
exports.default = PathContents;
const Truncated = ({ truncated }) => truncated == null ? null : (0, jsx_runtime_1.jsx)("h3", { children: truncated });
//# sourceMappingURL=path-contents.js.map