aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/reviewDB/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/reviewDB/components')
-rw-r--r--src/plugins/reviewDB/components/ReviewComponent.tsx15
-rw-r--r--src/plugins/reviewDB/components/ReviewsView.tsx19
2 files changed, 30 insertions, 4 deletions
diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx
index 7eadeff..76497d1 100644
--- a/src/plugins/reviewDB/components/ReviewComponent.tsx
+++ b/src/plugins/reviewDB/components/ReviewComponent.tsx
@@ -16,9 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import { Settings } from "@api/settings";
import { classes, LazyComponent } from "@utils/misc";
import { filters, findBulk } from "@webpack";
-import { Alerts, UserStore } from "@webpack/common";
+import { Alerts, moment, Timestamp, UserStore } from "@webpack/common";
import { Review } from "../entities/Review";
import { deleteReview, reportReview } from "../Utils/ReviewDBAPI";
@@ -32,7 +33,7 @@ export default LazyComponent(() => {
const [
{ cozyMessage, buttons, message, groupStart },
{ container, isHeader },
- { avatar, clickable, username, messageContent, wrapper, cozy },
+ { avatar, clickable, username, messageContent, wrapper, cozy, timestampInline, timestamp },
{ contents },
buttonClasses,
{ defaultColor }
@@ -102,6 +103,16 @@ export default LazyComponent(() => {
{review.sender.username}
</span>
{review.sender.badges.map(badge => <ReviewBadge {...badge} />)}
+
+ {
+ !Settings.plugins.ReviewDB.hideTimestamps && (
+ <Timestamp
+ timestamp={moment(review.timestamp * 1000)}
+ compact={true}
+ />
+ )
+ }
+
<p
className={classes(messageContent, defaultColor)}
style={{ fontSize: 15, marginTop: 4 }}
diff --git a/src/plugins/reviewDB/components/ReviewsView.tsx b/src/plugins/reviewDB/components/ReviewsView.tsx
index 466e9d4..777a9c1 100644
--- a/src/plugins/reviewDB/components/ReviewsView.tsx
+++ b/src/plugins/reviewDB/components/ReviewsView.tsx
@@ -16,18 +16,20 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import { Settings } from "@api/settings";
import { classes, useAwaiter } from "@utils/misc";
import { findLazy } from "@webpack";
import { Forms, React, Text, UserStore } from "@webpack/common";
import type { KeyboardEvent } from "react";
import { addReview, getReviews } from "../Utils/ReviewDBAPI";
-import { showToast } from "../Utils/Utils";
+import { authorize, showToast } from "../Utils/Utils";
import ReviewComponent from "./ReviewComponent";
const Classes = findLazy(m => typeof m.textarea === "string");
export default function ReviewsView({ userId }: { userId: string; }) {
+ const { token } = Settings.plugins.ReviewDB;
const [refetchCount, setRefetchCount] = React.useState(0);
const [reviews, _, isLoading] = useAwaiter(() => getReviews(userId), {
fallbackValue: [],
@@ -83,8 +85,21 @@ export default function ReviewsView({ userId }: { userId: string; }) {
<textarea
className={classes(Classes.textarea.replace("textarea", ""), "enter-comment")}
// this produces something like '-_59yqs ...' but since no class exists with that name its fine
- placeholder={reviews?.some(r => r.sender.discordID === UserStore.getCurrentUser().id) ? `Update review for @${username}` : `Review @${username}`}
+ placeholder={
+ token
+ ? (reviews?.some(r => r.sender.discordID === UserStore.getCurrentUser().id)
+ ? `Update review for @${username}`
+ : `Review @${username}`)
+ : "You need to authorize to review users!"
+ }
onKeyDown={onKeyPress}
+ onClick={() => {
+ if (!token) {
+ showToast("Opening authorization window...");
+ authorize();
+ }
+ }}
+
style={{
marginTop: "6px",
resize: "none",