From a5e3c6c7672ffc8976bd4a55d49947064d48f5a4 Mon Sep 17 00:00:00 2001
From: Renard
Date: Tue, 17 Sep 2019 17:32:18 -0300
Subject: IDs coloreados, avatar asignado por id
---
src/Post.js | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/src/Post.js b/src/Post.js
index be831a1..b3e47ea 100644
--- a/src/Post.js
+++ b/src/Post.js
@@ -48,13 +48,29 @@ const Post = ({ index, post, locked, threadId, currentBoard }) => {
);
}
+ let user_id = post.timestamp_formatted.split(" ID:")[1];
const filesize = require("filesize");
const seedrandom = require("seedrandom");
const rng = seedrandom(threadId + index);
+ const idRng = seedrandom(user_id);
+ const idColor =
+ "rgb(" +
+ Math.round(idRng() * 255) +
+ ", " +
+ Math.round(idRng() * 200) +
+ ", " +
+ Math.round(idRng() * 200) +
+ ")";
+
+ let rndAvatar;
+ if (user_id !== "") {
+ let i = Math.round(idRng() * avatars.length);
+ rndAvatar = avatars[i];
+ } else {
+ let i = Math.round(rng() * avatars.length);
+ rndAvatar = avatars[i];
+ }
- let user_id = post.timestamp_formatted.split(" ID:")[1];
- const i = Math.round(rng() * avatars.length);
- const rndAvatar = avatars[i];
let flag;
if (currentBoard.dir === "world") {
@@ -115,7 +131,11 @@ const Post = ({ index, post, locked, threadId, currentBoard }) => {
name="star"
color={user_id === "CAP_USER*" ? "yellow" : "grey"}
/>
- {user_id === "CAP_USER*" ? "Usuario verificado" : user_id}
+ {user_id === "CAP_USER*" ? (
+ "Usuario verificado"
+ ) : (
+ {user_id}
+ )}
--
cgit v1.2.1-18-gbd029