Skip to content

Commit

Permalink
fix: handle fetch github stars errors (#4952)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagoapolo authored Jan 6, 2025
1 parent 60d042d commit 580dcae
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions frontend/web/components/GithubStar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const GithubStar: FC<GithubStarType> = ({}) => {
.then(function (res) {
setStars(res.stargazers_count)
})
.catch(() => {})
}
}, [planName])

Expand All @@ -29,20 +30,24 @@ const GithubStar: FC<GithubStarType> = ({}) => {
}

return (
<>
<a
style={{ width: 90 }}
target='_blank'
href='https://github.com/flagsmith/flagsmith'
className='btn btn-sm btn-with-icon text-body'
rel='noreferrer'
<a
style={{ width: 90 }}
target='_blank'
href='https://github.com/flagsmith/flagsmith'
className='btn btn-sm btn-with-icon text-body'
rel='noreferrer'
>
<div
className={
stars
? 'd-flex flex-row justify-content-center align-items-center'
: ''
}
>
<div className='d-flex flex-row justify-content-center align-items-center'>
<IonIcon style={{ fontSize: 16 }} icon={logoGithub} />
<div className='ms-1'>{stars}</div>
</div>
</a>
</>
<IonIcon style={{ fontSize: 16 }} icon={logoGithub} />
{stars && <div className='ms-1'>{stars}</div>}
</div>
</a>
)
}

Expand Down

0 comments on commit 580dcae

Please sign in to comment.