-
Notifications
You must be signed in to change notification settings - Fork 4
New desktop layout #1395
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
Merged
Merged
New desktop layout #1395
Changes from all commits
Commits
Show all changes
141 commits
Select commit
Hold shift + click to select a range
f2ef1e7
wip
ragnep 61e990a
Merge branch 'main' into new-desktop-layout
ragnep 85ff25c
wip
ragnep 138d8bf
npm i
ragnep feba0ee
Merge branch 'main' into new-desktop-layout
ragnep 384e336
wip
ragnep c68d8d7
Merge branch 'main' into new-desktop-layout
ragnep 0c85c2c
wip
ragnep 9fb660d
Merge branch 'main' into new-desktop-layout
ragnep 1014c67
wip
ragnep 389ab86
Merge branch 'main' into new-desktop-layout
ragnep 31d083f
wip
ragnep a4624ed
wip
ragnep 478928e
wip
ragnep 0e7040b
wip
ragnep c2fb0e0
wip
ragnep f65ec8b
Merge branch 'main' into new-desktop-layout
ragnep 7b5bb23
wip
ragnep b48812a
wip
ragnep f5948ee
wip
ragnep 5cc16fa
wip
ragnep 0250417
wip
ragnep c0caa7e
wip
ragnep 10262d8
wip
ragnep 13a2a2a
wip
ragnep 8d6ddbe
wip
ragnep 4d1312e
wip
ragnep dd9cb0a
wip
ragnep 02885f9
wip
ragnep 8ad9239
wip
ragnep 3ae5bc2
wip
ragnep dd38780
wip
ragnep a72a52e
wip
ragnep 7baac29
wip
ragnep 260f9d5
wip
ragnep 51ff03b
Merge branch 'main' into new-desktop-layout
ragnep 2173911
wip
ragnep 95431eb
wip
ragnep d2ae494
wip
ragnep 6488833
wip
ragnep f47f2b6
wip
ragnep 43d33ac
wip
ragnep 54e4b73
wip
ragnep f0daf44
wip
ragnep 8e6ab15
wip
ragnep 17755c5
Merge branch 'main' into new-desktop-layout
ragnep 8325177
wip
ragnep a560541
merged main and solved conflicts
ragnep 291e791
wip
ragnep de23694
wip
ragnep 672ab73
wip
ragnep eeec44f
Merge branch 'main' into new-desktop-layout
ragnep 454b2c1
wip
ragnep 67714be
Merge branch 'main' into new-desktop-layout
ragnep c118fcf
wip
ragnep 1f84670
wip
ragnep 9774afe
wip
ragnep 77cacbe
wip
ragnep 7eabdd6
Merge branch 'main' into new-desktop-layout
ragnep 1f8ac75
wip
ragnep 3a2c56d
Merge branch 'main' into new-desktop-layout
ragnep e12f971
wip
ragnep 8081033
Merge branch 'main' into new-desktop-layout
ragnep 950bb10
wip
ragnep 85c3b8e
Merge branch 'main' into new-desktop-layout
ragnep 42c67bd
wip
ragnep aaf9f97
Merge branch 'main' into new-desktop-layout
ragnep 7d3ee20
wip
ragnep 2b60b6c
solved conflicts
ragnep fbceb12
wip
ragnep d9ca025
wip
ragnep bf6b63e
Merge branch 'main' into new-desktop-layout
ragnep 14c8877
wip
ragnep 4abfbf1
wip
ragnep 367c7d9
wip
ragnep dc841b5
wip
ragnep 73fc7db
wip
ragnep 944fb32
Merge branch 'main' into new-desktop-layout
ragnep 826a699
wip
ragnep a9ea668
wip
ragnep ad6cc5d
wip
ragnep 5f3b4fb
merged main and solved conflicts
ragnep f96b4ff
wip
ragnep 6c411d5
wip
ragnep c4d966a
wip
ragnep 8c5319b
wip
ragnep 42a4b28
wip
ragnep 70ed89d
wip
ragnep 845ee64
wip
ragnep a55ac70
Merge branch 'main' into new-desktop-layout
ragnep e50f167
wip
ragnep 6f93610
Merge branch 'main' into new-desktop-layout
ragnep 4075768
Merge branch 'main' into new-desktop-layout
ragnep 14d7a2d
wip
ragnep ae412d3
merged main
ragnep 7a4c713
wip
ragnep 2e3caf6
wip
ragnep bb4bc3c
wip
ragnep 7abcd37
wip
ragnep a7d7e9d
wip
ragnep ae05eb4
wip
ragnep a939e71
wip
ragnep 2709fea
wip
ragnep c10ccc4
wip
ragnep 5a21fb0
wip
ragnep 39d2688
Merge branch 'main' into new-desktop-layout
ragnep f69b1a2
wip
ragnep 42e5b44
wip
ragnep e78a61d
wip
ragnep b88cc05
Merge branch 'main' into new-desktop-layout
ragnep aaffbf9
wip
ragnep c8a15cf
wip
ragnep f43f33a
Merge branch 'main' into new-desktop-layout
ragnep 8776066
wip
ragnep 4fb0204
wip
ragnep a777dbd
wip
ragnep 17e531b
wip
ragnep b11457d
wip
ragnep 7359585
wip
ragnep fc982f9
wip
ragnep 5697789
layout max width
ragnep 3cc0d78
wip
ragnep 3098bf7
Merge branch 'main' into new-desktop-layout
ragnep 2b5d5d0
wip
ragnep 86c2e09
Merge branch 'main' into new-desktop-layout
ragnep 7dbe433
wip
ragnep 0bdaec4
wip
ragnep d95bff3
wip
ragnep 72bfe59
Merge branch 'main' into new-desktop-layout
ragnep 0a996fe
wip
ragnep f9865e4
wip
ragnep 4473b63
Merge branch 'main' into new-desktop-layout
ragnep 360f6c8
wip
ragnep a9ef21e
wip
ragnep c8f816d
wip
ragnep 331fadf
wip
ragnep 303f34f
wip
ragnep 353b44e
wip
ragnep e75509f
wip
ragnep dcb0a96
wip
ragnep 421ba96
wip
ragnep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,16 +1,77 @@ | ||
| "use client"; | ||
|
|
||
| import Footer from "@/components/footer/Footer"; | ||
| import { SIDEBAR_WIDTHS } from "@/constants/sidebar"; | ||
| import { usePathname } from "next/navigation"; | ||
| import { useEffect, useState } from "react"; | ||
| import useDeviceInfo from "./hooks/useDeviceInfo"; | ||
| import Footer from "@/components/footer/Footer"; | ||
| import { useSidebarController } from "./hooks/useSidebarController"; | ||
|
|
||
| export default function FooterWrapper() { | ||
| const { isApp } = useDeviceInfo(); | ||
| const pathname = usePathname(); | ||
| const [homeActiveTab, setHomeActiveTab] = useState<string>("latest"); | ||
| const { sidebarWidth, isMobile, isNarrow } = useSidebarController(); | ||
| useEffect(() => { | ||
| const win = (globalThis as typeof globalThis & { window?: Window }).window; | ||
| if (win === undefined) { | ||
| return; | ||
| } | ||
|
|
||
| const determineInitialTab = () => { | ||
| try { | ||
| const params = new URLSearchParams(win.location?.search ?? ""); | ||
| const tabFromQuery = params.get("tab"); | ||
| const savedTab = win.localStorage.getItem("home.activeTab"); | ||
| const resolvedTab = tabFromQuery ?? savedTab; | ||
| if (resolvedTab) { | ||
| setHomeActiveTab(resolvedTab); | ||
| } | ||
| } catch (error) { | ||
| console.warn("Failed to determine active home tab", error); | ||
| } | ||
| }; | ||
|
|
||
| determineInitialTab(); | ||
|
|
||
| const handleTabChange = (event: CustomEvent<{ tab?: string }>) => { | ||
| if (event.detail?.tab) { | ||
| setHomeActiveTab(event.detail.tab); | ||
| } | ||
| }; | ||
|
|
||
| win.addEventListener("homeTabChange", handleTabChange as EventListener); | ||
|
|
||
| return () => { | ||
| win.removeEventListener("homeTabChange", handleTabChange as EventListener); | ||
| }; | ||
| }, []); | ||
|
|
||
| const homeFeedTabActive = pathname === "/" && homeActiveTab === "feed"; | ||
| const myFeedRoutes = ["/my-feed", "/feed"]; | ||
|
|
||
| const hideFooter = | ||
| isApp || | ||
| ["/waves", "/my-stream", "/open-mobile"].some((path) => | ||
| homeFeedTabActive || | ||
| myFeedRoutes.some((path) => pathname?.startsWith(path)) || | ||
| ["/waves", "/messages", "/notifications", "/open-mobile"].some((path) => | ||
| pathname?.startsWith(path) | ||
| ); | ||
| return hideFooter ? null : <Footer />; | ||
|
|
||
| if (hideFooter) return null; | ||
|
|
||
| // App mode or small-screen web: no left-rail spacing | ||
| if (isApp || isMobile) return <Footer />; | ||
|
|
||
| // Desktop WebLayout: match main content's sidebar spacing | ||
| const sidebarSpacing = isNarrow ? SIDEBAR_WIDTHS.COLLAPSED : sidebarWidth; | ||
|
|
||
| return ( | ||
| <div | ||
| className="tw-w-full tw-max-w-[82.75rem] tw-mx-auto" | ||
| style={{ paddingLeft: sidebarSpacing }} | ||
| > | ||
| <Footer /> | ||
| </div> | ||
| ); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,40 +1,43 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| let useBreakpointMock = jest.fn(); | ||
|
|
||
| jest.mock('react-use', () => ({ | ||
| createBreakpoint: () => useBreakpointMock, | ||
| })); | ||
| import Brain from '@/components/brain/Brain'; | ||
|
|
||
| jest.mock('@/components/brain/BrainMobile', () => ({ | ||
| __esModule: true, | ||
| default: ({ children }: any) => <div data-testid="mobile">{children}</div>, | ||
| default: ({ children }: any) => <div data-testid='mobile'>{children}</div>, | ||
| })); | ||
|
|
||
| jest.mock('@/components/brain/BrainDesktop', () => ({ | ||
| __esModule: true, | ||
| default: ({ children }: any) => <div data-testid="desktop">{children}</div>, | ||
| default: ({ children }: any) => <div data-testid='desktop'>{children}</div>, | ||
| })); | ||
|
|
||
| import Brain from '@/components/brain/Brain'; | ||
| jest.mock('@/hooks/useDeviceInfo', () => ({ | ||
| __esModule: true, | ||
| default: jest.fn(), | ||
| })); | ||
|
|
||
| const useDeviceInfo = jest.requireMock('@/hooks/useDeviceInfo').default as jest.Mock; | ||
|
|
||
| describe('Brain', () => { | ||
| beforeEach(() => { | ||
| useBreakpointMock.mockReset(); | ||
| useDeviceInfo.mockReset(); | ||
| }); | ||
|
|
||
| it('renders mobile version when breakpoint is S', () => { | ||
| useBreakpointMock.mockReturnValue('S'); | ||
| it('renders mobile version when running inside the app', () => { | ||
| useDeviceInfo.mockReturnValue({ isApp: true }); | ||
| render(<Brain>child</Brain>); | ||
|
|
||
| expect(screen.getByTestId('mobile')).toBeInTheDocument(); | ||
| expect(screen.getByText('child')).toBeInTheDocument(); | ||
| expect(screen.queryByTestId('desktop')).not.toBeInTheDocument(); | ||
| expect(screen.queryByTestId('desktop')).toBeNull(); | ||
| }); | ||
|
|
||
| it('renders desktop version otherwise', () => { | ||
| useBreakpointMock.mockReturnValue('LG'); | ||
| useDeviceInfo.mockReturnValue({ isApp: false }); | ||
| render(<Brain>desk</Brain>); | ||
|
|
||
| expect(screen.getByTestId('desktop')).toBeInTheDocument(); | ||
| expect(screen.getByText('desk')).toBeInTheDocument(); | ||
| expect(screen.queryByTestId('mobile')).not.toBeInTheDocument(); | ||
| expect(screen.queryByTestId('mobile')).toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.