Skip to content

Commit

Permalink
fix: move getUserProfileUrl function to another file
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp committed Jul 3, 2023
1 parent 853d93b commit 992ef63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
7 changes: 6 additions & 1 deletion src/components/Proposal/Comments/ProposalComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ import React from 'react'
import DOMPurify from 'dompurify'
import isEthereumAddress from 'validator/lib/isEthereumAddress'

import { getUserProfileUrl } from '../../../entities/User/utils'
import { FORUM_URL } from '../../../constants'
import useProfile from '../../../hooks/useProfile'
import Time from '../../../utils/date/Time'
import locations from '../../../utils/locations'
import Avatar from '../../Common/Avatar'
import Link from '../../Common/Typography/Link'
import Text from '../../Common/Typography/Text'
import ValidatedProfile from '../../Icon/ValidatedProfile'

import './ProposalComment.css'

function getUserProfileUrl(user: string, address?: string) {
return address ? locations.profile({ address }) : `${FORUM_URL}/u/${user}`
}

type Props = {
user: string
avatarUrl: string
Expand Down
5 changes: 0 additions & 5 deletions src/entities/User/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { hashMessage, recoverAddress } from 'ethers/lib/utils'
import { DiscoursePostInTopic } from '../../clients/Discourse'
import { FORUM_URL } from '../../constants'
import { env } from '../../utils/env'
import locations from '../../utils/locations'
import { ProposalComment, ProposalCommentsInDiscourse } from '../Proposal/types'
import { isSameAddress } from '../Snapshot/utils'

Expand All @@ -18,10 +17,6 @@ function getDefaultAvatarSizeUrl(avatar_url: string) {
return avatar_url.replace('{size}', DEFAULT_AVATAR_SIZE)
}

export function getUserProfileUrl(user: string, address?: string) {
return address ? locations.profile({ address }) : `${FORUM_URL}/u/${user}`
}

function getAvatarUrl(post: DiscoursePostInTopic) {
const defaultSizeUrl = getDefaultAvatarSizeUrl(post.avatar_template)
return defaultSizeUrl.includes('letter') ? defaultSizeUrl : FORUM_URL + defaultSizeUrl
Expand Down

0 comments on commit 992ef63

Please sign in to comment.