Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #185

Merged
merged 13 commits into from
Sep 2, 2023
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@nestjs/serve-static": "^3.0.0",
"@nestjs/swagger": "^5.1.1",
"@nestjs/typeorm": "^8.1.0",
"@onflow/fcl": "^1.5.1",
"@onflow/fcl": "^1.6.0",
"@onflow/types": "^1.0.3",
"axios": "^0.21.4",
"class-transformer": "0.4.0",
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@flowser/backend": "0.0.1",
"@flowser/shared": "0.0.1",
"@onflow/cadence-parser": "^0.26.0",
"@onflow/fcl": "^1.5.1",
"@onflow/fcl": "^1.6.0",
"@onflow/types": "^1.0.3",
"@sentry/electron": "^4.0.2",
"@tanstack/react-table": "^8.5.11",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/cadence-editor/cadence-editor.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
/* Main editor container */
.cadence-editor {
width: 100%;
height: 100%;
background: #272B32;
}

.cadence-editor .cm-editor {
background: none;
height: 100%;
}

.cm-focused {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@import "styles/scrollbars";

.root {
overflow: scroll;
background: $gray-100;
@include hiddenScrollbars();

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/details-card/DetailsCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from "classnames";
import Label from "components/label/Label";
import Value from "components/value/Value";
import React, { FC, ReactElement } from "react";
import React, { CSSProperties, FC, ReactElement } from "react";
import Card from "../card/Card";
import classes from "./DetailsCard.module.scss";
import { SizedBox } from "../sized-box/SizedBox";
Expand Down
23 changes: 15 additions & 8 deletions frontend/src/components/ellipsis/MiddleEllipsis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,36 @@ import React, { FunctionComponent, useRef } from "react";

export type EllipsisProps = {
children: string;
delimiter?: string;
className?: string;
style?: React.CSSProperties;
};

const MiddleEllipsis: FunctionComponent<EllipsisProps> = ({
children,
delimiter = "...",
className,
style,
}) => {
const elRef = useRef<HTMLSpanElement>(null);
const pieceLength = 10;
const ellipsisText =
children.substring(0, pieceLength) +
delimiter +
children.substring(children.length - pieceLength, children.length);
const maxLength = 20;

return (
<span ref={elRef} className={className} style={style}>
{ellipsisText}
{trimText(children, maxLength)}
</span>
);
};

function trimText(text: string, maxLength: number) {
const delimiter = "...";
if (text.length <= maxLength) {
return text;
} else {
return (
text.substring(0, maxLength / 2) +
delimiter +
text.substring(text.length - maxLength / 2, text.length)
);
}
}

export default MiddleEllipsis;
1 change: 1 addition & 0 deletions frontend/src/components/tabs/Tabs.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
display: flex;
flex-direction: column;
overflow: hidden;
height: 100%;
.tabWrapper {
display: flex;
align-items: center;
Expand Down
4 changes: 1 addition & 3 deletions frontend/src/contexts/ui-state.context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import React, {
useContext,
useState,
} from "react";
import { LogDrawerUiState } from "../hooks/use-log-drawer";
import { NavigationUiState } from "../hooks/use-navigation";

export interface UiState extends LogDrawerUiState, NavigationUiState {
export interface UiState extends NavigationUiState {
placeholder: { [key: string]: string };
searchTerm: { [key: string]: string };
searchDisabled: boolean;
Expand All @@ -19,7 +18,6 @@ export const defaultUiState: UiState = {
placeholder: { default: "Search" },
searchTerm: { default: "" },
searchDisabled: false,
logDrawerSize: "tiny",
breadcrumbs: [],
isBreadcrumbsVisible: false,
isShowBackButtonVisible: true,
Expand Down
24 changes: 0 additions & 24 deletions frontend/src/hooks/use-log-drawer.ts

This file was deleted.

6 changes: 3 additions & 3 deletions frontend/src/pages/interactions/InteractionsPage.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
.content {
flex: 2;
display: flex;
row-gap: $spacing-base;
flex-direction: column;
overflow: hidden;
.code {
flex: 3;
height: 60%;
background: #272B32;
padding-top: $spacing-base;
}
.details {
flex: 1;
height: 40%;
background: #272B32;
.error {
padding: $spacing-base;
Expand Down
1 change: 0 additions & 1 deletion frontend/src/pages/interactions/InteractionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ function InteractionBody(): ReactElement {
<div className={classes.code}>
<InteractionSourceEditor />
</div>
<SizedBox height={20} />
<div className={classes.details}>
<InteractionDetails />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
justify-content: space-between;
flex-direction: column;
padding: $spacing-base;
width: 300px;
min-width: 300px;
row-gap: $spacing-base;

.top {
overflow-y: scroll;
}

.bottom {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { ExternalLink } from "../../../../components/link/ExternalLink";
export function ExecutionSettings(): ReactElement {
return (
<div className={classes.root}>
<div>
<div className={classes.top}>
<TopContent />
</div>
<div className={classes.bottom}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@
padding: $spacing-base;
}

.transactionOverview {
height: 100%;
padding: 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
FlowScriptOutcome,
FlowTransactionOutcome,
} from "pages/interactions/contexts/interaction-registry.context";
import { TabItem, Tabs } from "../../../../components/tabs/Tabs";
import { TabItem } from "../../../../components/tabs/Tabs";
import { Callout } from "../../../../components/callout/Callout";
import { useInteractionDefinitionManager } from "../../contexts/definition.context";
import { InteractionKind } from "@flowser/shared";
Expand Down Expand Up @@ -125,24 +125,22 @@ function TransactionOutcome(props: { outcome: FlowTransactionOutcome }) {
tabs.push({
id: overviewTabId,
label: "Overview",
content: <TransactionOverview transaction={data.transaction} />,
content: (
<TransactionOverview
transaction={data.transaction}
className={classes.transactionOverview}
/>
),
});

if (error) {
tabs.push({
id: errorTabId,
label: "Error",
content: (
// TODO(design-revamp): Consolidate body layout styles
<div style={{ padding: 10 }}>
{data.transaction.status?.errorMessage ? (
<TransactionError
errorMessage={data.transaction.status.errorMessage}
/>
) : (
<pre>{outcome.error}</pre>
)}
</div>
content: data.transaction.status?.errorMessage ? (
<TransactionError errorMessage={data.transaction.status.errorMessage} />
) : (
<pre>{outcome.error}</pre>
),
});
}
Expand Down Expand Up @@ -175,23 +173,13 @@ function ScriptOutcome(props: { outcome: FlowScriptOutcome }) {
tabs.push({
id: errorTabId,
label: "Error",
content: (
// TODO(design-revamp): Consolidate body layout styles
<div style={{ padding: 10 }}>
<ScriptError errorMessage={error} />
</div>
),
content: <ScriptError errorMessage={error} />,
});
} else {
tabs.push({
id: resultTabId,
label: "Result",
content: (
// TODO(design-revamp): Consolidate body layout styles
<div style={{ padding: 10 }}>
<JsonView name="result" data={{ value: result }} />
</div>
),
content: <JsonView name="result" data={{ value: result }} />,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
justify-content: space-between;
position: relative;

.header {
background: $gray-100;
position: sticky;
top: 0;
padding-bottom: $spacing-base;
// Question mark icon is displayed above the header for some reason.
z-index: 1;
}

.storedTemplates {
display: flex;
flex-direction: column;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ function StoredTemplates() {
);

return (
<>
<SearchInput
placeholder="Search interactions ..."
searchTerm={searchTerm}
onChangeSearchTerm={setSearchTerm}
/>
<SizedBox height={20} />
<div>
<div className={classes.header}>
<SearchInput
placeholder="Search interactions ..."
searchTerm={searchTerm}
onChangeSearchTerm={setSearchTerm}
/>
</div>
<div className={classes.storedTemplates}>
{filteredAndSortedTemplates.map((template) => (
<div
Expand Down Expand Up @@ -79,7 +80,7 @@ function StoredTemplates() {
</div>
))}
</div>
</>
</div>
);
}

Expand Down
13 changes: 13 additions & 0 deletions frontend/src/pages/interactions/hooks/use-transaction-name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type UseInteractionNameProps = {

enum TransactionKind {
DEPLOY_CONTRACT,
REMOVE_CONTRACT,
INITIALIZE_ACCOUNT,
}

Expand All @@ -20,6 +21,14 @@ const hardcodedTemplates: [string, TransactionKind][] = [
}`,
TransactionKind.DEPLOY_CONTRACT,
],
[
`transaction(name: String) {
prepare(signer: AuthAccount) {
signer.contracts.remove(name: name)
}
}`,
TransactionKind.REMOVE_CONTRACT,
],
[
`import Crypto

Expand Down Expand Up @@ -78,6 +87,10 @@ function getDynamicName(transaction: Transaction) {
return `Deploy ${
getArgumentValueById(transaction, "name") ?? "contract"
}`;
case TransactionKind.REMOVE_CONTRACT:
return `Remove ${
getArgumentValueById(transaction, "name") ?? "contract"
}`;
case TransactionKind.INITIALIZE_ACCOUNT:
return "Init signer account";
default:
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/logs/Logs.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

.header {
display: flex;
height: 63px;
height: 50px;
color: $blue;
align-items: center;
overflow: hidden;
Expand Down
Loading