Skip to content

Commit

Permalink
Merge pull request #531 from near/develop
Browse files Browse the repository at this point in the history
Weekly promotion of develop to main - early release
  • Loading branch information
calebjacob authored Nov 15, 2023
2 parents c4afdf2 + 6333ec4 commit 53a3bea
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 129 deletions.
29 changes: 15 additions & 14 deletions src/AccountProfileOverlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ const verifications = props.verifications;
const overlayStyles = props.overlayStyles;
const side = props.side ?? "top";

State.init({
hasBeenFlagged: false,
showConfirmModal: false,
});
const [hasBeenFlagged, setHasBeenFlagged] = useState(false);
const [showConfirmModal, setShowConfirmModal] = useState(false);

const onReport = () => {
State.update({
showConfirmModal: false,
hasBeenFlagged: true,
});
setShowConfirmModal(false);
setHasBeenFlagged(true);
};

const onReportCancel = () => {
setShowConfirmModal(false);
setHasBeenFlagged(false);
};

const Wrapper = styled.span`
Expand Down Expand Up @@ -142,7 +143,7 @@ const overlay = (
props={{
item: contentModerationItem,
onFlag: () => {
State.update({ hasBeenFlagged: true });
setHasBeenFlagged(true);
},
}}
/>
Expand All @@ -154,7 +155,7 @@ const overlay = (
src="${REPL_ACCOUNT}/widget/Flagged.Trigger"
props={{
onClick: () => {
State.update({ showConfirmModal: true });
setShowConfirmModal(true);
},
}}
/>
Expand Down Expand Up @@ -336,9 +337,9 @@ return (
title: "Flagged for moderation",
description:
"Thanks for helping our Content Moderators. The item you flagged will be reviewed.",
open: state.hasBeenFlagged,
open: hasBeenFlagged,
onOpenChange: () => {
State.update({ hasBeenFlagged: false });
setHasBeenFlagged(false);
},
duration: 5000,
}}
Expand All @@ -347,11 +348,11 @@ return (
<Widget
src="${REPL_ACCOUNT}/widget/Flagged.Modal"
props={{
open: state.showConfirmModal,
onOpenChange: handleModalClose,
open: showConfirmModal,
reportedAccountId: props.accountId,
contentModerationFlagValue: contentModerationItem,
onReport,
onReportCancel,
}}
/>
</FlaggedWrapper>
Expand Down
6 changes: 6 additions & 0 deletions src/DIG/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ let {
...forwardedProps
} = props;

if (forwardedProps.as) {
throw new Error(
'Invalid prop "as" passed to DIG.Button. If you need to render an anchor instead of a button, simply pass a "href" prop.'
);
}

fill = fill ?? "solid";
size = size ?? "default";
type = type ?? "button";
Expand Down
6 changes: 4 additions & 2 deletions src/DIG/Dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Overlay = styled(`${variant}.Overlay`)`
position: fixed;
inset: 0;
animation: overlayShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
z-index: 10000;
z-index: 1049;
@keyframes overlayShow {
from {
Expand All @@ -63,7 +63,7 @@ const Content = styled(`${variant}.Content`)`
max-height: 85vh;
padding: 24px;
animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
z-index: 10005;
z-index: 1054;
outline: none;
@keyframes contentShow {
Expand Down Expand Up @@ -161,6 +161,8 @@ confirmButton = confirmButton ?? (
/>
);

if (!forwardedProps?.open) return <></>;

return (
<Root {...forwardedProps}>
{trigger && (
Expand Down
6 changes: 5 additions & 1 deletion src/Flagged/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
let {
onReport,
onReportCancel,
reportedAccountId,
contentModerationFlagValue,
...forwardedProps
Expand All @@ -10,7 +11,7 @@ const socialSet = (index) =>
onCommit: () => {
onReport && onReport();
},
onCancel: () => onOpenChange(false),
onCancel: () => { onReportCancel && onReportCancel() },
});

const reportAccount = () => {
Expand Down Expand Up @@ -41,6 +42,8 @@ const reportAccountWithPosts = () => {
});
};

if (!forwardedProps.open) return <></>;

return (
<Widget
src="${REPL_ACCOUNT}/widget/DIG.Dialog"
Expand All @@ -53,6 +56,7 @@ return (
onCancel: reportAccount,
onConfirm: reportAccountWithPosts,
enableCloseButton: true,
onOpenChange: onReportCancel,
}}
/>
);
7 changes: 5 additions & 2 deletions src/Moderation/CheckPostModeration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,14 @@ State.init({
});

const selfModerationData = context.accountId
? Social.getr(`${context.accountId}/moderate`, "optimistic") ?? false
? Social.getr(`${context.accountId}/moderate`, "optimistic")
: [];
State.update({ selfModerationData });

if (state.selfModerationData && state.loadingState === "none") {
if (
(selfModerationData || typeof selfModerationData === "undefined") &&
state.loadingState === "none"
) {
State.update({
loadingState: "loading",
});
Expand Down
4 changes: 0 additions & 4 deletions src/NearOrg/Ecosystem/CommunityPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -377,7 +376,6 @@ return (
variant: "primary",
fill: "outline",
size: "small",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -417,7 +415,6 @@ return (
variant: "primary",
fill: "outline",
size: "small",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -449,7 +446,6 @@ return (
variant: "primary",
fill: "outline",
size: "small",
as: "a",
target: "_blank",
}}
/>
Expand Down
1 change: 0 additions & 1 deletion src/NearOrg/Ecosystem/GetFundingPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ return (
variant: "primary",
fill: "outline",
size: "small",
as: "a",
target: "_blank",
}}
/>
Expand Down
23 changes: 0 additions & 23 deletions src/NearOrg/Ecosystem/OverviewPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ return (
label: "Visit AwesomeNEAR",
variant: "affirmative",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -582,7 +581,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -615,7 +613,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -648,7 +645,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -689,7 +685,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand All @@ -705,7 +700,6 @@ return (
label: "Browse DAOs on AstroDAO",
variant: "affirmative",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -756,7 +750,6 @@ return (
label: "Create a new DAO",
variant: "affirmative",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -878,7 +871,6 @@ return (
label: "Browse Governance Forum",
variant: "affirmative",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -928,7 +920,6 @@ return (
label: "Read on Medium",
variant: "destructive",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1132,7 +1123,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1177,7 +1167,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1249,7 +1238,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1303,7 +1291,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1379,7 +1366,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand All @@ -1401,7 +1387,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand All @@ -1417,7 +1402,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1504,7 +1488,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1532,7 +1515,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1583,7 +1565,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1629,7 +1610,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1686,7 +1666,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1732,7 +1711,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down Expand Up @@ -1804,7 +1782,6 @@ return (
variant: "primary",
fill: "outline",
size: "large",
as: "a",
target: "_blank",
}}
/>
Expand Down
Loading

0 comments on commit 53a3bea

Please sign in to comment.