aboutsummaryrefslogtreecommitdiff
path: root/src/Post.js
diff options
context:
space:
mode:
authorLibravatar Renard 2019-09-16 01:22:56 -0300
committerLibravatar Renard 2019-09-16 01:22:56 -0300
commitcd9b802b71df4e2701e2311b2995fe70a9692ae4 (patch)
tree5555330f1ffb249e3b2f3d41243d393f34782ab3 /src/Post.js
parentf020559df8c31d01f678435096d5a5c91aed2527 (diff)
downloadbai-client-cd9b802b71df4e2701e2311b2995fe70a9692ae4.tar.gz
bai-client-cd9b802b71df4e2701e2311b2995fe70a9692ae4.tar.xz
bai-client-cd9b802b71df4e2701e2311b2995fe70a9692ae4.zip
Prettier
Diffstat (limited to 'src/Post.js')
-rw-r--r--src/Post.js159
1 files changed, 103 insertions, 56 deletions
diff --git a/src/Post.js b/src/Post.js
index 3d08c05..4ccb7d0 100644
--- a/src/Post.js
+++ b/src/Post.js
@@ -1,69 +1,116 @@
import React from "react";
-import { Segment, Header, Image, Label, Icon, Modal, Comment, Divider } from "semantic-ui-react";
+import {
+ Segment,
+ Header,
+ Image,
+ Label,
+ Icon,
+ Modal,
+ Comment,
+ Divider
+} from "semantic-ui-react";
import Moment from "react-moment";
import "moment/locale/es";
import { avatars } from "./Quotes";
const ImageModal = ({ href, trigger }) => (
- <Modal trigger={trigger} basic size="fullscreen">
- <Modal.Content image>
- <Modal.Description style={{ "textAlign": "center" }}>
- <Image as="a" src={href} />
- </Modal.Description>
- </Modal.Content>
- </Modal>
+ <Modal trigger={trigger} basic size="fullscreen">
+ <Modal.Content image>
+ <Modal.Description style={{ textAlign: "center" }}>
+ <Image as="a" src={href} />
+ </Modal.Description>
+ </Modal.Content>
+ </Modal>
);
const Post = ({ index, post, locked, dir, threadId }) => {
- if (post.IS_DELETED > 0) {
- return (
- <Comment>
- <Comment.Avatar src={`https://bienvenidoainternet.org/static/css/img/picnicbdy.gif`} />
- <Comment.Content>
- <Comment.Author as='a'>#{index + 1}</Comment.Author>
- <Comment.Metadata>
- <div><Moment fromNow unix locale="es" date={post.timestamp} /></div>
- </Comment.Metadata>
- <Comment.Text>
- <span className="deleted">Eliminado por el {post.IS_DELETED === 1 ? "usuario." : "Staff."}</span>
- </Comment.Text>
- </Comment.Content>
- </Comment>
- );
- }
+ if (post.IS_DELETED > 0) {
+ return (
+ <Comment>
+ <Comment.Avatar
+ src={`https://bienvenidoainternet.org/static/css/img/picnicbdy.gif`}
+ />
+ <Comment.Content>
+ <Comment.Author as="a">#{index + 1}</Comment.Author>
+ <Comment.Metadata>
+ <div>
+ <Moment fromNow unix locale="es" date={post.timestamp} />
+ </div>
+ </Comment.Metadata>
+ <Comment.Text>
+ <span className="deleted">
+ Eliminado por el {post.IS_DELETED === 1 ? "usuario." : "Staff."}
+ </span>
+ </Comment.Text>
+ </Comment.Content>
+ </Comment>
+ );
+ }
- const filesize = require('filesize');
- const seedrandom = require("seedrandom");
- const rng = seedrandom(threadId + index);
+ const filesize = require("filesize");
+ const seedrandom = require("seedrandom");
+ const rng = seedrandom(threadId + index);
- let user_id = post.timestamp_formatted.split(" ID:")[1];
- const i = Math.round(rng() * avatars.length);
- const rndAvatar = avatars[i];
+ let user_id = post.timestamp_formatted.split(" ID:")[1];
+ const i = Math.round(rng() * avatars.length);
+ const rndAvatar = avatars[i];
- return (
- <Comment>
- <Comment.Avatar src={`https://bienvenidoainternet.org/static/ico/${rndAvatar}.gif`} />
- <Comment.Content>
- <Comment.Author as='a'>#{index + 1} <span className={post.email === "sage" ? "username sage" : "username"}>{post.name}</span><span className="tripcode">{post.tripcode}</span></Comment.Author>
- <Comment.Metadata>
- <div><Moment fromNow unix locale="es" date={post.timestamp} /></div>
- <div><Icon name="star" color={user_id === "CAP_USER*" ? "yellow" : "grey"} />{user_id}</div>
- </Comment.Metadata>
- <Comment.Text>
- {post.file !== "" ?
- <div className="imageContainer">
- <ImageModal href={`https://bienvenidoainternet.org/${dir}/src/${post.file}`} trigger={<Image centered className="postImage" src={`https://bienvenidoainternet.org/${dir}/thumb/${post.thumb}`} />} />
- {post.file} {post.image_width}x{post.image_height} {filesize(post.file_size, { bits: true })}
- </div>
- : null}
- <div className={`postMessage ${dir === "zonavip" ? "vipFont" : null}`} dangerouslySetInnerHTML={{ __html: post.message }} />
- </Comment.Text>
- <Comment.Actions>
- <Comment.Action>Responder</Comment.Action><Comment.Action>Reportar</Comment.Action>
- </Comment.Actions>
- </Comment.Content>
- </Comment>
- );
-}
+ return (
+ <Comment>
+ <Comment.Avatar
+ src={`https://bienvenidoainternet.org/static/ico/${rndAvatar}.gif`}
+ />
+ <Comment.Content>
+ <Comment.Author as="a">
+ #{index + 1}{" "}
+ <span
+ className={post.email === "sage" ? "username sage" : "username"}
+ >
+ {post.name}
+ </span>
+ <span className="tripcode">{post.tripcode}</span>
+ </Comment.Author>
+ <Comment.Metadata>
+ <div>
+ <Moment fromNow unix locale="es" date={post.timestamp} />
+ </div>
+ <div>
+ <Icon
+ name="star"
+ color={user_id === "CAP_USER*" ? "yellow" : "grey"}
+ />
+ {user_id}
+ </div>
+ </Comment.Metadata>
+ <Comment.Text>
+ {post.file !== "" ? (
+ <div className="imageContainer">
+ <ImageModal
+ href={`https://bienvenidoainternet.org/${dir}/src/${post.file}`}
+ trigger={
+ <Image
+ centered
+ className="postImage"
+ src={`https://bienvenidoainternet.org/${dir}/thumb/${post.thumb}`}
+ />
+ }
+ />
+ {post.file} {post.image_width}x{post.image_height}{" "}
+ {filesize(post.file_size, { bits: true })}
+ </div>
+ ) : null}
+ <div
+ className={`postMessage ${dir === "zonavip" ? "vipFont" : null}`}
+ dangerouslySetInnerHTML={{ __html: post.message }}
+ />
+ </Comment.Text>
+ <Comment.Actions>
+ <Comment.Action>Responder</Comment.Action>
+ <Comment.Action>Reportar</Comment.Action>
+ </Comment.Actions>
+ </Comment.Content>
+ </Comment>
+ );
+};
-export default Post; \ No newline at end of file
+export default Post;