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

Render operations by type, improve render blocks #1096

Merged
merged 15 commits into from
Feb 5, 2024

Conversation

aristidesstaffieri
Copy link
Contributor

@aristidesstaffieri aristidesstaffieri commented Feb 1, 2024

Motivation:
Previously we displayed operations by digging into their private fields and conditionally rendering all fields that could be on any op type. This caused us to drop the operation type and made it difficult to know how any 1 operation would be rendered. It also made it more difficult to get into the auth tree and sub-invocations.

Changes:
Splits rendering by operation type.
Extracts all KeyVals into a new file, adds new KeyVals for missing types.
Adds missing fields, and fixes rendering bugs for a few types.

@aristidesstaffieri aristidesstaffieri self-assigned this Feb 1, 2024
@aristidesstaffieri aristidesstaffieri changed the title [WIP] renders operation by op type [WIP] Render operations by type, improve render blocks Feb 2, 2024
@aristidesstaffieri aristidesstaffieri marked this pull request as ready for review February 5, 2024 18:40
@aristidesstaffieri aristidesstaffieri changed the title [WIP] Render operations by type, improve render blocks Render operations by type, improve render blocks Feb 5, 2024
@aristidesstaffieri aristidesstaffieri changed the base branch from master to release/5.15.0 February 5, 2024 18:43
<div className="Operations__pair" data-testid="OperationKeyVal">
<div>
{operationKey}
{operationKey ? ":" : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this always be true? Or is operationKey optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'm not sure why that check exists, maybe it used to be optional? It's not now so I removed it in 8ee4bf0

/>
);
}
if ("sha256Hash" in signer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: space above this if statement. The other ones have it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/>
);
}
if ("sha256Hash" in signer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nite: same as above about the space. 👮‍♀️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -78,6 +78,7 @@ export const SignTransaction = () => {
isHttpsDomain,
flaggedKeys,
} = tx;
console.log(Trans, isHttpsDomain);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this console.log here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 204 to 221
// if (!isHttpsDomain && !isExperimentalModeEnabled) {
// return (
// <WarningMessage
// handleCloseClick={() => window.close()}
// isActive
// variant={WarningMessageVariant.warning}
// header={t("WEBSITE CONNECTION IS NOT SECURE")}
// >
// <p>
// <Trans domain={domain}>
// The website <strong>{{ domain }}</strong> does not use an SSL
// certificate. For additional safety Freighter only works with
// websites that provide an SSL certificate.
// </Trans>
// </p>
// </WarningMessage>
// );
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops! This was commented out to test an API path locally, commented back in https://stellarfoundation.slack.com/archives/C06GA82KU2H/p1707081896826859?thread_ts=1706810112.655399&cid=C06GA82KU2H

@aristidesstaffieri aristidesstaffieri merged commit a375658 into release/5.15.0 Feb 5, 2024
3 checks passed
@aristidesstaffieri aristidesstaffieri deleted the render-operation-by-type branch February 5, 2024 22:29
aristidesstaffieri added a commit that referenced this pull request Feb 8, 2024
* Render operations by type, improve render blocks (#1096)

* renders operation by op type

* adds key val renderer for signer by type

* adds key val renderer for line by type

* adds key val renderer for claimants, signer options

* uses DestinationWarning for any destination accounts

* adds invokeHostFn renderer and supporting helper components

* adds remaining key val renderers by type

* Added translations

* tweaks to invoke host fn preview, optionally show source

* Added translations

* fixes typos in added op types

* fixes revoke sponsorship cases for missing op type in enum

* adds comment for stellar-base type issue

* reverts commented out warning for dev testing, fixes formatting and removes uneeded key check in KeyValueList

* Constrain token payment (#1095)

* adds token simulation redux state

* moves token simualtion action into redux slice, adds send settings simulation rejection error

* reorganize imports in SettingsFail

* Feature/improve sign preview (#1100)

* adds warning for token transfers in auth, adds better invocation rendering

* Added translations

* adds transfer index to title, adds token details per transfer

* adds error modal in sign auth entry for bad entry format

* tweaks settings fail error message alignment, updates comment in history item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants