From b8d7c2ee17966bcc94b4ee15db2e960b31a6f8f1 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Mon, 11 Jul 2022 18:40:25 -0500 Subject: [PATCH] Size group chat window & nav bar list of groups precisely. Update Page margin/padding. --- web/components/groups/group-chat.tsx | 16 +++++++++++++--- web/components/nav/nav-bar.tsx | 4 ++-- web/components/nav/sidebar.tsx | 16 +++++++++++++--- web/components/page.tsx | 16 +++++++++++----- web/pages/group/[...slugs]/index.tsx | 6 +++--- web/pages/notifications.tsx | 2 +- 6 files changed, 43 insertions(+), 17 deletions(-) diff --git a/web/components/groups/group-chat.tsx b/web/components/groups/group-chat.tsx index 4a7e9e90..c98f1af1 100644 --- a/web/components/groups/group-chat.tsx +++ b/web/components/groups/group-chat.tsx @@ -22,6 +22,7 @@ import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns' import { Tipper } from 'web/components/tipper' import { sum } from 'lodash' import { formatMoney } from 'common/util/format' +import { useWindowSize } from 'web/hooks/use-window-size' export function GroupChat(props: { messages: Comment[] @@ -101,11 +102,20 @@ export function GroupChat(props: { inputRef?.focus() } + const { width, height } = useWindowSize() + const [containerRef, setContainerRef] = useState(null) + // Subtract bottom bar when it's showing (less than lg screen) + const bottomBarHeight = (width ?? 0) < 1024 ? 58 : 0 + const remainingHeight = + (height ?? window.innerHeight) - + (containerRef?.offsetTop ?? 0) - + bottomBarHeight + return ( - + @@ -138,7 +148,7 @@ export function GroupChat(props: { )} {user && group.memberIds.includes(user.id) && ( -
+
-
+
-
+
diff --git a/web/components/nav/sidebar.tsx b/web/components/nav/sidebar.tsx index 6ab095ef..253a58be 100644 --- a/web/components/nav/sidebar.tsx +++ b/web/components/nav/sidebar.tsx @@ -18,7 +18,7 @@ import { ManifoldLogo } from './manifold-logo' import { MenuButton } from './menu' import { ProfileSummary } from './profile-menu' import NotificationsIcon from 'web/components/notifications-icon' -import React, { useEffect } from 'react' +import React, { useEffect, useState } from 'react' import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants' import { CreateQuestionButton } from 'web/components/create-question-button' import { useMemberGroups } from 'web/hooks/use-group' @@ -29,6 +29,7 @@ import { Spacer } from '../layout/spacer' import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications' import { setNotificationsAsSeen } from 'web/pages/notifications' import { PrivateUser } from 'common/user' +import { useWindowSize } from 'web/hooks/use-window-size' function getNavigation() { return [ @@ -199,7 +200,7 @@ export default function Sidebar(props: { className?: string }) { return (