From a4e185eedd7a14975cfe92fd20cb496e061a32d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sun, 30 Jun 2024 11:52:39 +0200 Subject: [PATCH] Remove navbar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/components/account.tsx | 52 +++ src/components/sidebar-menu.tsx | 298 ++++++++++-------- src/components/sidebar-navigation.tsx | 39 ++- src/components/ui/column/column.tsx | 2 +- src/components/ui/layout/layout.tsx | 4 +- src/features/ui/components/navbar.tsx | 161 ---------- .../components/panels/account-note-panel.tsx | 5 +- .../ui/components/panels/sign-up-panel.tsx | 98 +++++- src/features/ui/index.tsx | 11 +- src/locales/pl.json | 4 +- 10 files changed, 342 insertions(+), 332 deletions(-) delete mode 100644 src/features/ui/components/navbar.tsx diff --git a/src/components/account.tsx b/src/components/account.tsx index 79000cd24..82c0872fc 100644 --- a/src/components/account.tsx +++ b/src/components/account.tsx @@ -95,6 +95,7 @@ interface IAccount { emojiUrl?: string; note?: string; items?: React.ReactNode; + disabled?: boolean; } const Account = ({ @@ -122,6 +123,7 @@ const Account = ({ emojiUrl, note, items, + disabled, }: IAccount) => { const overflowRef = useRef(null); const actionRef = useRef(null); @@ -187,6 +189,56 @@ const Account = ({ onClick: (event: React.MouseEvent) => event.stopPropagation(), } : {}; + if (disabled) return ( +
+ + +
+ + {emoji && ( + + )} +
+ +
+ + + + {account.verified && } + + {account.bot && } + + + + + @{username} + + {account.pleroma?.favicon && ( + + )} + + {items} + + +
+
+ +
+ {renderAction()} +
+
+
+ ); + return (
diff --git a/src/components/sidebar-menu.tsx b/src/components/sidebar-menu.tsx index aea61f9a6..8a5d8b1e4 100644 --- a/src/components/sidebar-menu.tsx +++ b/src/components/sidebar-menu.tsx @@ -31,6 +31,8 @@ const messages = defineMessages({ addAccount: { id: 'profile_dropdown.add_account', defaultMessage: 'Add an existing account' }, followRequests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' }, close: { id: 'lightbox.close', defaultMessage: 'Close' }, + login: { id: 'account.login', defaultMessage: 'Log in' }, + register: { id: 'account.register', defaultMessage: 'Sign up' }, }); interface ISidebarLink { @@ -128,8 +130,6 @@ const SidebarMenu: React.FC = (): JSX.Element | null => { }); }, [sidebarOpen]); - if (!account) return null; - return (
{
- - - - - - - + {account ? ( - + + + - - {(account.locked || followRequestsCount > 0) && ( - - )} - - {features.bookmarks && ( - - )} - - {features.groups && ( - - )} - - {features.lists && ( - - )} - - {features.events && ( - - )} - - {draftCount > 0 && ( - - )} - - {features.publicTimeline && <> + : } + to={`/@${account.acct}`} + icon={require('@tabler/icons/outline/user.svg')} + text={intl.formatMessage(messages.profile)} onClick={onClose} /> - {features.federating && ( + {(account.locked || followRequestsCount > 0) && ( } + to='/follow_requests' + icon={require('@tabler/icons/outline/user-plus.svg')} + text={intl.formatMessage(messages.followRequests)} onClick={onClose} /> )} - } - + {features.bookmarks && ( + + )} + {features.groups && ( + + )} + + {features.lists && ( + + )} + + {features.events && ( + + )} + + {draftCount > 0 && ( + + )} + + {features.publicTimeline && <> + + + : } + onClick={onClose} + /> + + {features.federating && ( + } + onClick={onClose} + /> + )} + } + + + + + + {features.followedHashtagsList && ( + + )} + + {settings.get('isDeveloper') && ( + + )} + + + + + + + + + + + {switcher && ( +
+ {otherAccounts.map(account => renderAccount(account))} + + + + {intl.formatMessage(messages.addAccount)} + +
+ )} +
+
+
+ ) : ( + - {features.followedHashtagsList && ( - - )} - - {settings.get('isDeveloper') && ( - - )} - - - - - - - - - - {switcher && ( -
- {otherAccounts.map(account => renderAccount(account))} - - - - {intl.formatMessage(messages.addAccount)} - -
- )} -
-
+ )}
diff --git a/src/components/sidebar-navigation.tsx b/src/components/sidebar-navigation.tsx index 85f43e299..601c29275 100644 --- a/src/components/sidebar-navigation.tsx +++ b/src/components/sidebar-navigation.tsx @@ -1,11 +1,14 @@ import React from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; -import { Stack } from 'soapbox/components/ui'; +import { Icon, Stack } from 'soapbox/components/ui'; import { useStatContext } from 'soapbox/contexts/stat-context'; +import Search from 'soapbox/features/compose/components/search'; import ComposeButton from 'soapbox/features/ui/components/compose-button'; +import ProfileDropdown from 'soapbox/features/ui/components/profile-dropdown'; import { useAppSelector, useFeatures, useOwnAccount, useSettings, useInstance } from 'soapbox/hooks'; +import Account from './account'; import DropdownMenu, { Menu } from './dropdown-menu'; import SidebarNavigationLink from './sidebar-navigation-link'; @@ -142,6 +145,24 @@ const SidebarNavigation = () => { return ( + + {account && ( + +
+ + } + disabled + /> + +
+
+ +
+
+ )} + { /> )} + + {!account && ( + + } + /> + + } + /> + + )} {account && ( diff --git a/src/components/ui/column/column.tsx b/src/components/ui/column/column.tsx index efc6cba5e..1285d3982 100644 --- a/src/components/ui/column/column.tsx +++ b/src/components/ui/column/column.tsx @@ -102,7 +102,7 @@ const Column: React.FC = React.forwardRef((props, ref: React.ForwardedR backHref={backHref} className={clsx({ 'rounded-t-3xl': !isScrolled && !transparent, - 'sticky top-0 z-10 bg-white/90 dark:bg-primary-900/90 black:bg-black/80 backdrop-blur lg:top-16': !transparent, + 'sticky top-0 z-10 bg-white/90 dark:bg-primary-900/90 black:bg-black/80 backdrop-blur': !transparent, 'p-4 sm:p-0 sm:pb-4 black:p-4': transparent, '-mt-4 -mx-4 p-4': size !== 'lg' && !transparent, '-mt-4 -mx-4 p-4 sm:-mt-6 sm:-mx-6 sm:p-6': size === 'lg' && !transparent, diff --git a/src/components/ui/layout/layout.tsx b/src/components/ui/layout/layout.tsx index 710e3ed7e..6a7c3d407 100644 --- a/src/components/ui/layout/layout.tsx +++ b/src/components/ui/layout/layout.tsx @@ -31,7 +31,7 @@ const Layout: LayoutComponent = ({ children }) => ( /** Left sidebar container in the UI. */ const Sidebar: React.FC = ({ children }) => (
- + {children}
@@ -51,7 +51,7 @@ const Main: React.FC> = ({ children, classN /** Right sidebar container in the UI. */ const Aside: React.FC = ({ children }) => (