diff options
author | Manti <67705577+mantikafasi@users.noreply.github.com> | 2023-05-14 02:29:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-14 01:29:13 +0200 |
commit | 7a27de892767aa8d9104ef16fe5ba2a2a75568cf (patch) | |
tree | 1602ecfb2e134e9c6c8ec05325e5d17d093eac17 /src/plugins/reviewDB/components | |
parent | 1bc06784226ed93b33698000cab70d17cb22639b (diff) | |
download | Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.gz Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.tar.bz2 Vencord-7a27de892767aa8d9104ef16fe5ba2a2a75568cf.zip |
[ReviewDB] Improve UI & Use new RewviewDB api endpoints (#1104)
Diffstat (limited to 'src/plugins/reviewDB/components')
-rw-r--r-- | src/plugins/reviewDB/components/ReviewComponent.tsx | 22 | ||||
-rw-r--r-- | src/plugins/reviewDB/components/ReviewsView.tsx | 19 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx index 04973d7..ac09b4c 100644 --- a/src/plugins/reviewDB/components/ReviewComponent.tsx +++ b/src/plugins/reviewDB/components/ReviewComponent.tsx @@ -34,19 +34,17 @@ export default LazyComponent(() => { const [ { cozyMessage, buttons, message, groupStart }, { container, isHeader }, - { avatar, clickable, username, messageContent, wrapper, cozy, timestampInline, timestamp }, - { contents }, + { avatar, clickable, username, messageContent, wrapper, cozy }, buttonClasses, - { defaultColor } ] = findBulk( p("cozyMessage"), p("container", "isHeader"), p("avatar", "zalgo"), - p("contents"), p("button", "wrapper", "selected"), - p("defaultColor") ); + const dateFormat = new Intl.DateTimeFormat(); + return function ReviewComponent({ review, refetch }: { review: Review; refetch(): void; }) { function openModal() { openUserProfileModal(review.sender.discordID); @@ -89,7 +87,7 @@ export default LazyComponent(() => { } }> - <div className={contents} style={{ paddingLeft: "0px" }}> + <div> <img className={classes(avatar, clickable)} onClick={openModal} @@ -107,16 +105,14 @@ export default LazyComponent(() => { { !Settings.plugins.ReviewDB.hideTimestamps && ( - <Timestamp - timestamp={moment(review.timestamp * 1000)} - compact={true} - /> - ) + <Timestamp timestamp={moment(review.timestamp * 1000)} > + {dateFormat.format(review.timestamp * 1000)} + </Timestamp>) } <p - className={classes(messageContent, defaultColor)} - style={{ fontSize: 15, marginTop: 4 }} + className={classes(messageContent)} + style={{ fontSize: 15, marginTop: 4, color: "var(--text-normal)" }} > {review.comment} </p> diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx index f4bd248..ff46cca 100644 --- a/src/plugins/reviewDB/components/ReviewsView.tsx +++ b/src/plugins/reviewDB/components/ReviewsView.tsx @@ -19,7 +19,7 @@ import { Settings } from "@api/Settings"; import { classes } from "@utils/misc"; import { useAwaiter } from "@utils/react"; -import { findLazy } from "@webpack"; +import { findByPropsLazy } from "@webpack"; import { Forms, React, Text, UserStore } from "@webpack/common"; import type { KeyboardEvent } from "react"; @@ -27,7 +27,7 @@ import { addReview, getReviews } from "../Utils/ReviewDBAPI"; import { authorize, showToast } from "../Utils/Utils"; import ReviewComponent from "./ReviewComponent"; -const Classes = findLazy(m => typeof m.textarea === "string"); +const Classes = findByPropsLazy("inputDefault", "editable"); export default function ReviewsView({ userId }: { userId: string; }) { const { token } = Settings.plugins.ReviewDB; @@ -65,7 +65,7 @@ export default function ReviewsView({ userId }: { userId: string; }) { tag="h2" variant="eyebrow" style={{ - marginBottom: "12px", + marginBottom: "8px", color: "var(--header-primary)" }} > @@ -79,13 +79,17 @@ export default function ReviewsView({ userId }: { userId: string; }) { /> )} {reviews?.length === 0 && ( - <Forms.FormText style={{ padding: "12px", paddingTop: "0px", paddingLeft: "4px", fontWeight: "bold", fontStyle: "italic" }}> + <Forms.FormText style={{ paddingRight: "12px", paddingTop: "0px", paddingLeft: "0px", paddingBottom: "4px", fontWeight: "bold", fontStyle: "italic" }}> Looks like nobody reviewed this user yet. You could be the first! </Forms.FormText> )} <textarea - className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")} - // this produces something like '-_59yqs ...' but since no class exists with that name its fine + className={classes(Classes.inputDefault, "enter-comment")} + onKeyDownCapture={e => { + if (e.key === "Enter") { + e.preventDefault(); // prevent newlines + } + }} placeholder={ token ? (reviews?.some(r => r.sender.discordID === UserStore.getCurrentUser().id) @@ -106,6 +110,9 @@ export default function ReviewsView({ userId }: { userId: string; }) { resize: "none", marginBottom: "12px", overflow: "hidden", + background: "transparent", + border: "1px solid var(--profile-message-input-border-color)", + fontSize: "14px", }} /> </div> |