Skip to content

Commit

Permalink
Merge branch 'develop' into tooling-general/use-action-gh-release-action
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 authored Nov 28, 2024
2 parents a78ae6e + baed3f7 commit 8fd97c4
Show file tree
Hide file tree
Showing 58 changed files with 3,155 additions and 121 deletions.
5 changes: 5 additions & 0 deletions .github/actions/diffs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ outputs:
isMove:
description: True when changes happened to the Move code
value: "${{ steps.diff.outputs.isMove }}"
isExternalCrates:
description: True when changes happened in external crates
value: "${{ steps.diff.outputs.isExternalCrates }}"
isReleaseNotesEligible:
description: True when changes happened in Release Notes eligible paths
value: "${{ steps.diff.outputs.isReleaseNotesEligible }}"
Expand Down Expand Up @@ -56,6 +59,8 @@ runs:
- "examples/**"
- "iota_programmability/**"
- ".github/workflows/_move_tests.yml"
isExternalCrates:
- "external-crates/move/crates/**"
isReleaseNotesEligible:
- "consensus/**"
- "crates/**"
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/_move_ide.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Move IDE

on: workflow_call

concurrency:
group: move-ide-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
move-auto-formatter-test:
name: Move Auto-formatter Test
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # [email protected]
with:
node-version: "20"

- name: Install dependencies
working-directory: ./external-crates/move/crates/move-analyzer/prettier-plugin
run: npm install && npm i web-tree-sitter

- name: Run npm test
working-directory: ./external-crates/move/crates/move-analyzer/prettier-plugin
shell: bash
run: npm run test

move-ide-test:
name: Move IDE Test
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # [email protected]
with:
node-version: "20"

- name: Install dependencies and start Xvfb (emulate a display so VS Code can be started)
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: |
sudo apt install libgtk-3-0 -y
sudo apt-get install -y xvfb x11-apps x11-xkb-utils libx11-6 libx11-xcb1
set -eux
# Start server
/usr/bin/Xvfb :99 -screen 0 1024x768x24 &
sleep 1
ps aux | grep Xvfb --color=always | grep -v grep
sudo add-apt-repository ppa:kisak/kisak-mesa -y
sudo apt update
sudo apt upgrade -y
npm install && npm install --save-dev @types/node @types/semver
- name: Build move-analyzer
run: |
cargo build --bin move-analyzer
mkdir -p ~/.iota/bin
cp ./target/debug/move-analyzer* ~/.iota/bin
- name: Run npm test
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
shell: bash
run: npm run pretest && DISPLAY=:99.0 npm run test

move-vscode-extension-build:
name: Move VSCode extension build
runs-on: [self-hosted]

steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.iota_repo_ref || github.ref }}

- name: Setup Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # [email protected]
with:
node-version: "20"

- name: Install dependencies
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: npm install && npm install --save-dev @types/node @types/semver

- name: Build VSCode extension
working-directory: ./external-crates/move/crates/move-analyzer/editors/code
run: npm run package
10 changes: 10 additions & 0 deletions .github/workflows/hierarchy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
isMove: ${{ steps.diff.outputs.isMove }}
isDoc: ${{ steps.diff.outputs.isDoc }}
isReleaseNotesEligible: ${{ steps.diff.outputs.isReleaseNotesEligible }}
isExternalCrates: ${{ steps.diff.outputs.isExternalCrates }}
isWallet: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-wallet')) }}
isExplorer: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), 'iota-explorer')) }}
isTypescriptSDK: ${{ (steps.turbo.outputs.packages && contains(fromJson(steps.turbo.outputs.packages), '@iota/iota-sdk')) }}
Expand Down Expand Up @@ -148,3 +149,12 @@ jobs:
- typos
uses: ./.github/workflows/_ledgernano.yml
secrets: inherit

move-ide:
if: (!cancelled() && !failure()) && needs.diff.outputs.isExternalCrates == 'true' && github.event.pull_request.draft == false
needs:
- diff
- dprint-format
- license-check
- typos
uses: ./.github/workflows/_move_ide.yml
37 changes: 12 additions & 25 deletions apps/wallet-dashboard/app/(protected)/activity/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@
'use client';

import React from 'react';
import { useCurrentAccount } from '@iota/dapp-kit';
import { VirtualList, TransactionTile } from '@/components';
import { useQueryTransactionsByAddress } from '@iota/core';
import { getExtendedTransaction } from '@/lib/utils/transaction';
import { IotaTransactionBlockResponse } from '@iota/iota-sdk/client';
import { Panel, Title, TitleSize } from '@iota/apps-ui-kit';
import { TransactionsList } from '@/components';

