From 6a2dd50236ca51f35441f542fc002c64c64b3ae5 Mon Sep 17 00:00:00 2001 From: Paul <paulmakles@gmail.com> Date: Sat, 10 Jul 2021 11:21:05 +0100 Subject: [PATCH] Fix: Don't lose focus on send. Sidebar: Show home button on mobile. --- .../common/messaging/MessageBox.tsx | 4 ++- .../navigation/left/HomeSidebar.tsx | 16 +++++------ .../navigation/left/ServerListSidebar.tsx | 28 +++++++++++-------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx index 228c2bf..12c432f 100644 --- a/src/components/common/messaging/MessageBox.tsx +++ b/src/components/common/messaging/MessageBox.tsx @@ -501,7 +501,9 @@ export default function MessageBox({ channel }: Props) { {/*<IconButton onClick={emojiPicker}> <HappyAlt size={20} /> </IconButton>*/} - <IconButton className="mobile" onClick={send}> + <IconButton + className="mobile" onClick={send} + onMouseDown={e => e.preventDefault()}> <Send size={20} /> </IconButton> </Action> diff --git a/src/components/navigation/left/HomeSidebar.tsx b/src/components/navigation/left/HomeSidebar.tsx index c4ef1e1..932bc6a 100644 --- a/src/components/navigation/left/HomeSidebar.tsx +++ b/src/components/navigation/left/HomeSidebar.tsx @@ -82,16 +82,16 @@ function HomeSidebar(props: Props) { <GenericSidebarBase padding> <ConnectionStatus /> <GenericSidebarList> + <ConditionalLink active={pathname === "/"} to="/"> + <ButtonItem active={pathname === "/"}> + <Home size={20} /> + <span> + <Text id="app.navigation.tabs.home" /> + </span> + </ButtonItem> + </ConditionalLink> {!isTouchscreenDevice && ( <> - <ConditionalLink active={pathname === "/"} to="/"> - <ButtonItem active={pathname === "/"}> - <Home size={20} /> - <span> - <Text id="app.navigation.tabs.home" /> - </span> - </ButtonItem> - </ConditionalLink> <ConditionalLink active={pathname === "/friends"} to="/friends"> diff --git a/src/components/navigation/left/ServerListSidebar.tsx b/src/components/navigation/left/ServerListSidebar.tsx index 2ca6c07..f8dd70e 100644 --- a/src/components/navigation/left/ServerListSidebar.tsx +++ b/src/components/navigation/left/ServerListSidebar.tsx @@ -28,6 +28,7 @@ import IconButton from "../../ui/IconButton"; import LineDivider from "../../ui/LineDivider"; import { mapChannelWithUnread } from "./common"; +import logoSVG from '../../../assets/logo.svg'; import { Children } from "../../../types/Preact"; import UserHover from "../../common/user/UserHover"; @@ -237,17 +238,22 @@ export function ServerListSidebar({ unreads, lastOpened }: Props) { active={homeActive} to={lastOpened.home ? `/channel/${lastOpened.home}` : "/"}> <ServerEntry home active={homeActive}> - <div - onContextMenu={attachContextMenu("Status")} - onClick={() => - homeActive && openContextMenu("Status") - }> - <UserHover user={self}> - <Icon size={42} unread={homeUnread}> - <UserIcon target={self} size={32} status /> - </Icon> - </UserHover> - </div> + { isTouchscreenDevice ? + <Icon size={42} unread={homeUnread}> + <img style={{ width: 32, height: 32 }} src={logoSVG} /> + </Icon> : + <div + onContextMenu={attachContextMenu("Status")} + onClick={() => + homeActive && openContextMenu("Status") + }> + <UserHover user={self}> + <Icon size={42} unread={homeUnread}> + <UserIcon target={self} size={32} status /> + </Icon> + </UserHover> + </div> + } <span /> </ServerEntry> </ConditionalLink> -- GitLab