mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-18 19:07:08 -04:00
feat(plugin): ShikiCodeblocks (#267)
Co-authored-by: ArjixWasTaken <53124886+ArjixWasTaken@users.noreply.github.com> Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
4760af7f0e
commit
41dddc9eee
32 changed files with 1480 additions and 105 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
import { classes, useAwaiter } from "@utils/misc";
|
||||
import { findLazy } from "@webpack";
|
||||
import { Forms, Text, UserStore } from "@webpack/common";
|
||||
import { Forms, React, Text, UserStore } from "@webpack/common";
|
||||
import type { KeyboardEvent } from "react";
|
||||
|
||||
import { addReview, getReviews } from "../Utils/ReviewDBAPI";
|
||||
|
@ -27,7 +27,13 @@ import ReviewComponent from "./ReviewComponent";
|
|||
const Classes = findLazy(m => typeof m.textarea === "string");
|
||||
|
||||
export default function ReviewsView({ userId }: { userId: string; }) {
|
||||
const [reviews, _, isLoading, refetch] = useAwaiter(() => getReviews(userId), []);
|
||||
const [refetchCount, setRefetchCount] = React.useState(0);
|
||||
const [reviews, _, isLoading] = useAwaiter(() => getReviews(userId), {
|
||||
fallbackValue: [],
|
||||
deps: [refetchCount],
|
||||
});
|
||||
|
||||
const dirtyRefetch = () => setRefetchCount(refetchCount + 1);
|
||||
|
||||
if (isLoading) return null;
|
||||
|
||||
|
@ -40,7 +46,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
|
|||
}).then(res => {
|
||||
if (res === 0 || res === 1) {
|
||||
(target as HTMLInputElement).value = ""; // clear the input
|
||||
refetch();
|
||||
dirtyRefetch();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -64,7 +70,7 @@ export default function ReviewsView({ userId }: { userId: string; }) {
|
|||
<ReviewComponent
|
||||
key={review.id}
|
||||
review={review}
|
||||
refetch={refetch}
|
||||
refetch={dirtyRefetch}
|
||||
/>
|
||||
)}
|
||||
{reviews?.length === 0 && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue