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

Fix issue where creators page get rendered without css for fraction of second #129

Merged
merged 1 commit into from
Dec 22, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/layout/DefaultNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { useSidebarCollapsed } from '@/components/providers/SideBarCollapsedContext'
import { Drawer } from 'antd'
import clsx from 'clsx'
import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import { FunctionComponent, useEffect } from 'react'

const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const DefaultNav: FunctionComponent<{ className?: string }> = ({
className,
}) => {
const {
state: { collapsed },
hide,
} = useSidebarCollapsed()
const { asPath } = useRouter()

useEffect(() => hide(), [ asPath ])

return (
<Drawer
className={clsx('DfSideBar h-100', className)}
bodyStyle={{ padding: 0 }}
placement='left'
closable={false}
onClose={hide}
visible={!collapsed}
getContainer={false}
keyboard
>
<Menu />
</Drawer>
)
}

export default DefaultNav
20 changes: 20 additions & 0 deletions src/layout/HomeNav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Sider from 'antd/lib/layout/Sider'
import dynamic from 'next/dynamic'

const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const HomeNav = () => {
return (
<Sider
className='DfSider'
width='230'
trigger={null}
collapsible
collapsed={true}
>
<Menu />
</Sider>
)
}

export default HomeNav
40 changes: 5 additions & 35 deletions src/layout/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,21 @@
import React, { FunctionComponent, useEffect, useMemo } from 'react'
import { Layout, Drawer } from 'antd'
import React, { useMemo } from 'react'
import { Layout } from 'antd'
import { useSidebarCollapsed } from '../components/providers/SideBarCollapsedContext'
import { useRouter } from 'next/router'
import clsx from 'clsx'
import dynamic from 'next/dynamic'
import styles from './Sider.module.sass'
import { useCurrentAccount } from '../components/providers/MyExtensionAccountsContext'

const DefaultNav = dynamic(() => import('./DefaultNav'), { ssr: false })
const HomeNav = dynamic(() => import('./HomeNav'), { ssr: false })
const TopMenu = dynamic(() => import('../components/topMenu/TopMenu'), { ssr: false })
const Menu = dynamic(() => import('./SideMenu'), { ssr: false })

const { Sider, Content } = Layout
const { Content } = Layout
interface Props {
children: React.ReactNode
}

const HomeNav = () => {
return <Sider
className='DfSider'
width='230'
trigger={null}
collapsible
collapsed={true}
>
<Menu />
</Sider>
}

const DefaultNav: FunctionComponent<{ className?: string }> = ({ className }) => {
const { state: { collapsed }, hide } = useSidebarCollapsed()
const { asPath } = useRouter()

useEffect(() => hide(), [ asPath ])

return <Drawer
className={clsx('DfSideBar h-100', className)}
bodyStyle={{ padding: 0 }}
placement='left'
closable={false}
onClose={hide}
visible={!collapsed}
getContainer={false}
keyboard
>
<Menu />
</Drawer>
}

const Navigation = (props: Props): JSX.Element => {
const { children } = props
Expand Down
11 changes: 7 additions & 4 deletions src/layout/NextLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ import { MINUTES } from '../components/utils/index'
import dynamic from 'next/dynamic'
import AnalyticProvider from 'src/components/providers/AnalyticContext'
import { ChatContextWrapper } from 'src/components/providers/ChatContext'
import Navigation from './Navigation'

const Navigation = dynamic(() => import('./Navigation'), { ssr: false })
const ChatFloatingModal = dynamic(() => import('src/components/chat/ChatFloatingModal'), {
ssr: false
})
const ChatFloatingModal = dynamic(
() => import('src/components/chat/ChatFloatingModal'),
{
ssr: false,
}
)

const Page: React.FunctionComponent = ({ children }) => (
<>
Expand Down