function ActivityPage(): JSX.Element {
const currentAccount = useCurrentAccount();
const { data: transactions, error } = useQueryTransactionsByAddress(currentAccount?.address);

if (error) {
return <div>{error?.message}</div>;
}

const virtualItem = (rawTransaction: IotaTransactionBlockResponse): JSX.Element => {
const transaction = getExtendedTransaction(rawTransaction, currentAccount?.address || '');
return <TransactionTile transaction={transaction} />;
};

return (
<div className="flex h-full w-full flex-col items-center justify-center space-y-4 pt-12">
<h1>Your Activity</h1>
<div className="flex w-1/2">
<VirtualList
items={transactions || []}
estimateSize={() => 100}
render={virtualItem}
/>
<div className="flex justify-center">
<div className="w-3/4">
<Panel>
<div className="pt-md">
<Title title="Activity" size={TitleSize.Medium} />
</div>
<div className="px-sm pb-md pt-sm">
<TransactionsList />
</div>
</Panel>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/app/(protected)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function DashboardLayout({ children }: PropsWithChildren): JSX.Element {
};

return (
<div className="h-full">
<div className="min-h-full">
<div className="fixed left-0 top-0 z-50 h-full">
<Sidebar />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-dashboard/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

html,
body {
height: 100%;
min-height: 100%;
@apply bg-gray-100 dark:bg-gray-900;
@apply text-gray-900 dark:text-gray-100;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function DetailsView({
<Card type={CardType.Filled}>
<CardImage>
<ImageIcon
src={null}
src={validatorSummary?.imageUrl ?? null}
label={validatorName}
fallback={validatorName}
size={ImageIconSize.Large}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export function Validator({
isSelected,
showAction = true,
}: ValidatorProps) {
const { name, newValidator, isAtRisk, apy, isApyApproxZero } = useValidatorInfo({
validatorAddress: address,
});
const { name, newValidator, isAtRisk, apy, isApyApproxZero, validatorSummary } =
useValidatorInfo({
validatorAddress: address,
});

const subtitle = showActiveStatus ? (
<div className="flex items-center gap-1">
Expand All @@ -47,7 +48,12 @@ export function Validator({
return (
<Card type={isSelected ? CardType.Filled : CardType.Default} onClick={handleClick}>
<CardImage>
<ImageIcon src={null} label={name} fallback={name} size={ImageIconSize.Large} />
<ImageIcon
src={validatorSummary?.imageUrl ?? null}
label={name}
fallback={name}
size={ImageIconSize.Large}
/>
</CardImage>
<CardBody title={name} subtitle={subtitle} isTextTruncated />
{showAction && (
Expand Down
40 changes: 40 additions & 0 deletions apps/wallet-dashboard/components/Toaster.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import toast, { Toaster as ToasterLib, type ToastType, resolveValue } from 'react-hot-toast';
import { Snackbar, SnackbarType } from '@iota/apps-ui-kit';

export type ToasterProps = {
bottomNavEnabled?: boolean;
};

export function Toaster() {
function getSnackbarType(type: ToastType): SnackbarType {
switch (type) {
case 'success':
return SnackbarType.Default;
case 'error':
return SnackbarType.Error;
case 'loading':
return SnackbarType.Default;
default:
return SnackbarType.Default;
}
}

return (
<ToasterLib position="bottom-right" containerClassName="!z-[999999] !right-8">
{(t) => (
<div style={{ opacity: t.visible ? 1 : 0 }}>
<Snackbar
onClose={() => toast.dismiss(t.id)}
text={resolveValue(t.message, t)}
type={getSnackbarType(t.type)}
showClose
duration={t.duration}
/>
</div>
)}
</ToasterLib>
);
}
1 change: 1 addition & 0 deletions apps/wallet-dashboard/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export * from './ExplorerLink';
export * from './Dialogs';
export * from './ValidatorStakingData';
export * from './tiles';
export * from './Toaster';
9 changes: 2 additions & 7 deletions apps/wallet-dashboard/providers/AppProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@

'use client';

import { PopupProvider } from '@/components';
import { PopupProvider, Toaster } from '@/components';
import { GrowthBookProvider } from '@growthbook/growthbook-react';
import { IotaClientProvider, lightTheme, darkTheme, WalletProvider } from '@iota/dapp-kit';
import { getAllNetworks, getDefaultNetwork } from '@iota/iota-sdk/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useState } from 'react';
import { growthbook } from '@/lib/utils';
import { Popup } from '@/components/Popup';
import { Toaster } from 'react-hot-toast';
import { ThemeProvider } from '@iota/core';

growthbook.init();
Expand Down Expand Up @@ -40,11 +39,7 @@ export function AppProviders({ children }: React.PropsWithChildren) {
<ThemeProvider appId="dashboard">
<PopupProvider>
{children}
<Toaster
containerStyle={{
zIndex: 99999,
}}
/>
<Toaster />
<Popup />
</PopupProvider>
</ThemeProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function RemoveDialog({ isOpen, setOpen, accountID }: RemoveDialogProps)
/>
<Button
fullWidth
type={ButtonType.Primary}
type={ButtonType.Destructive}
text="Remove"
onClick={handleRemove}
/>
Expand Down
6 changes: 4 additions & 2 deletions apps/wallet/src/ui/app/shared/toaster/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ function getBottomSpace(pathname: string, isMenuVisible: boolean, isBottomNavSpa
'/accounts/manage',
].includes(pathname);

if (overlayWithActionButton || isBottomNavSpace) {
return '!bottom-16';
const matchDynamicPaths = ['/dapp/connect'].some((path) => pathname.startsWith(path));

if (overlayWithActionButton || isBottomNavSpace || matchDynamicPaths) {
return '!bottom-20';
}

return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function ValidatorLogo({
<Card type={type} onClick={onClick}>
<CardImage>
<ImageIcon
src={null}
src={validatorMeta?.imageUrl ?? null}
label={validatorName}
fallback={validatorName}
size={ImageIconSize.Large}
Expand Down
Loading

0 comments on commit 8fd97c4

Please sign in to comment.