mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-08-25 20:50:14 -05:00
fa page random small fixes
This commit is contained in:
@@ -10,6 +10,7 @@ import TextRows from "./TextRows"
|
||||
|
||||
const FATableRows = ({ freeAgent }) => {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const [imageError, setImageError] = useState(false)
|
||||
|
||||
const twitter = freeAgent.discord_user.twitter_name
|
||||
const playstyles = freeAgent.playstyles.reduce((acc, cur) => {
|
||||
@@ -42,7 +43,13 @@ const FATableRows = ({ freeAgent }) => {
|
||||
<Table.Cell width={4}>
|
||||
{twitter ? (
|
||||
<>
|
||||
<Image src={`https://avatars.io/twitter/${twitter}`} avatar />
|
||||
{!imageError && (
|
||||
<Image
|
||||
src={`https://avatars.io/twitter/${twitter}`}
|
||||
avatar
|
||||
onError={error => setImageError(true)}
|
||||
/>
|
||||
)}
|
||||
<span>
|
||||
<Link to={`/u/${freeAgent.discord_user.discord_id}`}>
|
||||
{freeAgent.discord_user.username}#
|
||||
@@ -70,8 +77,12 @@ const FATableRows = ({ freeAgent }) => {
|
||||
)}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<Icon name="twitter" size="large" style={{ color: "#1da1f2" }} />
|
||||
<a href={`https://twitter.com/${twitter}`}>{twitter}</a>
|
||||
{twitter && !imageError && (
|
||||
<>
|
||||
<Icon name="twitter" size="large" style={{ color: "#1da1f2" }} />
|
||||
<a href={`https://twitter.com/${twitter}`}>{twitter}</a>
|
||||
</>
|
||||
)}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span style={{ color: "#999999" }}>
|
||||
|
||||
4
react-ui/src/components/user/ProfileLists.js
vendored
4
react-ui/src/components/user/ProfileLists.js
vendored
@@ -20,7 +20,7 @@ const SensListItem = ({ sens }) => {
|
||||
)
|
||||
}
|
||||
|
||||
const ProfileLists = ({ user }) => {
|
||||
const ProfileLists = ({ user, imageError }) => {
|
||||
return (
|
||||
<>
|
||||
<Grid.Column>
|
||||
@@ -29,7 +29,7 @@ const ProfileLists = ({ user }) => {
|
||||
<List.Icon name="discord" size="large" />
|
||||
<List.Content>{`${user.username}#${user.discriminator}`}</List.Content>
|
||||
</List.Item>
|
||||
{user.twitter_name && (
|
||||
{user.twitter_name && !imageError && (
|
||||
<List.Item>
|
||||
<List.Icon name="twitter" size="large" />
|
||||
<List.Content>
|
||||
|
||||
14
react-ui/src/components/user/UserPage.js
vendored
14
react-ui/src/components/user/UserPage.js
vendored
@@ -25,6 +25,7 @@ const UserPage = () => {
|
||||
const [showSettings, setShowSettings] = useState(false)
|
||||
const [successMsg, setSuccessMsg] = useState(null)
|
||||
const [errorMsg, setErrorMsg] = useState(null)
|
||||
const [imageError, setImageError] = useState(false)
|
||||
|
||||
const handleError = error => {
|
||||
setErrorMsg(error.message)
|
||||
@@ -44,6 +45,8 @@ const UserPage = () => {
|
||||
useEffect(() => {
|
||||
if (loading || !data || !data.searchForUser) return
|
||||
document.title = `${data.searchForUser.username} - sendou.ink`
|
||||
|
||||
return () => setImageError(false)
|
||||
}, [loading, data])
|
||||
|
||||
if (loading || userLeanQuery.loading) return <Loading />
|
||||
@@ -85,24 +88,21 @@ const UserPage = () => {
|
||||
setTab(activeIndex)
|
||||
}
|
||||
|
||||
console.log("imageError", imageError)
|
||||
return (
|
||||
<>
|
||||
<>
|
||||
<Grid stackable columns={4}>
|
||||
<Grid.Column width={3}>
|
||||
{userData.twitter_name && (
|
||||
{userData.twitter_name && !imageError && (
|
||||
<Image
|
||||
src={`https://avatars.io/twitter/${userData.twitter_name}`}
|
||||
rounded
|
||||
onError={error =>
|
||||
console.error(
|
||||
`Couldn't fetch avatar image of ${userData.twitter_name}.`
|
||||
)
|
||||
}
|
||||
onError={error => setImageError(true)}
|
||||
/>
|
||||
)}
|
||||
</Grid.Column>
|
||||
<ProfileLists user={userData} />
|
||||
<ProfileLists user={userData} imageError={imageError} />
|
||||
<Grid.Column>
|
||||
{!showSettings &&
|
||||
userLeanQuery.data.user &&
|
||||
|
||||
@@ -7,6 +7,10 @@ function sendFAPostToDiscord(args) {
|
||||
.setName(args.user.username)
|
||||
.setColor("#2c5364")
|
||||
.addField("", `<@${args.user.discord_id}>`)
|
||||
.addField(
|
||||
"",
|
||||
`[User page on sendou.ink](https://sendou.ink/u/${args.user.discord_id})`
|
||||
)
|
||||
|
||||
if (args.can_vc) {
|
||||
const can_vc = args.can_vc.toLowerCase()
|
||||
@@ -20,7 +24,7 @@ function sendFAPostToDiscord(args) {
|
||||
)
|
||||
}
|
||||
|
||||
if (args.user.weapons) {
|
||||
if (args.user.weapons.length > 0) {
|
||||
msg.addField("Weapons", args.user.weapons.join(", "))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user