-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(art advisor): enable Milestone 1 (#10724)
* feat: display new home view by default, and allow override * refactor: extract Alpha indicator * feat: update alpha help text * feat: add a hyperlink to the #pdde-art-advisor channel Also inlines the Notion feedback board link. * test: conditional rendering of old/new home screen * feat: request 10 sections initially --------- Co-authored-by: Devon Blandin <[email protected]>
- Loading branch information
1 parent
14814f9
commit 863e0f1
Showing
7 changed files
with
148 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { screen } from "@testing-library/react-native" | ||
import * as ArtsyNativeModule from "app/NativeModules/ArtsyNativeModule" | ||
import { __globalStoreTestUtils__ } from "app/store/GlobalStore" | ||
import { renderWithWrappers } from "app/utils/tests/renderWithWrappers" | ||
import { HomeContainer } from "./HomeContainer" | ||
|
||
jest.mock("app/NativeModules/ArtsyNativeModule", () => ({ | ||
...jest.requireActual("app/NativeModules/ArtsyNativeModule"), | ||
ArtsyNativeModule: { | ||
ArtsyNativeModule: { | ||
isBetaOrDev: undefined, // set in each test condition below | ||
}, | ||
}, | ||
})) | ||
|
||
describe("conditional rendering of old vs new home screen", () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
describe("when running in beta or simulator", () => { | ||
beforeEach(() => (ArtsyNativeModule.ArtsyNativeModule.isBetaOrDev = true)) | ||
|
||
describe("when ARPreferLegacyHomeScreen is false", () => { | ||
beforeEach( | ||
() => __globalStoreTestUtils__?.injectFeatureFlags({ ARPreferLegacyHomeScreen: false }) | ||
) | ||
|
||
it("renders the NEW screen", () => { | ||
renderWithWrappers(<HomeContainer />) | ||
expect(screen.getByTestId("new-home-view-skeleton")).toBeOnTheScreen() | ||
}) | ||
}) | ||
|
||
describe("when ARPreferLegacyHomeScreen is true", () => { | ||
beforeEach( | ||
() => __globalStoreTestUtils__?.injectFeatureFlags({ ARPreferLegacyHomeScreen: true }) | ||
) | ||
|
||
it("renders the old screen", () => { | ||
renderWithWrappers(<HomeContainer />) | ||
expect(screen.queryByTestId("new-home-view-skeleton")).not.toBeOnTheScreen() | ||
}) | ||
}) | ||
}) | ||
|
||
describe("when NOT running in beta or simulator", () => { | ||
beforeEach(() => (ArtsyNativeModule.ArtsyNativeModule.isBetaOrDev = false)) | ||
|
||
describe("when ARPreferLegacyHomeScreen is false", () => { | ||
beforeEach( | ||
() => __globalStoreTestUtils__?.injectFeatureFlags({ ARPreferLegacyHomeScreen: false }) | ||
) | ||
|
||
it("renders the old screen", () => { | ||
renderWithWrappers(<HomeContainer />) | ||
expect(screen.queryByTestId("new-home-view-skeleton")).not.toBeOnTheScreen() | ||
}) | ||
}) | ||
|
||
describe("when ARPreferLegacyHomeScreen is true", () => { | ||
beforeEach( | ||
() => __globalStoreTestUtils__?.injectFeatureFlags({ ARPreferLegacyHomeScreen: true }) | ||
) | ||
|
||
it("renders the old screen", () => { | ||
renderWithWrappers(<HomeContainer />) | ||
expect(screen.queryByTestId("new-home-view-skeleton")).not.toBeOnTheScreen() | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/app/Scenes/HomeView/Components/AlphaVersionIndicator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Box, Join, LinkText, Spacer, Text } from "@artsy/palette-mobile" | ||
import { InfoButton } from "app/Components/Buttons/InfoButton" | ||
import { Linking } from "react-native" | ||
|
||
export const AlphaVersionIndicator: React.FC = () => { | ||
return ( | ||
<InfoButton | ||
titleElement={ | ||
<Text color="blue100" weight="medium"> | ||
Alpha | ||
</Text> | ||
} | ||
modalTitle="Home View" | ||
modalContent={ | ||
<Box py={1}> | ||
<Join separator={<Spacer y={2} />}> | ||
<Text variant="sm">Hello! 👋</Text> | ||
|
||
<Text variant="sm">This is an unreleased version of the app home screen.</Text> | ||
|
||
<Text variant="sm"> | ||
Please direct any feedback to the{" "} | ||
<LinkText | ||
fontWeight="bold" | ||
onPress={() => Linking.openURL("https://artsy.slack.com/archives/C07ANEV7RNV")} | ||
> | ||
#pdde-art-advisor | ||
</LinkText>{" "} | ||
channel in Slack, or to the{" "} | ||
<LinkText | ||
fontWeight="bold" | ||
onPress={() => | ||
Linking.openURL("https://www.notion.so/artsy/abc1123548504ae58051405627fb6c9f") | ||
} | ||
> | ||
Notion feedback board | ||
</LinkText> | ||
. | ||
</Text> | ||
|
||
<Text variant="sm"> | ||
To switch to the current production version, enable the feature flag for “ | ||
<Text fontWeight="bold">Prefer legacy home screen</Text>” in the admin settings. | ||
</Text> | ||
|
||
<LinkText | ||
onPress={() => | ||
Linking.openURL("https://www.notion.so/artsy/e9958451ea9d44c6b357aba6505c0abc") | ||
} | ||
> | ||
See more on how to switch back | ||
</LinkText> | ||
</Join> | ||
</Box> | ||
} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters