forked from lobehub/lobe-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor(layout): Refactor layout
- Loading branch information
1 parent
d73f13f
commit ace21f4
Showing
124 changed files
with
625 additions
and
603 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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
9 changes: 5 additions & 4 deletions
9
...desktop)/features/SessionList/Desktop.tsx → ...p/chat/(desktop)/features/SessionList.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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
'use client'; | ||
|
||
import { PropsWithChildren, memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import AppLayoutDesktop from '@/layout/AppLayout.desktop'; | ||
import { useSwitchSideBarOnInit } from '@/store/global'; | ||
import { SidebarTabKey } from '@/store/global/initialState'; | ||
|
||
import ResponsiveSessionList from './features/SessionList'; | ||
|
||
export default memo(({ children }: PropsWithChildren) => ( | ||
<AppLayoutDesktop> | ||
<ResponsiveSessionList /> | ||
<Flexbox | ||
flex={1} | ||
height={'100vh'} | ||
id={'lobe-conversion-container'} | ||
style={{ position: 'relative' }} | ||
> | ||
{children} | ||
</Flexbox> | ||
</AppLayoutDesktop> | ||
)); | ||
export default memo(({ children }: PropsWithChildren) => { | ||
useSwitchSideBarOnInit(SidebarTabKey.Chat); | ||
return ( | ||
<AppLayoutDesktop> | ||
<ResponsiveSessionList /> | ||
<Flexbox | ||
flex={1} | ||
height={'100vh'} | ||
id={'lobe-conversion-container'} | ||
style={{ position: 'relative' }} | ||
> | ||
{children} | ||
</Flexbox> | ||
</AppLayoutDesktop> | ||
); | ||
}); |
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 |
---|---|---|
@@ -1,15 +1,12 @@ | ||
'use client'; | ||
|
||
import { PropsWithChildren, memo } from 'react'; | ||
|
||
import ResponsiveLayout from '@/components/ResponsiveLayout'; | ||
import { useIsMobile } from '@/hooks/useIsMobile'; | ||
import ResponsiveLayout from '@/layout/ResponsiveLayout.client'; | ||
|
||
import Mobile from '../(mobile)/layout.mobile'; | ||
import Desktop from './layout.desktop'; | ||
|
||
export default memo(({ children }: PropsWithChildren) => ( | ||
<ResponsiveLayout Desktop={Desktop} Mobile={Mobile} isMobile={useIsMobile}> | ||
<ResponsiveLayout Desktop={Desktop} Mobile={Mobile}> | ||
{children} | ||
</ResponsiveLayout> | ||
)); |
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 |
---|---|---|
@@ -1 +1,54 @@ | ||
export { default } from '../../components/ChatHeader/Mobile'; | ||
import { ActionIcon, MobileNavBar, MobileNavBarTitle } from '@lobehub/ui'; | ||
import { LayoutList, Settings } from 'lucide-react'; | ||
import { useRouter } from 'next/navigation'; | ||
import { memo } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { MOBILE_HEADER_ICON_SIZE } from '@/const/layoutTokens'; | ||
import { useGlobalStore } from '@/store/global'; | ||
import { useSessionStore } from '@/store/session'; | ||
import { agentSelectors, sessionSelectors } from '@/store/session/selectors'; | ||
import { pathString } from '@/utils/url'; | ||
|
||
import ShareButton from '../../features/ChatHeader/ShareButton'; | ||
|
||
const MobileHeader = memo(() => { | ||
const { t } = useTranslation('common'); | ||
const router = useRouter(); | ||
|
||
const [isInbox, title] = useSessionStore((s) => [ | ||
sessionSelectors.isInboxSession(s), | ||
agentSelectors.currentAgentTitle(s), | ||
]); | ||
|
||
const [toggleConfig] = useGlobalStore((s) => [s.toggleMobileTopic]); | ||
|
||
const displayTitle = isInbox ? t('inbox.title') : title; | ||
|
||
return ( | ||
<MobileNavBar | ||
center={<MobileNavBarTitle title={displayTitle} />} | ||
onBackClick={() => router.push('/chat')} | ||
right={ | ||
<> | ||
<ShareButton /> | ||
<ActionIcon | ||
icon={LayoutList} | ||
onClick={() => toggleConfig()} | ||
size={MOBILE_HEADER_ICON_SIZE} | ||
/> | ||
{!isInbox && ( | ||
<ActionIcon | ||
icon={Settings} | ||
onClick={() => router.push(pathString('/chat/settings', { hash: location.hash }))} | ||
size={MOBILE_HEADER_ICON_SIZE} | ||
/> | ||
)} | ||
</> | ||
} | ||
showBackButton | ||
/> | ||
); | ||
}); | ||
|
||
export default MobileHeader; |
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 |
---|---|---|
@@ -1,14 +1,34 @@ | ||
import { createStyles } from 'antd-style'; | ||
import { memo } from 'react'; | ||
|
||
import { ChatInputContent } from '../../components/ChatInput'; | ||
import Mobile from '../../components/ChatInput/Mobile'; | ||
import SafeSpacing from '@/components/SafeSpacing'; | ||
import { CHAT_TEXTAREA_HEIGHT_MOBILE } from '@/const/layoutTokens'; | ||
|
||
const ChatInput = () => { | ||
import ChatInputContent from '../../features/ChatInputContent'; | ||
|
||
const useStyles = createStyles( | ||
({ css, token }) => css` | ||
position: fixed; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
width: 100vw; | ||
background: ${token.colorBgLayout}; | ||
`, | ||
); | ||
|
||
const ChatInputMobileLayout = memo(() => { | ||
const { styles } = useStyles(); | ||
return ( | ||
<Mobile> | ||
<ChatInputContent mobile /> | ||
</Mobile> | ||
<> | ||
<SafeSpacing height={CHAT_TEXTAREA_HEIGHT_MOBILE} mobile position={'bottom'} /> | ||
<div className={styles}> | ||
<ChatInputContent mobile /> | ||
</div> | ||
</> | ||
); | ||
}; | ||
}); | ||
|
||
export default memo(ChatInput); | ||
export default ChatInputMobileLayout; |
Oops, something went wrong.