-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from alleslabs/fix/add-publish-event-mobile
fix(components): add mobile card for published events
- Loading branch information
Showing
14 changed files
with
215 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/lib/pages/module-details/components/tables/history/PublishedEventsTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { TableContainer } from "@chakra-ui/react"; | ||
|
||
import { useMobile } from "lib/app-provider"; | ||
import { Loading } from "lib/components/Loading"; | ||
import { MobileTableContainer } from "lib/components/table"; | ||
import type { ModuleHistory, Option } from "lib/types"; | ||
|
||
import { PublishedEventsTableHeader } from "./PublishedEventsTableHeader"; | ||
import { PublishedEventsTableMobileCard } from "./PublishedEventsTableMobileCard"; | ||
import { PublishedEventsTableRow } from "./PublishedEventsTableRow"; | ||
|
||
interface PublishedEventsTableProps { | ||
moduleHistories: Option<ModuleHistory[]>; | ||
isLoading: boolean; | ||
emptyState: JSX.Element; | ||
} | ||
|
||
export const PublishedEventsTable = ({ | ||
moduleHistories, | ||
isLoading, | ||
emptyState, | ||
}: PublishedEventsTableProps) => { | ||
const isMobile = useMobile(); | ||
|
||
if (isLoading) return <Loading withBorder />; | ||
if (!moduleHistories?.length) return emptyState; | ||
|
||
const templateColumns = "40px 180px minmax(300px, 1fr) 140px 260px"; | ||
|
||
return isMobile ? ( | ||
<MobileTableContainer> | ||
{moduleHistories.map((history) => ( | ||
<PublishedEventsTableMobileCard | ||
key={history.height} | ||
history={history} | ||
/> | ||
))} | ||
</MobileTableContainer> | ||
) : ( | ||
<TableContainer> | ||
<PublishedEventsTableHeader templateColumns={templateColumns} /> | ||
{moduleHistories.map((history) => ( | ||
<PublishedEventsTableRow | ||
key={JSON.stringify(history)} | ||
templateColumns={templateColumns} | ||
history={history} | ||
/> | ||
))} | ||
</TableContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/lib/pages/module-details/components/tables/history/PublishedEventsTableMobileCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Flex, Text } from "@chakra-ui/react"; | ||
|
||
import { ExplorerLink } from "lib/components/ExplorerLink"; | ||
import { MobileCardTemplate, MobileLabel } from "lib/components/table"; | ||
import type { ModuleHistory } from "lib/types"; | ||
import { dateFromNow, formatUTC } from "lib/utils"; | ||
|
||
import { PolicyChanges, RemarkRender } from "./PublishedEventsTableRow"; | ||
|
||
interface PublishedEventsTableMobileCardProps { | ||
history: ModuleHistory; | ||
} | ||
|
||
export const PublishedEventsTableMobileCard = ({ | ||
history, | ||
}: PublishedEventsTableMobileCardProps) => ( | ||
<MobileCardTemplate | ||
topContent={ | ||
<Flex direction="column" gap={3}> | ||
<Flex direction="column"> | ||
<MobileLabel label="Upgrade Policy Changes" /> | ||
<PolicyChanges history={history} /> | ||
</Flex> | ||
<Flex direction="column"> | ||
<MobileLabel label="Remark" /> | ||
<RemarkRender remark={history.remark} /> | ||
</Flex> | ||
</Flex> | ||
} | ||
middleContent={ | ||
<Flex direction="column" gap={3}> | ||
<Flex direction="column" flex="1"> | ||
<MobileLabel label="Block Height" /> | ||
{history.height === 0 ? ( | ||
<Text variant="body2" color="text.dark"> | ||
Genesis | ||
</Text> | ||
) : ( | ||
<ExplorerLink | ||
value={history.height.toString()} | ||
type="block_height" | ||
showCopyOnHover | ||
/> | ||
)} | ||
</Flex> | ||
<Flex direction="column"> | ||
<Text variant="body3">{formatUTC(history.timestamp)}</Text> | ||
<Text variant="body3" color="text.dark"> | ||
{`(${dateFromNow(history.timestamp)})`} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
} | ||
/> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
49b31f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
celatone-frontend-staging – ./
celatone-frontend-staging.vercel.app
celatone-frontend-staging-alleslabs.vercel.app
dev.celat.one
celatone-frontend-staging-git-develop-alleslabs.vercel.app
49b31f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
osmosis-celatone-frontend-staging – ./
osmosis-celatone-frontend-staging-alleslabs.vercel.app
osmosis-staging.celat.one
celatone-staging.osmosis.zone
osmosis-celatone-frontend-staging.vercel.app
osmosis-celatone-frontend-staging-git-develop-alleslabs.vercel.app
staging.osmoscan.io
49b31f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
stargaze-celatone-frontend-staging – ./
stargaze-celatone-frontend-staging.vercel.app
stargaze-celatone-frontend-staging-git-develop-alleslabs.vercel.app
stargaze-celatone-frontend-staging-alleslabs.vercel.app