Skip to content

Commit

Permalink
Merge branch 'develop' into devx/cli-output-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
salaheldinsoliman authored Sep 23, 2024
2 parents 60a6394 + bc5e32f commit 2a753c8
Show file tree
Hide file tree
Showing 105 changed files with 4,728 additions and 2,681 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/_external_rust_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ env:

jobs:
rustfmt:
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
Expand All @@ -35,8 +34,7 @@ jobs:
cargo +nightly ci-fmt-external
cargo-deny:
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
name: cargo-deny (advisories, licenses, bans, ...)
runs-on: [self-hosted]
steps:
Expand All @@ -48,8 +46,7 @@ jobs:
use-git-cli: true

clippy:
if: |
!cancelled() && success('rustfmt', 'cargo-deny') && inputs.isRust
if: (!cancelled() && !failure() && inputs.isRust)
needs:
- rustfmt
- cargo-deny
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/_external_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
test:
name: Test external crates
needs: changes
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
Expand Down Expand Up @@ -74,8 +73,7 @@ jobs:
check-unused-deps:
name: Check Unused Dependencies (${{ matrix.flags }})
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
strategy:
matrix:
flags: ["--all-features", "--no-default-features"]
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/_rust_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ env:

jobs:
rustfmt:
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
Expand All @@ -34,8 +33,7 @@ jobs:
run: cargo +nightly ci-fmt

cargo-deny:
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
name: cargo-deny (advisories, licenses, bans, ...)
runs-on: [self-hosted]
steps:
Expand All @@ -47,8 +45,7 @@ jobs:
use-git-cli: true

clippy:
if: |
!cancelled() && success('rustfmt', 'cargo-deny') && inputs.isRust
if: (!cancelled() && !failure() && inputs.isRust)
needs:
- rustfmt
- cargo-deny
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/_rust_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ jobs:
test:
name: Test rust crates
needs: changes
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
env:
# Tests written with #[sim_test] are often flaky if run as #[tokio::test] - this var
# causes #[sim_test] to only run under the deterministic `simtest` job, and not the
Expand Down Expand Up @@ -68,8 +67,7 @@ jobs:
check-unused-deps:
name: Check Unused Dependencies (${{ matrix.flags }})
if: |
!cancelled() && inputs.isRust
if: (!cancelled() && inputs.isRust)
strategy:
matrix:
flags: ["--all-features", "--no-default-features"]
Expand Down
20 changes: 7 additions & 13 deletions .github/workflows/hierarchy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ jobs:
group: license-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
needs: diff
if: |
!cancelled() && needs.diff.outputs.isRust == 'true'
if: (!cancelled() && needs.diff.outputs.isRust == 'true')
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
Expand All @@ -64,14 +63,12 @@ jobs:

docusaurus:
needs: diff
if: |
!cancelled() && needs.diff.outputs.isDoc == 'true' && github.event.pull_request.draft == false
if: (!cancelled() && needs.diff.outputs.isDoc == 'true' && !github.event.pull_request.draft)
uses: ./.github/workflows/_docusaurus.yml

docs-lint:
needs: diff
if: |
!cancelled() && needs.diff.outputs.isDoc == 'true'
if: (!cancelled() && needs.diff.outputs.isDoc == 'true')
uses: ./.github/workflows/_docs_lint.yml

release-notes-description-check:
Expand All @@ -80,8 +77,7 @@ jobs:
group: release-notes-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
needs: diff
if: |
!cancelled() && needs.diff.outputs.isReleaseNotesEligible == 'true'
if: (!cancelled() && needs.diff.outputs.isReleaseNotesEligible == 'true')
runs-on: [self-hosted]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
Expand Down Expand Up @@ -115,8 +111,7 @@ jobs:
- license-check
- typos
if: |
!cancelled() &&
success('dprint-format', 'license-check', 'typos') &&
!cancelled() && !failure() &&
needs.diff.outputs.isRust == 'false' &&
needs.diff.outputs.isMove == 'true' &&
github.event.pull_request.draft == false
Expand All @@ -128,15 +123,14 @@ jobs:
- dprint-format
- license-check
- typos
if: |
!cancelled() && success('dprint-format', 'license-check', 'typos')
if: (!cancelled() && !failure())
uses: ./.github/workflows/_rust.yml
with:
isRust: ${{ needs.diff.outputs.isRust == 'true' }}
secrets: inherit

