Skip to content

Commit

Permalink
fix: mobile need login modal
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Dec 3, 2024
1 parent 779a120 commit 0fb16f2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { Outlet } from "react-router"

import { useLoginModalShow, useWhoami } from "~/atoms/user"
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { DeclarativeModal } from "~/components/ui/modal/stacked/declarative-modal"
import { useDailyTask } from "~/hooks/biz/useDailyTask"
import { LoginModalContent } from "~/modules/auth/LoginModalContent"

import { NewUserGuide } from "./index.shared"

export const MobileRootLayout = () => {
useDailyTask()

const isAuthFail = useLoginModalShow()
const user = useWhoami()
return (
<>
<Outlet />
<NewUserGuide />

{isAuthFail && !user && (
<RootPortal>
<DeclarativeModal
id="login"
CustomModalComponent={PlainModal}
open
overlay
title="Login"
canClose={false}
clickOutsideToDismiss={false}
>
<LoginModalContent canClose={false} runtime={"browser"} />
</DeclarativeModal>
</RootPortal>
)}
</>
)
}
25 changes: 0 additions & 25 deletions apps/renderer/src/modules/app-layout/feed-column/mobile.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Logo } from "@follow/components/icons/logo.js"
import { ActionButton } from "@follow/components/ui/button/index.js"
import { RootPortal } from "@follow/components/ui/portal/index.js"
import { views } from "@follow/constants"
import { IN_ELECTRON } from "@follow/shared/constants"
import { cn } from "@follow/utils/utils"
import useEmblaCarousel from "embla-carousel-react"
import type { FC } from "react"
Expand All @@ -11,11 +9,7 @@ import { useTranslation } from "react-i18next"
import { Link } from "react-router"

import { useSetSidebarActiveView, useSidebarActiveView } from "~/atoms/sidebar"
import { useLoginModalShow, useWhoami } from "~/atoms/user"
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
import { DeclarativeModal } from "~/components/ui/modal/stacked/declarative-modal"
import { getRouteParams } from "~/hooks/biz/useRouteParams"
import { LoginModalContent } from "~/modules/auth/LoginModalContent"

import { FeedList } from "../../feed-column/list"
import { FooterInfo } from "./components/FooterInfo"
Expand All @@ -34,9 +28,6 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {

const [feedListScrollRef, setFeedListScrollRef] = useState<HTMLDivElement | null>()

const isAuthFail = useLoginModalShow()
const user = useWhoami()

const { t } = useTranslation()

return (
Expand Down Expand Up @@ -73,22 +64,6 @@ export function FeedColumnMobile({ asWidget }: { asWidget?: boolean }) {
</SwipeWrapper>
</div>

{isAuthFail && !user && (
<RootPortal>
<DeclarativeModal
id="login"
CustomModalComponent={PlainModal}
open
overlay
title="Login"
canClose={false}
clickOutsideToDismiss={false}
>
<LoginModalContent canClose={false} runtime={IN_ELECTRON ? "app" : "browser"} />
</DeclarativeModal>
</RootPortal>
)}

<FooterInfo />
<MobileFloatBar
className={asWidget ? "!bottom-0" : undefined}
Expand Down

0 comments on commit 0fb16f2

Please sign in to comment.