Remove group chat display
This commit is contained in:
parent
edb8591cab
commit
1ed46948b1
|
@ -144,24 +144,5 @@ const addUserToDefaultGroups = async (user: User) => {
|
||||||
.update({
|
.update({
|
||||||
memberIds: uniq(group.memberIds.concat(user.id)),
|
memberIds: uniq(group.memberIds.concat(user.id)),
|
||||||
})
|
})
|
||||||
const manifoldAccount = isProd()
|
|
||||||
? HOUSE_LIQUIDITY_PROVIDER_ID
|
|
||||||
: DEV_HOUSE_LIQUIDITY_PROVIDER_ID
|
|
||||||
|
|
||||||
if (slug === 'welcome') {
|
|
||||||
const welcomeCommentDoc = firestore
|
|
||||||
.collection(`groups/${group.id}/comments`)
|
|
||||||
.doc()
|
|
||||||
await welcomeCommentDoc.create({
|
|
||||||
id: welcomeCommentDoc.id,
|
|
||||||
groupId: group.id,
|
|
||||||
userId: manifoldAccount,
|
|
||||||
text: `Welcome, @${user.username} aka ${user.name}!`,
|
|
||||||
createdTime: Date.now(),
|
|
||||||
userName: 'Manifold Markets',
|
|
||||||
userUsername: MANIFOLD_USERNAME,
|
|
||||||
userAvatarUrl: MANIFOLD_AVATAR_URL,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,15 +18,14 @@ import { ManifoldLogo } from './manifold-logo'
|
||||||
import { MenuButton } from './menu'
|
import { MenuButton } from './menu'
|
||||||
import { ProfileSummary } from './profile-menu'
|
import { ProfileSummary } from './profile-menu'
|
||||||
import NotificationsIcon from 'web/components/notifications-icon'
|
import NotificationsIcon from 'web/components/notifications-icon'
|
||||||
import React, { useMemo, useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants'
|
import { IS_PRIVATE_MANIFOLD } from 'common/envs/constants'
|
||||||
import { CreateQuestionButton } from 'web/components/create-question-button'
|
import { CreateQuestionButton } from 'web/components/create-question-button'
|
||||||
import { useMemberGroups } from 'web/hooks/use-group'
|
import { useMemberGroups } from 'web/hooks/use-group'
|
||||||
import { groupPath } from 'web/lib/firebase/groups'
|
import { groupPath } from 'web/lib/firebase/groups'
|
||||||
import { trackCallback, withTracking } from 'web/lib/service/analytics'
|
import { trackCallback, withTracking } from 'web/lib/service/analytics'
|
||||||
import { Group, GROUP_CHAT_SLUG } from 'common/group'
|
import { Group } from 'common/group'
|
||||||
import { Spacer } from '../layout/spacer'
|
import { Spacer } from '../layout/spacer'
|
||||||
import { useUnseenPreferredNotifications } from 'web/hooks/use-notifications'
|
|
||||||
import { PrivateUser } from 'common/user'
|
import { PrivateUser } from 'common/user'
|
||||||
import { useWindowSize } from 'web/hooks/use-window-size'
|
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||||
import { CHALLENGES_ENABLED } from 'common/challenge'
|
import { CHALLENGES_ENABLED } from 'common/challenge'
|
||||||
|
@ -313,29 +312,29 @@ function GroupsList(props: {
|
||||||
memberItems: Item[]
|
memberItems: Item[]
|
||||||
privateUser: PrivateUser
|
privateUser: PrivateUser
|
||||||
}) {
|
}) {
|
||||||
const { currentPage, memberItems, privateUser } = props
|
const { currentPage, memberItems } = props
|
||||||
const preferredNotifications = useUnseenPreferredNotifications(
|
|
||||||
privateUser,
|
|
||||||
{
|
|
||||||
customHref: '/group/',
|
|
||||||
},
|
|
||||||
memberItems.length > 0 ? memberItems.length : undefined
|
|
||||||
)
|
|
||||||
|
|
||||||
const { height } = useWindowSize()
|
const { height } = useWindowSize()
|
||||||
const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null)
|
const [containerRef, setContainerRef] = useState<HTMLDivElement | null>(null)
|
||||||
const remainingHeight = (height ?? 0) - (containerRef?.offsetTop ?? 0)
|
const remainingHeight = (height ?? 0) - (containerRef?.offsetTop ?? 0)
|
||||||
|
|
||||||
const notifIsForThisItem = useMemo(
|
// const preferredNotifications = useUnseenPreferredNotifications(
|
||||||
() => (itemHref: string) =>
|
// privateUser,
|
||||||
preferredNotifications.some(
|
// {
|
||||||
(n) =>
|
// customHref: '/group/',
|
||||||
!n.isSeen &&
|
// },
|
||||||
(n.isSeenOnHref === itemHref ||
|
// memberItems.length > 0 ? memberItems.length : undefined
|
||||||
n.isSeenOnHref?.replace('/chat', '') === itemHref)
|
// )
|
||||||
),
|
// const notifIsForThisItem = useMemo(
|
||||||
[preferredNotifications]
|
// () => (itemHref: string) =>
|
||||||
)
|
// preferredNotifications.some(
|
||||||
|
// (n) =>
|
||||||
|
// !n.isSeen &&
|
||||||
|
// (n.isSeenOnHref === itemHref ||
|
||||||
|
// n.isSeenOnHref?.replace('/chat', '') === itemHref)
|
||||||
|
// ),
|
||||||
|
// [preferredNotifications]
|
||||||
|
// )
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -351,16 +350,12 @@ function GroupsList(props: {
|
||||||
>
|
>
|
||||||
{memberItems.map((item) => (
|
{memberItems.map((item) => (
|
||||||
<a
|
<a
|
||||||
href={
|
href={item.href}
|
||||||
item.href +
|
|
||||||
(notifIsForThisItem(item.href) ? '/' + GROUP_CHAT_SLUG : '')
|
|
||||||
}
|
|
||||||
key={item.name}
|
key={item.name}
|
||||||
onClick={trackCallback('sidebar: ' + item.name)}
|
onClick={trackCallback('sidebar: ' + item.name)}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'cursor-pointer truncate',
|
'cursor-pointer truncate',
|
||||||
'group flex items-center rounded-md px-3 py-2 text-sm font-medium text-gray-600 hover:bg-gray-100 hover:text-gray-900',
|
'group flex items-center rounded-md px-3 py-2 text-sm font-medium text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
||||||
notifIsForThisItem(item.href) && 'font-bold'
|
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{item.name}
|
{item.name}
|
||||||
|
|
|
@ -33,11 +33,9 @@ import { LoadingIndicator } from 'web/components/loading-indicator'
|
||||||
import { Modal } from 'web/components/layout/modal'
|
import { Modal } from 'web/components/layout/modal'
|
||||||
import { ChoicesToggleGroup } from 'web/components/choices-toggle-group'
|
import { ChoicesToggleGroup } from 'web/components/choices-toggle-group'
|
||||||
import { toast } from 'react-hot-toast'
|
import { toast } from 'react-hot-toast'
|
||||||
import { useCommentsOnGroup } from 'web/hooks/use-comments'
|
|
||||||
import { ContractSearch } from 'web/components/contract-search'
|
import { ContractSearch } from 'web/components/contract-search'
|
||||||
import { FollowList } from 'web/components/follow-list'
|
import { FollowList } from 'web/components/follow-list'
|
||||||
import { SearchIcon } from '@heroicons/react/outline'
|
import { SearchIcon } from '@heroicons/react/outline'
|
||||||
import { useTipTxns } from 'web/hooks/use-tip-txns'
|
|
||||||
import { JoinOrLeaveGroupButton } from 'web/components/groups/groups-button'
|
import { JoinOrLeaveGroupButton } from 'web/components/groups/groups-button'
|
||||||
import { searchInAny } from 'common/util/parse'
|
import { searchInAny } from 'common/util/parse'
|
||||||
import { CopyLinkButton } from 'web/components/copy-link-button'
|
import { CopyLinkButton } from 'web/components/copy-link-button'
|
||||||
|
@ -46,7 +44,6 @@ import { useSaveReferral } from 'web/hooks/use-save-referral'
|
||||||
import { Button } from 'web/components/button'
|
import { Button } from 'web/components/button'
|
||||||
import { listAllCommentsOnGroup } from 'web/lib/firebase/comments'
|
import { listAllCommentsOnGroup } from 'web/lib/firebase/comments'
|
||||||
import { GroupComment } from 'common/comment'
|
import { GroupComment } from 'common/comment'
|
||||||
import { GroupChat } from 'web/components/groups/group-chat'
|
|
||||||
import { REFERRAL_AMOUNT } from 'common/economy'
|
import { REFERRAL_AMOUNT } from 'common/economy'
|
||||||
|
|
||||||
export const getStaticProps = fromPropz(getStaticPropz)
|
export const getStaticProps = fromPropz(getStaticPropz)
|
||||||
|
@ -149,9 +146,6 @@ export default function GroupPage(props: {
|
||||||
const page = slugs?.[1] as typeof groupSubpages[number]
|
const page = slugs?.[1] as typeof groupSubpages[number]
|
||||||
|
|
||||||
const group = useGroup(props.group?.id) ?? props.group
|
const group = useGroup(props.group?.id) ?? props.group
|
||||||
const tips = useTipTxns({ groupId: group?.id })
|
|
||||||
|
|
||||||
const messages = useCommentsOnGroup(group?.id) ?? props.messages
|
|
||||||
|
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
|
@ -201,21 +195,12 @@ export default function GroupPage(props: {
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
||||||
const chatTab = (
|
|
||||||
<GroupChat messages={messages} group={group} user={user} tips={tips} />
|
|
||||||
)
|
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
title: 'Markets',
|
title: 'Markets',
|
||||||
content: questionsTab,
|
content: questionsTab,
|
||||||
href: groupPath(group.slug, 'markets'),
|
href: groupPath(group.slug, 'markets'),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Chat',
|
|
||||||
content: chatTab,
|
|
||||||
href: groupPath(group.slug, 'chat'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: 'Leaderboards',
|
title: 'Leaderboards',
|
||||||
content: leaderboard,
|
content: leaderboard,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user