mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-11 16:49:28 -04:00
Clarify user assignment in profile-info.tsx and remove unused refreshProfile prop from ProfileCarousel.
This commit is contained in:
@@ -38,13 +38,16 @@ export function ProfileInfo(props: {
|
||||
fromProfilePage?: Profile
|
||||
fromSignup?: boolean
|
||||
}) {
|
||||
const {profile, user, refreshProfile, fromProfilePage, fromSignup} = props
|
||||
debug('Rendering Profile for', user.username, user.name, props)
|
||||
const {profile, refreshProfile, fromProfilePage, fromSignup} = props
|
||||
|
||||
const currentUser = useUser()
|
||||
const t = useT()
|
||||
// const currentProfile = useProfile()
|
||||
// const isCurrentUser = currentUser?.id === user.id
|
||||
|
||||
const isCurrentUser = currentUser?.id === props.user.id
|
||||
const user = isCurrentUser ? currentUser : props.user // to refresh user info after update
|
||||
|
||||
debug('Rendering Profile for', user.username, user.name, props)
|
||||
|
||||
const {data: starredUsers, refresh: refreshStars} = useGetter('stars', currentUser?.id, getStars)
|
||||
const starredUserIds = starredUsers?.map((u) => u.id)
|
||||
@@ -319,7 +322,7 @@ function ProfileContent(props: {
|
||||
|
||||
{currentUser && (
|
||||
// <ProfileCard className="!p-0">
|
||||
<ProfileCarousel profile={profile} refreshProfile={refreshProfile} />
|
||||
<ProfileCarousel profile={profile} />
|
||||
// </ProfileCard>
|
||||
)}
|
||||
|
||||
|
||||
@@ -99,3 +99,32 @@ export const useProfileByUserId = (userId: string | undefined) => {
|
||||
|
||||
return profile
|
||||
}
|
||||
//
|
||||
// async function getUserById(userId: string) {
|
||||
// const userRes = await run(
|
||||
// db
|
||||
// .from('users')
|
||||
// .select(`id, name, username, created_time, avatar_url, is_banned_from_posting`)
|
||||
// .eq('id', userId),
|
||||
// )
|
||||
// const user = userRes.data?.[0]
|
||||
// if (!user) return null
|
||||
// return convertPartialUser(user)
|
||||
// }
|
||||
//
|
||||
// export const useUserById = (userId: string | undefined) => {
|
||||
// const [user, setUser] = usePersistentInMemoryState<User | undefined | null>(
|
||||
// undefined,
|
||||
// `user-${userId}`,
|
||||
// )
|
||||
//
|
||||
// useEffect(() => {
|
||||
// if (userId) {
|
||||
// getUserById(userId).then((user) => {
|
||||
// setUser(user ?? null)
|
||||
// })
|
||||
// }
|
||||
// }, [userId])
|
||||
//
|
||||
// return user
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user