Show all groups on sidebar
This commit is contained in:
parent
a5812a5a73
commit
432ee387ec
|
@ -227,8 +227,6 @@ export default function Sidebar(props: { className?: string }) {
|
||||||
const currentPage = router.pathname
|
const currentPage = router.pathname
|
||||||
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
const privateUser = usePrivateUser()
|
|
||||||
// usePing(user?.id)
|
|
||||||
|
|
||||||
const navigationOptions = !user ? signedOutNavigation : getNavigation()
|
const navigationOptions = !user ? signedOutNavigation : getNavigation()
|
||||||
const mobileNavigationOptions = !user
|
const mobileNavigationOptions = !user
|
||||||
|
@ -236,11 +234,9 @@ export default function Sidebar(props: { className?: string }) {
|
||||||
: signedInMobileNavigation
|
: signedInMobileNavigation
|
||||||
|
|
||||||
const memberItems = (
|
const memberItems = (
|
||||||
useMemberGroups(
|
useMemberGroups(user?.id, undefined, {
|
||||||
user?.id,
|
by: 'mostRecentContractAddedTime',
|
||||||
{ withChatEnabled: true },
|
}) ?? []
|
||||||
{ by: 'mostRecentChatActivityTime' }
|
|
||||||
) ?? []
|
|
||||||
).map((group: Group) => ({
|
).map((group: Group) => ({
|
||||||
name: group.name,
|
name: group.name,
|
||||||
href: `${groupPath(group.slug)}`,
|
href: `${groupPath(group.slug)}`,
|
||||||
|
@ -274,13 +270,7 @@ export default function Sidebar(props: { className?: string }) {
|
||||||
{memberItems.length > 0 && (
|
{memberItems.length > 0 && (
|
||||||
<hr className="!my-4 mr-2 border-gray-300" />
|
<hr className="!my-4 mr-2 border-gray-300" />
|
||||||
)}
|
)}
|
||||||
{privateUser && (
|
<GroupsList currentPage={router.asPath} memberItems={memberItems} />
|
||||||
<GroupsList
|
|
||||||
currentPage={router.asPath}
|
|
||||||
memberItems={memberItems}
|
|
||||||
privateUser={privateUser}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Desktop navigation */}
|
{/* Desktop navigation */}
|
||||||
|
@ -295,23 +285,13 @@ export default function Sidebar(props: { className?: string }) {
|
||||||
|
|
||||||
{/* Spacer if there are any groups */}
|
{/* Spacer if there are any groups */}
|
||||||
{memberItems.length > 0 && <hr className="!my-4 border-gray-300" />}
|
{memberItems.length > 0 && <hr className="!my-4 border-gray-300" />}
|
||||||
{privateUser && (
|
<GroupsList currentPage={router.asPath} memberItems={memberItems} />
|
||||||
<GroupsList
|
|
||||||
currentPage={router.asPath}
|
|
||||||
memberItems={memberItems}
|
|
||||||
privateUser={privateUser}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function GroupsList(props: {
|
function GroupsList(props: { currentPage: string; memberItems: Item[] }) {
|
||||||
currentPage: string
|
|
||||||
memberItems: Item[]
|
|
||||||
privateUser: PrivateUser
|
|
||||||
}) {
|
|
||||||
const { currentPage, memberItems } = props
|
const { currentPage, memberItems } = props
|
||||||
|
|
||||||
const { height } = useWindowSize()
|
const { height } = useWindowSize()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user