Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9196 Paywall banner in Sidebar and Page Editor #9271

Merged
merged 11 commits into from
Oct 15, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import React from "react";
import TeamTrialBanner from "@/extensionConsole/pages/teamTrials/TeamTrialBanner";
import TeamTrialBanner from "@/components/teamTrials/TeamTrialBanner";
import { render, screen, waitFor } from "@/extensionConsole/testHelpers";
import { organizationResponseFactory } from "@/testUtils/factories/organizationFactories";
import { type Timestamp } from "@/types/stringTypes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/

import Banner from "@/components/banner/Banner";
import TrialCallToActionLink from "@/extensionConsole/pages/teamTrials/TrialCallToActionLink";
import TrialCallToActionLink from "@/components/teamTrials/TrialCallToActionLink";
import useTeamTrialStatus, {
TeamTrialStatus,
} from "@/extensionConsole/pages/teamTrials/useTeamTrialStatus";
} from "@/components/teamTrials/useTeamTrialStatus";
import React from "react";
import { Collapse } from "react-bootstrap";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { render, screen, waitFor } from "@/extensionConsole/testHelpers";
import { TrialAwareButton } from "@/extensionConsole/pages/teamTrials/TrialAwareButton";
import { TrialAwareButton } from "@/components/teamTrials/TrialAwareButton";
import { appApiMock } from "@/testUtils/appApiMock";
import { registryIdFactory } from "@/testUtils/factories/stringFactories";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import TrialCallToActionLink from "@/extensionConsole/pages/teamTrials/TrialCallToActionLink";
import useGetAllTeamScopes from "@/extensionConsole/pages/teamTrials/useGetAllTeamScopes";
import TrialCallToActionLink from "@/components/teamTrials/TrialCallToActionLink";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: I know its outside the scope of your PR, but any reason that TrialAwareButton isn't the default export for the file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea; I don't see why not though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea; I don't see why not though

If you have a moment, please make it a default export. Otherwise, just go ahead and merge

import useGetAllTeamScopes from "@/components/teamTrials/useGetAllTeamScopes";
import useTeamTrialStatus, {
TeamTrialStatus,
} from "@/extensionConsole/pages/teamTrials/useTeamTrialStatus";
} from "@/components/teamTrials/useTeamTrialStatus";
import { type RegistryId } from "@/types/registryTypes";
import { type IconProp } from "@fortawesome/fontawesome-svg-core";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
Expand Down
2 changes: 1 addition & 1 deletion src/extensionConsole/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import DatabaseUnresponsiveBanner from "@/components/DatabaseUnresponsiveBanner"
import ActivateModPage from "@/extensionConsole/pages/activateMod/ActivateModPage";
import { RestrictedFeatures } from "@/auth/featureFlags";
import { useLocation } from "react-router";
import TeamTrialBanner from "@/extensionConsole/pages/teamTrials/TeamTrialBanner";
import TeamTrialBanner from "@/components/teamTrials/TeamTrialBanner";

// Register the built-in bricks
registerEditors();
Expand Down
2 changes: 1 addition & 1 deletion src/extensionConsole/pages/activateMod/ActivateModCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { assertNotNullish } from "@/utils/nullishUtils";
import { Milestones } from "@/data/model/UserMilestone";
import MarketplaceListingIcon from "@/components/MarketplaceListingIcon";
import castError from "@/utils/castError";
import { TrialAwareButton } from "@/extensionConsole/pages/teamTrials/TrialAwareButton";
import { TrialAwareButton } from "@/components/teamTrials/TrialAwareButton";

