From 09075e0bf20ddd89f121e4d359495cf3f504c3f2 Mon Sep 17 00:00:00 2001 From: cisel-zumbul Date: Sun, 12 Nov 2023 16:25:24 +0300 Subject: [PATCH 01/10] Adds review component in alignment with #644 --- .../GameDetails/Review/Review.module.scss | 98 +++++++++++++++++++ .../Components/GameDetails/Review/Review.tsx | 64 ++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 app/frontend/src/Components/GameDetails/Review/Review.module.scss create mode 100644 app/frontend/src/Components/GameDetails/Review/Review.tsx diff --git a/app/frontend/src/Components/GameDetails/Review/Review.module.scss b/app/frontend/src/Components/GameDetails/Review/Review.module.scss new file mode 100644 index 00000000..654100a4 --- /dev/null +++ b/app/frontend/src/Components/GameDetails/Review/Review.module.scss @@ -0,0 +1,98 @@ +@import "../../../colors"; + + +.review-input-container { + display: flex; + flex-direction: column; + width: 300px; + color: white !important; + background-color: $blue-green; + border-radius: 0.5em; + margin: 5px 5px 5px 5px; + overflow: hidden; + padding: 10px 10px 0 10px; + gap: 10px; + + .content-input { + background-color: $prussian-blue-dark-10 !important; + flex: 4; + width: 100%; + border-radius: 0.5em; + padding: 5px; + font-size: 13px; + } +} + +.reviews-subpage-container { + display: flex; + flex-wrap: wrap; +} +.review-container { + display: flex; + width: min-content; + background-color: $prussian-blue-dark-40; + border-radius: 0.5em; + margin: 5px 5px 5px 5px; + overflow: hidden; + + .vote { + display: flex; + flex-direction: column; + background-color: $celadon-light-10; + padding: 10px; + align-items: center; + gap: 5px; + color: $color-text; + width: 60px; + justify-content: center; + } + + .review { + display: flex; + flex-direction: column; + align-items: flex-start; + padding: 10px; + color: $color-text-light; + gap: 5px; + justify-content: space-between; + + .header { + display: flex; + justify-content: flex-start; + align-items: center; + gap: 100px; + .user { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + .buttons { + display: flex; + justify-self: flex-end;; + } + } + .date { + font-size: 10px; + align-self: flex-start; + } + .stars { + display: flex; + justify-content: center; + align-items: center; + gap: 2px; + color: $yellow; + align-self: flex-end; + } + + .content { + background-color: $prussian-blue-dark-10 !important; + flex: 4; + width: 100%; + border-radius: 0.5em; + padding: 5px; + font-size: 13px; + } + } + +} \ No newline at end of file diff --git a/app/frontend/src/Components/GameDetails/Review/Review.tsx b/app/frontend/src/Components/GameDetails/Review/Review.tsx new file mode 100644 index 00000000..0c9cc10d --- /dev/null +++ b/app/frontend/src/Components/GameDetails/Review/Review.tsx @@ -0,0 +1,64 @@ +import { Button } from "antd"; +import styles from "./Review.module.scss"; +import { + DeleteOutlined, + DownOutlined, + EditOutlined, + StarFilled, + UpOutlined, +} from "@ant-design/icons"; +import TextArea from "antd/es/input/TextArea"; +import { useState } from "react"; +import { formatDate } from "../../../Library/utils/formatDate"; + +function Review({ review }: { review: any }) { + const [inputMode, setInputMode] = useState(false); + + return ( +
+
+
+
+
+
+ {review.reviewedBy} +
+
+
+
+
{formatDate(review.createdAt)}
+
+ {[1, 2, 3, 4, 5].map((starValue) => + starValue <= review.rating ? : "" + )} + {Math.round(review.rating) !== review.rating ? ½ : ""} +
+ {inputMode ? ( +