From 3e3d05fc26a634b17549c9473bd8aeebb7dec4ec Mon Sep 17 00:00:00 2001
From: Manti <67705577+mantikafasi@users.noreply.github.com>
Date: Sun, 28 May 2023 23:03:06 +0300
Subject: ReviewDB: Add Review Modal & Pagination (#1174)

Co-authored-by: V <vendicated@riseup.net>
---
 src/plugins/reviewDB/components/MessageButton.tsx | 54 +++++++++++++++--------
 1 file changed, 35 insertions(+), 19 deletions(-)

(limited to 'src/plugins/reviewDB/components/MessageButton.tsx')

diff --git a/src/plugins/reviewDB/components/MessageButton.tsx b/src/plugins/reviewDB/components/MessageButton.tsx
index 3b8308a..176f4d6 100644
--- a/src/plugins/reviewDB/components/MessageButton.tsx
+++ b/src/plugins/reviewDB/components/MessageButton.tsx
@@ -17,28 +17,44 @@
 */
 
 import { classes } from "@utils/misc";
-import { LazyComponent } from "@utils/react";
-import { findByProps } from "@webpack";
+import { findByPropsLazy } from "@webpack";
+import { Tooltip } from "@webpack/common";
 
-export default LazyComponent(() => {
-    const { button, dangerous } = findByProps("button", "wrapper", "disabled", "separator");
+const iconClasses = findByPropsLazy("button", "wrapper", "disabled", "separator");
 
-    return function MessageButton(props) {
-        return props.type === "delete"
-            ? (
-                <div className={classes(button, dangerous)} aria-label="Delete Review" onClick={props.callback}>
-                    <svg aria-hidden="false" width="16" height="16" viewBox="0 0 20 20">
-                        <path fill="currentColor" d="M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z"></path>
-                        <path fill="currentColor" d="M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z"></path>
+export function DeleteButton({ onClick }: { onClick(): void; }) {
+    return (
+        <Tooltip text="Delete Review">
+            {props => (
+                <div
+                    {...props}
+                    className={classes(iconClasses.button, iconClasses.dangerous)}
+                    onClick={onClick}
+                >
+                    <svg width="16" height="16" viewBox="0 0 20 20">
+                        <path fill="currentColor" d="M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z" />
+                        <path fill="currentColor" d="M5 6.99902V18.999C5 20.101 5.897 20.999 7 20.999H17C18.103 20.999 19 20.101 19 18.999V6.99902H5ZM11 17H9V11H11V17ZM15 17H13V11H15V17Z" />
                     </svg>
                 </div>
-            )
-            : (
-                <div className={button} aria-label="Report Review" onClick={() => props.callback()}>
-                    <svg aria-hidden="false" width="16" height="16" viewBox="0 0 20 20">
-                        <path fill="currentColor" d="M20,6.002H14V3.002C14,2.45 13.553,2.002 13,2.002H4C3.447,2.002 3,2.45 3,3.002V22.002H5V14.002H10.586L8.293,16.295C8.007,16.581 7.922,17.011 8.076,17.385C8.23,17.759 8.596,18.002 9,18.002H20C20.553,18.002 21,17.554 21,17.002V7.002C21,6.45 20.553,6.002 20,6.002Z"></path>
+            )}
+        </Tooltip>
+    );
+}
+
+export function ReportButton({ onClick }: { onClick(): void; }) {
+    return (
+        <Tooltip text="Report Review">
+            {props => (
+                <div
+                    {...props}
+                    className={iconClasses.button}
+                    onClick={onClick}
+                >
+                    <svg width="16" height="16" viewBox="0 0 20 20">
+                        <path fill="currentColor" d="M20,6.002H14V3.002C14,2.45 13.553,2.002 13,2.002H4C3.447,2.002 3,2.45 3,3.002V22.002H5V14.002H10.586L8.293,16.295C8.007,16.581 7.922,17.011 8.076,17.385C8.23,17.759 8.596,18.002 9,18.002H20C20.553,18.002 21,17.554 21,17.002V7.002C21,6.45 20.553,6.002 20,6.002Z" />
                     </svg>
                 </div>
-            );
-    };
-});
+            )}
+        </Tooltip>
+    );
+}
-- 
cgit 

