<commit_before>import React, { useContext, useEffect } from "react"
import { Banner, Box, ClosedEyeIcon, Text } from "@artsy/palette"
import { ViewingRoomHeaderFragmentContainer as ViewingRoomHeader } from "./Components/ViewingRoomHeader"
import { ViewingRoomContentNotAccessibleFragmentContainer as ViewingRoomContentNotAccessible } from "./Components/ViewingRoomContentNotAccessible"
import { ViewingRoomTabBar } from "./Components/ViewingRoomTabBar"
import { createFragmentContainer, graphql } from "react-relay"

import { ViewingRoomApp_viewingRoom } from "v2/__generated__/ViewingRoomApp_viewingRoom.graphql"
import { ViewingRoomMetaFragmentContainer as ViewingRoomMeta } from "./Components/ViewingRoomMeta"
import { ErrorPage } from "v2/Components/ErrorPage"
import { openAuthModal } from "v2/Utils/openAuthModal"
import { SystemContext } from "v2/Artsy"
import { ModalType } from "v2/Components/Authentication/Types"
import { ContextModule, Intent } from "@artsy/cohesion"
import { useRouter } from "v2/Artsy/Router/useRouter"
import { userHasAccessToPartner } from "v2/Utils/user"

interface ViewingRoomAppProps {
  children: React.ReactNode
  viewingRoom: ViewingRoomApp_viewingRoom
}

const ViewingRoomApp: React.FC<ViewingRoomAppProps> = ({
  children,
  viewingRoom,
}) => {
  const { mediator, user } = useContext(SystemContext)
  const { router } = useRouter()
  useEffect(() => {
    if (user && user.id) return
    // @ts-expect-error STRICT_NULL_CHECK
    openAuthModal(mediator, {
      afterClose: () => {
        router.push("/viewing-rooms")
      },
      contextModule: ContextModule.viewingRoom,
      copy: "Sign up to enter viewing rooms",
      disableCloseOnBackgroundClick: true,
      intent: Intent.viewViewingRoom,
      mode: ModalType.signup,
      redirectTo: window.location.href,
    })
  }, [user, router, mediator])

  if (!viewingRoom) {
    return <ErrorPage code={404} />
  }

  const showPreview =<commit_msg>Remove login/signup gate on viewing rooms<commit_after>import React, { useContext } from "react"
import { Banner, Box, ClosedEyeIcon, Text } from "@artsy/palette"
import { ViewingRoomHeaderFragmentContainer as ViewingRoomHeader } from "./Components/ViewingRoomHeader"
import { ViewingRoomContentNotAccessibleFragmentContainer as ViewingRoomContentNotAccessible } from "./Components/ViewingRoomContentNotAccessible"
import { ViewingRoomTabBar } from "./Components/ViewingRoomTabBar"
import { createFragmentContainer, graphql } from "react-relay"

import { ViewingRoomApp_viewingRoom } from "v2/__generated__/ViewingRoomApp_viewingRoom.graphql"
import { ViewingRoomMetaFragmentContainer as ViewingRoomMeta } from "./Components/ViewingRoomMeta"
import { ErrorPage } from "v2/Components/ErrorPage"
import { SystemContext } from "v2/Artsy"
import { userHasAccessToPartner } from "v2/Utils/user"

interface ViewingRoomAppProps {
  children: React.ReactNode
  viewingRoom: ViewingRoomApp_viewingRoom
}

const ViewingRoomApp: React.FC<ViewingRoomAppProps> = ({
  children,
  viewingRoom,
}) => {
  const { user } = useContext(SystemContext)

  if (!viewingRoom) {
    return <ErrorPage code={404} />
  }

  const showPreview =
{'fraction_non_alphanumeric': 0.10063091482649843, 'fraction_numerical': 0.005362776025236593, 'mean_word_length': 5.3041749502982105, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4658317', 'n_tokens_mistral': 954, 'n_tokens_neox': 943, 'n_words': 209}