Skip to content

Commit

Permalink
UI updates (#187)
Browse files Browse the repository at this point in the history
* project list color updates

* update exit icon

* update outlined button style

* add tooltip for sidebar links

* show basic menu in interaction history

* add menu icons

* show transaction status in interaction history

* disable menu for first block

* update transaction content layout

* temporary menu tooltip

* redirect to the default project route

* reorganize sidebar nav links, make interactions the default page

* update service account icon

* fix initial redirection

* remove tooltip, remove unused dependencies

* remove extra spacing in sidebar

* minor fix

* show event data inline, simplify events table

* restructure components, remove obsolete/unused styles

* restructure interaction components

* update transaction source display

* tweak events table column widths

* fix account keys table

* show details tabs under transaction outcome view

* compute account tags

* add account tags
  • Loading branch information
bartolomej authored Sep 6, 2023
1 parent 62b8cd3 commit 7a677f4
Show file tree
Hide file tree
Showing 102 changed files with 1,548 additions and 3,496 deletions.
27 changes: 25 additions & 2 deletions backend/src/accounts/entities/account.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PollingEntity } from "../../core/entities/polling.entity";
import { Column, Entity, OneToMany, PrimaryColumn } from "typeorm";
import { AccountKeyEntity } from "./key.entity";
import { AccountContractEntity } from "./contract.entity";
import { Account } from "@flowser/shared";
import { Account, AccountTag } from "@flowser/shared";
import { TransactionEntity } from "../../transactions/transaction.entity";
import { AccountStorageItemEntity } from "./storage-item.entity";
import { BlockContextEntity } from "../../blocks/entities/block-context.entity";
Expand Down Expand Up @@ -92,6 +92,29 @@ export class AccountEntity extends PollingEntity implements BlockContextEntity {
}

toProto(): Account {
const tags: AccountTag[] = [];

if (this.isDefaultAccount) {
tags.push({
name: "Default",
description: "This account was created automatically by the emulator.",
});
}

const isServiceAccount = [
"0xf8d6e0586b0a20c7",
"0x0000000000000001", // When using monotonic addresses setting
].includes(this.address);

// https://developers.flow.com/concepts/flow-token/concepts#flow-service-account
if (isServiceAccount) {
tags.push({
name: "Service",
description:
"A special account in Flow that has special permissions to manage system contracts. It is able to mint tokens, set fees, and update network-level contracts.",
});
}

return {
address: this.address,
balance: this.balance,
Expand All @@ -101,7 +124,7 @@ export class AccountEntity extends PollingEntity implements BlockContextEntity {
contracts: this.contracts?.map((contract) => contract.toProto()) ?? [],
transactions:
this.transactions?.map((transaction) => transaction.toProto()) ?? [],
isDefaultAccount: this.isDefaultAccount,
tags,
createdAt: this.createdAt.toISOString(),
updatedAt: this.updatedAt.toISOString(),
};
Expand Down
22 changes: 13 additions & 9 deletions backend/src/data-processing/processor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,15 +705,19 @@ export class ProcessorService implements ProjectContextLifecycle {
flowBlock: FlowBlock;
}): AccountEntity {
const { flowAccount, flowBlock } = options;
const account = AccountEntity.createDefault();
account.blockId = flowBlock.id;
account.address = ensurePrefixedAddress(flowAccount.address);
account.balance = flowAccount.balance;
account.code = flowAccount.code;
account.keys = flowAccount.keys.map((flowKey) =>
this.createKeyEntity({ flowAccount, flowKey, flowBlock })
);
return account;
return new AccountEntity({
balance: flowAccount.balance,
address: ensurePrefixedAddress(flowAccount.address),
blockId: flowBlock.id,
isDefaultAccount: false,
contracts: [],
storage: [],
transactions: [],
code: flowAccount.code,
keys: flowAccount.keys.map((flowKey) =>
this.createKeyEntity({ flowAccount, flowKey, flowBlock })
),
});
}

private createKeyEntity(options: {
Expand Down
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"main": "dist/targets/electron/main.js",
"homepage": "./",
"dependencies": {
"reactjs-popup": "2.0.5",
"@szhsin/react-menu": "4.0.3",
"@codemirror/legacy-modes": "^6.1.0",
"@fingerprintjs/fingerprintjs": "^3.3.6",
"@flowser/backend": "0.0.1",
"@flowser/shared": "0.0.1",
"@onflow/cadence-parser": "^0.26.0",
"@onflow/fcl": "^1.6.0",
"@onflow/types": "^1.0.3",
"@sentry/electron": "^4.0.2",
Expand Down
13 changes: 11 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ReactElement, ReactNode, useEffect } from "react";
import {
createBrowserRouter,
Navigate,
Outlet,
RouterProvider,
useLocation,
Expand Down Expand Up @@ -36,7 +37,7 @@ import {
useGetPollingTransactions,
} from "./hooks/use-api";
import { TransactionsTable } from "./modules/transactions/TransactionsTable/TransactionsTable";
import { TransactionDetails } from "./modules/transactions/details/TransactionDetails";
import { TransactionDetails } from "./modules/transactions/TransactionDetails/TransactionDetails";
import { BlockDetails } from "./modules/blocks/BlockDetails/BlockDetails";
import { BlocksTable } from "./modules/blocks/BlocksTable/BlocksTable";
import { AccountDetails } from "./modules/accounts/AccountDetails/AccountDetails";
Expand Down Expand Up @@ -97,6 +98,10 @@ export const FlowserClientApp = ({
};

const router = createBrowserRouter([
{
index: true,
element: <Navigate to="projects" replace />,
},
{
path: "projects",
element: (
Expand Down Expand Up @@ -128,7 +133,11 @@ const router = createBrowserRouter([
),
children: [
{
path: "ProjectSettings",
index: true,
element: <Navigate to="interactions" replace />,
},
{
path: "settings",
element: <ProjectSettingsPage />,
},
{
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/assets/icons/circle_arrow_left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions frontend/src/assets/icons/exit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 4 additions & 10 deletions frontend/src/assets/icons/expired-tx-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions frontend/src/assets/icons/new_project.svg

This file was deleted.

4 changes: 2 additions & 2 deletions frontend/src/assets/icons/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 7 additions & 4 deletions frontend/src/assets/icons/sealed-tx-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontend/src/assets/icons/share.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions frontend/src/assets/icons/switch.svg

This file was deleted.

20 changes: 4 additions & 16 deletions frontend/src/assets/icons/unknown-tx-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added frontend/src/assets/images/avatars/service.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7a677f4

Please sign in to comment.