Skip to content

Commit

Permalink
Merge branch '410-merge-version-and-contract-loading-circle-in-watche…
Browse files Browse the repository at this point in the history
…r-and-guard' into 'dev'

fix: unified loading circles across app version, UI and contract

Closes #410

See merge request ergo/rosen-bridge/ui!335
  • Loading branch information
vorujack committed Nov 11, 2024
2 parents bf3b53b + b271ea2 commit c8736e0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilly-cycles-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rosen-bridge/ui-kit': patch
---

Unified loading spinners across app versions, UI and contract displays
41 changes: 23 additions & 18 deletions packages/ui-kit/src/components/common/AppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ const Root = styled(Box)(({ theme }) => ({
* renders a appBar wrapper
* this component set the appBar size and orientation in different screen sizes
*/
export const AppBar: FC<AppBarProps> = (props) => {
const { children, logo, routes, versions, isActive, onNavigate } = props;
export const AppBar: FC<AppBarProps> = ({
children,
logo,
routes,
versions = [],
isActive,
onNavigate,
}) => {
const loadingVersions = versions.every((version) => version.value);
return (
<Root>
{children}
Expand Down Expand Up @@ -74,25 +81,23 @@ export const AppBar: FC<AppBarProps> = (props) => {
))}
</Grid>
)}
{versions &&
{loadingVersions ? (
versions.map((version) => (
<Grid key={version.title} item>
{version.value && (
<Typography
color={version.important ? 'textPrimary' : 'textSecondary'}
textAlign="center"
variant={version.important ? 'body2' : 'subtitle2'}
>
{version.title} v{version.value}
</Typography>
)}
{!version.value && (
<Grid mb={1} container justifyContent="center">
<CircularProgress size={8} sx={{ alignSelf: 'center' }} />
</Grid>
)}
<Typography
color={version.important ? 'textPrimary' : 'textSecondary'}
textAlign="center"
variant={version.important ? 'body2' : 'subtitle2'}
>
{version.title} v{version.value}
</Typography>
</Grid>
))}
))
) : (
<Grid mb={1} container justifyContent="center">
<CircularProgress size={8} sx={{ alignSelf: 'center' }} />
</Grid>
)}
</Root>
);
};

0 comments on commit c8736e0

Please sign in to comment.