<commit_before>import * as React from "react";
import {HBox, VBox} from "../react-ui/FlexBox";

import WeaveFileInfo = weavejs.net.beans.WeaveFileInfo;
import ReactUtils from "../utils/ReactUtils";

export interface IFileInfoViewProps extends React.Props<FileInfoView>
{
	fileInfo?:WeaveFileInfo;
	className:string;
}

export interface IFileInfoViewState
{
}

export default class FileInfoView extends React.Component<IFileInfoViewProps, IFileInfoViewState> {

	defaultProps:IFileInfoViewProps = {
		className: ""
	};

	constructor(props:IFileInfoViewProps)
	{
		super(props);
	}

	render():JSX.Element
	{
		let thumbnail:Blob = this.props.fileInfo && this.props.fileInfo.thumb && new Blob([this.props.fileInfo.thumb.data], { type: "image/jpeg" });
		var tableStyles = {
			table: { width: "100%", fontSize: "inherit"}
		};
		return (
			<VBox className={this.props.className} style={{flex: 1, alignItems: "center"}}>
				{ReactUtils.generateTable({
					body: [
						[
							Weave.lang("File"),
							this.props.fileInfo && this.props.fileInfo.fileName
						],
						[
							Weave.lang("Size"),
							this.props.fileInfo && this.props.fileInfo.fileSize
						],
						[
							Weave.lang("Modified"),
							this.props.fileInfo && this.props.fileInfo.lastModified
						]
					],
					classes: {
						td: [
							"weave-left-cell",
							"weave-right-cell"
						]
					},
					styles: tableStyles
				})}
				<div style={{marginTop: 25}}>
					{this.props.fileInfo && (thumbnail ? <img src={URL.createObjectURL(thumbnail)}/>:<div>{Weave.lang("Thumbnail Unavailable")}</div>)}
				</div>
				{this.props.children}
			</VBox>
		)
	}
}<commit_msg>WeaveFileInfo component for displaying file information<commit_after>import * as React from "react";
import {HBox, VBox} from "../react-ui/FlexBox";
import ReactUtils from "../utils/ReactUtils";
import FormatUtils from "../utils/FormatUtils";

import WeaveFileInfo = weavejs.net.beans.WeaveFileInfo;

export interface IFileInfoViewProps extends React.Props<FileInfoView>
{
	fileInfo?:WeaveFileInfo;
	className:string;
}

export interface IFileInfoViewState
{
}

export default class FileInfoView extends React.Component<IFileInfoViewProps, IFileInfoViewState> {

	defaultProps:IFileInfoViewProps = {
		className: ""
	};

	constructor(props:IFileInfoViewProps)
	{
		super(props);
	}

	render():JSX.Element
	{
		let thumbnail:Blob = this.props.fileInfo && this.props.fileInfo.thumb && new Blob([this.props.fileInfo.thumb.data], { type: "image/jpeg" });
		let date:Date = this.props.fileInfo && new Date(this.props.fileInfo.lastModified);
		var tableStyles = {
			table: { width: "100%", fontSize: "inherit"}
		};
		return (
			<VBox className={this.props.className} style={{flex: 1, alignItems: "center", justifyContent: "center"}}>
				{this.props.fileInfo ?
					<VBox style={{flex: 1, marginTop:"50%", alignItems: "center"}}>
						<VBox style={{flex: 1, display: "flex", justifyContent: "center"}}>
							{this.props.fileInfo && (thumbnail ? <img className="ui image" src={URL.createObjectURL(thumbnail)}/>:null)}
						</VBox>
						<div className="ui medium center aligned dividing icon header">
							{this.props.fileInfo && (thumbnail ? null:<i className="circular file outline icon" title={Weave.lang("Thumbnail Unavailable")}/>)}
							{this.props.fileInfo && this.props.fileInfo.fileName}
							<div className="sub header">
								{Weave.lang("Weave Session") + (this.props.fileInfo && (" - " + FormatUtils.defaultFileSizeFormatting(this.props.fileInfo.fileSize)))}
							</div>
						</div>
				</VBox>:<div/>}
				{this.props.fileInfo ?
					<VBox style={{flex:1, width: "100%", alignItems: "center", justifyContent: "space-between"}}>
						<div style={{flex:1}}>
							{this.props.fileInfo && (Weave.lang("Modified") + " " + FormatUtils.defaultFuzzyTimeAgo(date) + " " + Weave.lang("ago"))}
						</div>
						{this.props.children}
					</VBox>:<div/>
				}
			</VBox>
		)
	}
}
{'fraction_non_alphanumeric': 0.16067813765182187, 'fraction_numerical': 0.004807692307692308, 'mean_word_length': 3.774154589371981, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7118143', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1311, 'n_words': 235}