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

feat(llm): 🏷️ add memo/tag input in some coins send flow #8155

Merged
merged 11 commits into from
Oct 23, 2024

Conversation

thesan
Copy link
Contributor

@thesan thesan commented Oct 21, 2024

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

📝 Description

Screen.Recording.2024-10-22.at.10.53.12.mov

Add a memo tag input on all coins where it had been implemented on the summary step except Stellar. Stellar will be done on a follow up PR.

List of the coins:

  • Algorand
  • Cardano
  • Casper
  • Cosmos
  • Crypto_org
  • Hedera
  • Internet_computer
  • Solana
  • Stacks
  • Stellar
  • TON
  • XRP

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

Copy link

vercel bot commented Oct 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Oct 22, 2024 0:41am
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Oct 22, 2024 0:41am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 22, 2024 0:41am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 22, 2024 0:41am
web-tools ⬜️ Ignored (Inspect) Visit Preview Oct 22, 2024 0:41am

@thesan thesan requested review from a team as code owners October 21, 2024 14:13
@live-github-bot live-github-bot bot added mobile Has changes in LLM translations Translation files have been touched labels Oct 21, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to make one generic MemoTag? like

import React from "react";

import { AnimatedInput } from "@ledgerhq/native-ui";
import { MemoTagInputProps } from "LLM/features/MemoTag/types";

// Make the component generic, accepting a transaction type `T`.
export default function MemoTagInput<T>({ onChange, ...inputProps }: MemoTagInputProps<T>) {
  const [value, setValue] = React.useState("");

  const handleChange = (text: string) => {
    const value = text;
    setValue(value);
    onChange({
      patch: { memo: value || undefined },
      isEmpty: !value,
    });
  };

  return <AnimatedInput {...inputProps} value={value} onChangeText={handleChange} />;
}

and then use it in each family ?

import type { Transaction as CardanoTransaction } from "@ledgerhq/live-common/families/cardano/types";

<MemoTagInput<CardanoTransaction>
  onChange={handleCardanoChange}
  /* other props */
/>;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice one 🙌
It really reduced the boilerplate on every coins

@@ -146,7 +159,17 @@ export default function SendSelectRecipient({ navigation, route }: Props) {
setTransaction(bridge.updateTransaction(transaction, {}));
}, [setTransaction, account, parentAccount, transaction]);

const onPressContinue = useCallback(async () => {
const [memoTagDrawerState, setMemoTagDrawerState] = useState<"INITIAL" | "SHOWING" | "SHOWN">(
"INITIAL",
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use a dedicated enum or type?

Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger left a comment

Choose a reason for hiding this comment

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

LGTM

@thesan thesan merged commit bb6dfe4 into develop Oct 23, 2024
42 of 43 checks passed
@thesan thesan deleted the feat/llm-better-send-memo-tag-exp branch October 23, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Has changes in LLM translations Translation files have been touched
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants