ReviewDB: Fix wording in server reviews (#2826)
This commit is contained in:
parent
accfc15125
commit
c51d7b8fb4
|
@ -22,12 +22,13 @@ import { useForceUpdater } from "@utils/react";
|
|||
import { Paginator, Text, useRef, useState } from "@webpack/common";
|
||||
|
||||
import { Auth } from "../auth";
|
||||
import { ReviewType } from "../entities";
|
||||
import { Response, REVIEWS_PER_PAGE } from "../reviewDbApi";
|
||||
import { cl } from "../utils";
|
||||
import ReviewComponent from "./ReviewComponent";
|
||||
import ReviewsView, { ReviewsInputComponent } from "./ReviewsView";
|
||||
|
||||
function Modal({ modalProps, modalKey, discordId, name }: { modalProps: any; modalKey: string, discordId: string; name: string; }) {
|
||||
function Modal({ modalProps, modalKey, discordId, name, type }: { modalProps: any; modalKey: string, discordId: string; name: string; type: ReviewType; }) {
|
||||
const [data, setData] = useState<Response>();
|
||||
const [signal, refetch] = useForceUpdater(true);
|
||||
const [page, setPage] = useState(1);
|
||||
|
@ -58,6 +59,7 @@ function Modal({ modalProps, modalKey, discordId, name }: { modalProps: any; mod
|
|||
onFetchReviews={setData}
|
||||
scrollToTop={() => ref.current?.scrollTo({ top: 0, behavior: "smooth" })}
|
||||
hideOwnReview
|
||||
type={type}
|
||||
/>
|
||||
</div>
|
||||
</ModalContent>
|
||||
|
@ -95,7 +97,7 @@ function Modal({ modalProps, modalKey, discordId, name }: { modalProps: any; mod
|
|||
);
|
||||
}
|
||||
|
||||
export function openReviewsModal(discordId: string, name: string) {
|
||||
export function openReviewsModal(discordId: string, name: string, type: ReviewType) {
|
||||
const modalKey = "vc-rdb-modal-" + Date.now();
|
||||
|
||||
openModal(props => (
|
||||
|
@ -104,6 +106,7 @@ export function openReviewsModal(discordId: string, name: string) {
|
|||
modalProps={props}
|
||||
discordId={discordId}
|
||||
name={name}
|
||||
type={type}
|
||||
/>
|
||||
), { modalKey });
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpa
|
|||
import { Forms, React, RelationshipStore, useRef, UserStore } from "@webpack/common";
|
||||
|
||||
import { Auth, authorize } from "../auth";
|
||||
import { Review } from "../entities";
|
||||
import { Review, ReviewType } from "../entities";
|
||||
import { addReview, getReviews, Response, REVIEWS_PER_PAGE } from "../reviewDbApi";
|
||||
import { settings } from "../settings";
|
||||
import { cl, showToast } from "../utils";
|
||||
|
@ -45,6 +45,7 @@ interface Props extends UserProps {
|
|||
page?: number;
|
||||
scrollToTop?(): void;
|
||||
hideOwnReview?: boolean;
|
||||
type: ReviewType;
|
||||
}
|
||||
|
||||
export default function ReviewsView({
|
||||
|
@ -56,6 +57,7 @@ export default function ReviewsView({
|
|||
page = 1,
|
||||
showInput = false,
|
||||
hideOwnReview = false,
|
||||
type,
|
||||
}: Props) {
|
||||
const [signal, refetch] = useForceUpdater(true);
|
||||
|
||||
|
@ -80,6 +82,7 @@ export default function ReviewsView({
|
|||
reviews={reviewData!.reviews}
|
||||
hideOwnReview={hideOwnReview}
|
||||
profileId={discordId}
|
||||
type={type}
|
||||
/>
|
||||
|
||||
{showInput && (
|
||||
|
@ -94,7 +97,7 @@ export default function ReviewsView({
|
|||
);
|
||||
}
|
||||
|
||||
function ReviewList({ refetch, reviews, hideOwnReview, profileId }: { refetch(): void; reviews: Review[]; hideOwnReview: boolean; profileId: string; }) {
|
||||
function ReviewList({ refetch, reviews, hideOwnReview, profileId, type }: { refetch(): void; reviews: Review[]; hideOwnReview: boolean; profileId: string; type: ReviewType; }) {
|
||||
const myId = UserStore.getCurrentUser().id;
|
||||
|
||||
return (
|
||||
|
@ -111,7 +114,7 @@ function ReviewList({ refetch, reviews, hideOwnReview, profileId }: { refetch():
|
|||
|
||||
{reviews?.length === 0 && (
|
||||
<Forms.FormText className={cl("placeholder")}>
|
||||
Looks like nobody reviewed this user yet. You could be the first!
|
||||
Looks like nobody reviewed this {type === ReviewType.User ? "user" : "server"} yet. You could be the first!
|
||||
</Forms.FormText>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@ import { Guild, User } from "discord-types/general";
|
|||
|
||||
import { Auth, initAuth, updateAuth } from "./auth";
|
||||
import { openReviewsModal } from "./components/ReviewModal";
|
||||
import { NotificationType } from "./entities";
|
||||
import { NotificationType, ReviewType } from "./entities";
|
||||
import { getCurrentUserInfo, readNotification } from "./reviewDbApi";
|
||||
import { settings } from "./settings";
|
||||
import { showToast } from "./utils";
|
||||
|
@ -44,7 +44,7 @@ const guildPopoutPatch: NavContextMenuPatchCallback = (children, { guild }: { gu
|
|||
label="View Reviews"
|
||||
id="vc-rdb-server-reviews"
|
||||
icon={OpenExternalIcon}
|
||||
action={() => openReviewsModal(guild.id, guild.name)}
|
||||
action={() => openReviewsModal(guild.id, guild.name, ReviewType.Server)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -56,7 +56,7 @@ const userContextPatch: NavContextMenuPatchCallback = (children, { user }: { use
|
|||
label="View Reviews"
|
||||
id="vc-rdb-user-reviews"
|
||||
icon={OpenExternalIcon}
|
||||
action={() => openReviewsModal(user.id, user.username)}
|
||||
action={() => openReviewsModal(user.id, user.username, ReviewType.User)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ export default definePlugin({
|
|||
return (
|
||||
<TooltipContainer text="View Reviews">
|
||||
<Button
|
||||
onClick={() => openReviewsModal(user.id, user.username)}
|
||||
onClick={() => openReviewsModal(user.id, user.username, ReviewType.User)}
|
||||
look={Button.Looks.FILLED}
|
||||
size={Button.Sizes.NONE}
|
||||
color={RoleButtonClasses.bannerColor}
|
||||
|
|
Loading…
Reference in a new issue