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

feat(works-for-you): includes login prompt when logged out #13572

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Apps/NewForYou/Components/NewForYouArtworksGrid.tsx
Expand Up @@ -20,7 +20,7 @@ export const NewForYouArtworksGrid: FC<NewForYouArtworksGridProps> = ({
columnCount={[2, 3, 4]}
/>
) : (
<Text variant="lg" mt={4} color="black60">
<Text variant="lg-display" mt={4} color="black60">
Nothing yet.
</Text>
)}
Expand Down
30 changes: 23 additions & 7 deletions src/Apps/WorksForYou/WorksForYouApp.tsx
Expand Up @@ -18,6 +18,9 @@ import { WorksForYouArtistFeedPaginationContainer } from "./Components/WorksForY
import { useRouter } from "System/Router/useRouter"
import { extractNodes } from "Utils/extractNodes"
import { RouterLink } from "System/Router/RouterLink"
import { LogInPrompt } from "Apps/Components/LogInPrompt"
import { AuthContextModule, ContextModule } from "@artsy/cohesion"
import { useSystemContext } from "System/SystemContext"

interface WorksForYouProps {
viewerArtist: WorksForYouApp_viewerArtist$data
Expand All @@ -30,6 +33,8 @@ const WorksForYouApp: React.FC<WorksForYouProps> = ({
viewerFeed,
viewerMe,
}) => {
const { isLoggedIn } = useSystemContext()

const { router } = useRouter()

const followedArtists = extractNodes(
Expand Down Expand Up @@ -63,16 +68,27 @@ const WorksForYouApp: React.FC<WorksForYouProps> = ({

<Spacer y={2} />

<LogInPrompt
contextModule={
ContextModule.recommendedWorksForYouRail as AuthContextModule
}
/>

{savedArtworks.length === 0 ? (
<>
<Text variant="lg-display">Nothing yet.</Text>
<Text variant="lg-display" color="black60" mt={1}>
Follow{" "}
<RouterLink color="black60" to="/artists">
some artists
</RouterLink>
.
<Text variant="lg-display" color="black60">
Nothing yet.
</Text>

{isLoggedIn && (
<Text variant="lg-display" color="black60" mt={1}>
Follow{" "}
<RouterLink color="black60" to="/artists">
some artists
</RouterLink>
.
</Text>
)}
</>
) : (
<GridColumns>
Expand Down
5 changes: 0 additions & 5 deletions src/Apps/WorksForYou/worksForYouRoutes.tsx
Expand Up @@ -13,11 +13,6 @@ export const worksForYouRoutes: AppRouteConfig[] = [
{
path: "/works-for-you/:artistSlug?",
getComponent: () => WorksForYouApp,
onServerSideRender: ({ req, res }) => {
if (!req.user) {
res.redirect("/")
}
},
onClientSideRender: () => {
WorksForYouApp.preload()
},
Expand Down