const WizardHeader: React.VoidFunctionComponent<{
mod: ModDefinition;
Expand Down
2 changes: 1 addition & 1 deletion src/extensionConsole/pages/mods/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import reportEvent from "@/telemetry/reportEvent";
import { Events } from "@/telemetry/events";
import { useHistory } from "react-router";
import { UI_PATHS } from "@/data/service/urlPaths";
import { TrialAwareButton } from "@/extensionConsole/pages/teamTrials/TrialAwareButton";
import { TrialAwareButton } from "@/components/teamTrials/TrialAwareButton";
import useFindModInstance from "@/mods/hooks/useFindModInstance";
import { compact } from "lodash";

Expand Down
2 changes: 2 additions & 0 deletions src/pageEditor/layout/EditorLayout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
.root {
display: flex;
height: inherit;
// Establishes new formatting context to enable scrolling independent of the outer layout
overflow: auto;

& > * {
height: auto !important;
Expand Down
7 changes: 7 additions & 0 deletions src/pageEditor/layout/PanelContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ import DimensionGate from "@/pageEditor/components/DimensionGate";
import { allFramesInInspectedTab } from "@/pageEditor/context/connection";
import DatabaseUnresponsiveBanner from "@/components/DatabaseUnresponsiveBanner";
import { InsertPaneProvider } from "@/pageEditor/panes/insert/InsertPane";
import TeamTrialBanner from "@/components/teamTrials/TeamTrialBanner";
import useTeamTrialStatus, {
TeamTrialStatus,
} from "@/components/teamTrials/useTeamTrialStatus";

const STARTER_BRICKS_TO_EXCLUDE_FROM_CLEANUP: StarterBrickType[] = [
StarterBrickTypes.SIDEBAR_PANEL,
Expand Down Expand Up @@ -76,6 +80,8 @@ const cleanUpStarterBrickForModComponentFormState = (

const PanelContent: React.FC = () => {
const dispatch = useDispatch();
const trialStatus = useTeamTrialStatus();

const activeModComponentFormState = useSelector(
selectActiveModComponentFormState,
);
Expand Down Expand Up @@ -128,6 +134,7 @@ const PanelContent: React.FC = () => {
<ReduxPersistenceContext.Provider value={authPersistenceContext}>
<ModalProvider>
<ErrorBoundary>
{trialStatus === TeamTrialStatus.EXPIRED && <TeamTrialBanner />}
<TabConnectionErrorBanner />
<DatabaseUnresponsiveBanner />
<DimensionGate>
Expand Down
2 changes: 1 addition & 1 deletion src/pageEditor/pageEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<base target="_blank" />
</head>
<body class="h-100">
<div id="container" class="h-100 full-height">
<div id="container" class="h-100 full-height align-items-stretch">
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This along with the change to EditorLayout.scss fixes vertical scrolling issues when banners are present in the page editor

<div class="global-loading-message">Loading Page Editor 🚀</div>
</div>
<script src="loadingScreen.js"></script>
Expand Down
1 change: 1 addition & 0 deletions src/sidebar/SidebarBody.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {

jest.mock("@/sidebar/hooks/useConnectedTargetUrl");
jest.mock("@/hooks/useTheme");
jest.mock("@/components/teamTrials/useTeamTrialStatus");
jest.mock("@/contentScript/messenger/api", () => ({
ensureStarterBricksInstalled: jest.fn(),
getReservedSidebarEntries: jest.fn().mockResolvedValue({
Expand Down
7 changes: 7 additions & 0 deletions src/sidebar/SidebarBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import RestrictedUrlPopupApp from "@/tinyPages/RestrictedUrlPopupApp";
import useConnectedTargetUrl from "./hooks/useConnectedTargetUrl";
import { getReasonByUrl as getRestrictedReasonByUrl } from "@/tinyPages/restrictedUrlPopupUtils";
import DatabaseUnresponsiveBanner from "@/components/DatabaseUnresponsiveBanner";
import TeamTrialBanner from "@/components/teamTrials/TeamTrialBanner";
import useTeamTrialStatus, {
TeamTrialStatus,
} from "@/components/teamTrials/useTeamTrialStatus";

const SidebarReady: React.FC<{ url: string }> = ({ url }) => {
const restricted = getRestrictedReasonByUrl(url);
Expand All @@ -37,9 +41,12 @@ const SidebarReady: React.FC<{ url: string }> = ({ url }) => {
// navigation in the SidebarApp
function SidebarBody() {
const url = useConnectedTargetUrl();
const trialStatus = useTeamTrialStatus();

return (
<>
<Header />
{trialStatus === TeamTrialStatus.EXPIRED && <TeamTrialBanner />}
<DatabaseUnresponsiveBanner />
<div className="full-height">{url && <SidebarReady url={url} />}</div>
</>
Expand Down
Loading