();
const urlQueries = new URLSearchParams(search);
const gridContainerRef = useRef
(null);
@@ -198,7 +198,7 @@ export default function WeightsTab({ username }: { username: string }) {
onLayoutComplete={() => console.log("Layout complete!")}
>
{weights.list.map((data: any, key: number) => {
- let props = { bookmarks, data, origin, ratings, showCreator: true, type: "weights" };
+ let props = { bookmarks, data, ratings, showCreator: true, type: "weights", source };
return (
();
- const origin = search ? new URLSearchParams(search).get("origin") : "";
+ const source = search ? new URLSearchParams(search).get("source") : "";
const history = useHistory();
const bookmarks = useBookmarks();
const ratings = useRatings();
@@ -72,7 +72,7 @@ export default function WeightPage({
remove,
} = useWeightFetch({
onRemove: () => {
- history.push(origin || "");
+ history.push(source || "");
},
onSuccess: (res: any) => {
bookmarks.gather({ res, key: "weight_token" }); // expand rather than replace for lazy loading
@@ -98,6 +98,8 @@ export default function WeightPage({
fullLabel: weightTypeFull,
} = weightTypeInfo;
+ const deleteWeight = () => remove(!!user?.can_ban_users);
+
function renderWeightComponent(weight: Weight) {
switch (weight.weight_category) {
case WeightCategory.TTS:
@@ -570,7 +572,7 @@ export default function WeightPage({
content={() => (
<>{`Are you sure you want to delete "${title}"? This action cannot be undone.`}>
)}
- onConfirm={remove}
+ onConfirm={deleteWeight}
/>
);