Remove deprecated useUserById implementation (#571)
* Remove duplicate useUserById implementation * fix bug: firebase doesn't accept empty paths
This commit is contained in:
parent
095af10d4f
commit
5ebd4498a0
|
@ -1,6 +1,6 @@
|
|||
import { DonationTxn } from 'common/txn'
|
||||
import { Avatar } from '../avatar'
|
||||
import { useUserById } from 'web/hooks/use-users'
|
||||
import { useUserById } from 'web/hooks/use-user'
|
||||
import { UserLink } from '../user-page'
|
||||
import { manaToUSD } from '../../../common/util/format'
|
||||
import { RelativeTimestamp } from '../relative-timestamp'
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
import { PrivateUser, User } from 'common/user'
|
||||
import {
|
||||
getUser,
|
||||
listenForAllUsers,
|
||||
listenForPrivateUsers,
|
||||
} from 'web/lib/firebase/users'
|
||||
|
@ -20,18 +19,6 @@ export const useUsers = () => {
|
|||
return users
|
||||
}
|
||||
|
||||
export const useUserById = (userId?: string) => {
|
||||
const [user, setUser] = useState<User | undefined>(undefined)
|
||||
|
||||
useEffect(() => {
|
||||
if (userId) {
|
||||
getUser(userId).then(setUser)
|
||||
}
|
||||
}, [userId])
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
export const usePrivateUsers = () => {
|
||||
const [users, setUsers] = useState<PrivateUser[]>([])
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import { fromPropz, usePropz } from 'web/hooks/use-propz'
|
|||
import { Leaderboard } from 'web/components/leaderboard'
|
||||
import { resolvedPayout } from 'common/calculate'
|
||||
import { formatMoney } from 'common/util/format'
|
||||
import { useUserById } from 'web/hooks/use-users'
|
||||
import { useUserById } from 'web/hooks/use-user'
|
||||
import { ContractTabs } from 'web/components/contract/contract-tabs'
|
||||
import { contractTextDetails } from 'web/components/contract/contract-details'
|
||||
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||
|
|
|
@ -6,7 +6,7 @@ import { claimManalink } from 'web/lib/firebase/api'
|
|||
import { useManalink } from 'web/lib/firebase/manalinks'
|
||||
import { ManalinkCard } from 'web/components/manalink-card'
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
import { useUserById } from 'web/hooks/use-users'
|
||||
import { useUserById } from 'web/hooks/use-user'
|
||||
import { firebaseLogin } from 'web/lib/firebase/users'
|
||||
|
||||
export default function ClaimPage() {
|
||||
|
@ -17,7 +17,7 @@ export default function ClaimPage() {
|
|||
const [claiming, setClaiming] = useState(false)
|
||||
const [error, setError] = useState<string | undefined>(undefined)
|
||||
|
||||
const fromUser = useUserById(manalink?.fromId)
|
||||
const fromUser = useUserById(manalink?.fromId ?? '_loading')
|
||||
if (!manalink) {
|
||||
return <></>
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Subtitle } from 'web/components/subtitle'
|
|||
import { useUser } from 'web/hooks/use-user'
|
||||
import { useUserManalinks } from 'web/lib/firebase/manalinks'
|
||||
import { fromNow } from 'web/lib/util/time'
|
||||
import { useUserById } from 'web/hooks/use-users'
|
||||
import { useUserById } from 'web/hooks/use-user'
|
||||
import { ManalinkTxn } from 'common/txn'
|
||||
import { Avatar } from 'web/components/avatar'
|
||||
import { RelativeTimestamp } from 'web/components/relative-timestamp'
|
||||
|
|
Loading…
Reference in New Issue
Block a user