e2e:
if: github.event.pull_request.draft == false
if: (!cancelled() && !failure() && !github.event.pull_request.draft)
needs:
- diff
- dprint-format
Expand Down
10 changes: 5 additions & 5 deletions apps/explorer/src/components/activity/EpochsActivityTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useQuery } from '@tanstack/react-query';
import { useState } from 'react';

import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { generateTableDataFromEpochsData } from '~/lib/ui';
import { generateEpochsTableColumns } from '~/lib/ui';
import { numberSuffix } from '~/lib/utils';

const DEFAULT_EPOCHS_LIMIT = 20;
Expand Down Expand Up @@ -39,7 +39,7 @@ export function EpochsActivityTable({
const { data, isFetching, pagination, isPending, isError } =
useCursorPagination(epochMetricsQuery);

const cardData = data ? generateTableDataFromEpochsData(data) : undefined;
const tableColumns = generateEpochsTableColumns();

return (
<div className="flex flex-col space-y-3 text-left xl:pr-10">
Expand All @@ -48,7 +48,7 @@ export function EpochsActivityTable({
Failed to load Epochs
</div>
)}
{isPending || isFetching || !cardData ? (
{isPending || isFetching || !data?.data ? (
<PlaceholderTable
rowCount={limit}
rowHeight="16px"
Expand All @@ -63,8 +63,8 @@ export function EpochsActivityTable({
/>
) : (
<TableCard
data={cardData.data}
columns={cardData.columns}
data={data.data}
columns={tableColumns}
totalLabel={count ? `${numberSuffix(Number(count))} Total` : '-'}
viewAll={!disablePagination ? '/recent?tab=epochs' : undefined}
paginationOptions={!disablePagination ? pagination : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
useGetTransactionBlocks,
} from '~/hooks/useGetTransactionBlocks';
import { numberSuffix } from '~/lib/utils';
import { genTableDataFromTxData } from '../transactions/TxCardUtils';
import { Select } from '@iota/apps-ui-kit';
import { generateTransactionsTableColumns } from '~/lib/ui';

interface TransactionsActivityTableProps {
disablePagination?: boolean;
Expand Down Expand Up @@ -45,7 +45,7 @@ export function TransactionsActivityTable({
const { data, isFetching, pagination, isPending, isError } = useCursorPagination(transactions);
const goToFirstPageRef = useRef(pagination.onFirst);
goToFirstPageRef.current = pagination.onFirst;
const cardData = data ? genTableDataFromTxData(data.data) : undefined;
const tableColumns = generateTransactionsTableColumns();

useEffect(() => {
goToFirstPageRef.current();
Expand All @@ -58,16 +58,16 @@ export function TransactionsActivityTable({
</div>
)}
<div className="flex flex-col space-y-3 text-left">
{isPending || isFetching || !cardData ? (
{isPending || isFetching || !data?.data ? (
<PlaceholderTable
rowCount={limit}
rowHeight="16px"
colHeadings={['Digest', 'Sender', 'Txns', 'Gas', 'Time']}
/>
) : (
<TableCard
data={cardData.data}
columns={cardData.columns}
data={data.data}
columns={tableColumns}
totalLabel={count ? `${numberSuffix(Number(count))} Total` : '-'}
viewAll="/recent"
paginationOptions={!disablePagination ? pagination : undefined}
Expand Down
10 changes: 5 additions & 5 deletions apps/explorer/src/components/checkpoints/CheckpointsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useIotaClientQuery } from '@iota/dapp-kit';
import { useMemo, useState } from 'react';
import { PlaceholderTable, TableCard, useCursorPagination } from '~/components/ui';
import { DEFAULT_CHECKPOINTS_LIMIT, useGetCheckpoints } from '~/hooks/useGetCheckpoints';
import { generateTableDataFromCheckpointsData } from '~/lib/ui';
import { generateCheckpointsTableColumns } from '~/lib/ui';
import { numberSuffix } from '~/lib/utils';

interface CheckpointsTableProps {
Expand Down Expand Up @@ -45,7 +45,7 @@ export function CheckpointsTable({
}
}, [countQuery.data, initialCursor, maxCursor, checkpoints, isError]);

const cardData = data ? generateTableDataFromCheckpointsData(data) : undefined;
const tableColumns = generateCheckpointsTableColumns();

return (
<div className="flex flex-col gap-md text-left xl:pr-10">
Expand All @@ -54,16 +54,16 @@ export function CheckpointsTable({
Failed to load Checkpoints
</div>
)}
{isPending || isFetching || !cardData ? (
{isPending || isFetching || !data?.data ? (
<PlaceholderTable
rowCount={Number(limit)}
rowHeight="16px"
colHeadings={['Digest', 'Sequence Number', 'Time', 'Transaction Count']}
/>
) : (
<TableCard
data={cardData.data}
columns={cardData.columns}
data={data.data}
columns={tableColumns}
totalLabel={count ? `${numberSuffix(Number(count))} Total` : '-'}
viewAll={!disablePagination ? '/recent?tab=checkpoints' : undefined}
paginationOptions={
Expand Down
1 change: 1 addition & 0 deletions apps/explorer/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export * from './owned-objects';
export * from './search';
export * from './syntax-highlighter';
export * from './table';
export * from './toaster';
export * from './top-packages';
export * from './top-validators-card';
export * from './transaction-blocks-for-address';
Expand Down
29 changes: 2 additions & 27 deletions apps/explorer/src/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,11 @@ import { IotaClientProvider, WalletProvider } from '@iota/dapp-kit';
import type { Network } from '@iota/iota-sdk/client';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import { Fragment } from 'react';
import { resolveValue, Toaster, type ToastType } from 'react-hot-toast';
import { Outlet, ScrollRestoration } from 'react-router-dom';

import { NetworkContext } from '~/contexts';
import { useInitialPageView, useNetwork } from '~/hooks';
import { createIotaClient, persistableStorage, SupportedNetworks } from '~/lib/utils';
import { Banner, type BannerProps } from '~/components/ui';

const TOAST_VARIANTS: Partial<Record<ToastType, BannerProps['variant']>> = {
success: 'positive',
error: 'error',
};
import { Toaster } from '../toaster';

export function Layout(): JSX.Element {
const [network, setNetwork] = useNetwork();
Expand Down Expand Up @@ -47,25 +40,7 @@ export function Layout(): JSX.Element {
<KioskClientProvider>
<NetworkContext.Provider value={[network, setNetwork]}>
<Outlet />
<Toaster
position="bottom-center"
gutter={8}
containerStyle={{
top: 40,
left: 40,
bottom: 40,
right: 40,
}}
toastOptions={{
duration: 4000,
}}
>
{(toast) => (
<Banner shadow border variant={TOAST_VARIANTS[toast.type]}>
{resolveValue(toast.message, toast)}
</Banner>
)}
</Toaster>
<Toaster />
<ReactQueryDevtools />
</NetworkContext.Provider>
</KioskClientProvider>
Expand Down
4 changes: 1 addition & 3 deletions apps/explorer/src/components/object/ObjectFieldsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ export function ObjectFieldsCard({
>
<KeyValueInfo
keyText={name}
valueText={
getFieldTypeValue(type, objectType).displayName
}
value={getFieldTypeValue(type, objectType).displayName}
isTruncated
/>
</ButtonUnstyled>
Expand Down
6 changes: 4 additions & 2 deletions apps/explorer/src/components/owned-coins/CoinItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { KeyValueInfo } from '@iota/apps-ui-kit';
import { useFormatCoin } from '@iota/core';
import { type CoinStruct } from '@iota/iota-sdk/client';
import { formatAddress } from '@iota/iota-sdk/utils';
import { ObjectLink } from '../ui';

interface CoinItemProps {
coin: CoinStruct;
Expand All @@ -16,8 +17,9 @@ export default function CoinItem({ coin }: CoinItemProps): JSX.Element {
return (
<KeyValueInfo
keyText={`${formattedBalance} ${symbol}`}
valueLink={`/object/${coin.coinObjectId}`}
valueText={formatAddress(coin.coinObjectId)}
value={
<ObjectLink objectId={coin.coinObjectId} label={formatAddress(coin.coinObjectId)} />
}
fullwidth
/>
);
Expand Down
Loading

0 comments on commit 2a753c8

Please sign in to comment.