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: approver ux UI #609

Merged
merged 1 commit into from
Nov 15, 2024
Merged

feat: approver ux UI #609

merged 1 commit into from
Nov 15, 2024

Conversation

edgarkhanzadian
Copy link
Collaborator

@edgarkhanzadian edgarkhanzadian commented Nov 8, 2024

Well probably too many changes for 1 PR but oh well. 😅

  • Implement Approver UX ui trying to keep the same Approval structure as on web
  • Swap NavigationContainer with BottomSheetScrollView to unblock the scroll view on send sheet navigation
  • Move Prism highlighting from extension to monorepo, unblock fix: move prism to monorepo extension#5943
  • Implement Prism highlighting in mobile

Initial route changed here to showcase the approver ux

approverUx.mov

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 23.72%. Comparing base (f7ec61c) to head (987caea).
Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
packages/utils/src/index.ts 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #609      +/-   ##
==========================================
- Coverage   23.73%   23.72%   -0.01%     
==========================================
  Files         165      165              
  Lines        6173     6178       +5     
  Branches      335      335              
==========================================
+ Hits         1465     1466       +1     
- Misses       4708     4712       +4     
Files with missing lines Coverage Δ
packages/utils/src/index.ts 31.33% <20.00%> (-0.40%) ⬇️
Components Coverage Δ
bitcoin 62.04% <ø> (ø)
query 12.67% <ø> (ø)
utils 48.02% <20.00%> (-0.30%) ⬇️
crypto 68.21% <ø> (ø)
stacks 54.71% <ø> (ø)

@edgarkhanzadian edgarkhanzadian force-pushed the feat/approver-ux-ui branch 2 times, most recently from f9b9a33 to 242164d Compare November 14, 2024 12:52
@edgarkhanzadian edgarkhanzadian marked this pull request as ready for review November 14, 2024 12:52
@edgarkhanzadian edgarkhanzadian changed the title Feat/approver ux UI feat: approver ux UI Nov 14, 2024
Copy link
Contributor

@fbwoolf fbwoolf left a comment

Choose a reason for hiding this comment

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

This looks great @edgarkhanzadian. I may have created some conflicts for you bc I didn't realize you were moving stuff arnd with the send form routes. Let me know if you need help resolving.

@tigranpetrossian
Copy link
Contributor

The highlighter code is 🔥 @edgarkhanzadian!

Comment on lines +1 to +14
import { ScrollView } from 'react-native-gesture-handler';

import { t } from '@lingui/macro';

import { Highlighter, Prism, Text } from '@leather.io/ui/native';

/* eslint-disable-next-line lingui/no-unlocalized-strings */
const sampleCode = `
;; hello-world contract

(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)
(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G)

(define-fungible-token novel-token-19)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we organise components elsewhere than approver. This component doesn't really have anything to do with it, and could just be a standalone component?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be good to put it in the UI library

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well i mean the main part of it is the Highlighter component that's already in the UI library. This one just adds a scrollview wrapper and a title that make it specific to approver. So it's probably fine for it to stay here.

Comment on lines +17 to +19
const [isDisplayingAdvancedView, setIsDisplayingAdvancedView] = useState(false);
const [actionBarHeight, setActionBarHeight] = useState(100);
const childRegister = useRegisterApproverChildren();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this be all wraped into its own hook so we share it between web/native?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it should, i use all of these hooks in one component here, but web uses some of these hooks separately.

@@ -36,6 +36,7 @@
"dependencies": {
"@crowdin/ota-client": "2.0.0",
"@expo/vector-icons": "14.0.0",
"@gorhom/bottom-sheet": "4.6.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

I moved @gorhom/bottom-sheet dependancy into the UI library.

Is there some reason not to use standard Sheet? Maybe we can export BottomSheetScrollView from the UI library and import here to avoid extra dependancies?

The same for prism-react-renderer, if we can move that component into the library then we could save the import here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well i mean all of the dependencies are going to be included in the bundle anyway + syncpack syncs all of the dependency versions so we are not going to experience any version differences

@@ -0,0 +1,25 @@
import { AppRoutes } from '@/routes';
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about having state connected components under src/components

I would think they should be a feature?

Copy link
Contributor

Choose a reason for hiding this comment

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

I wanted to ask here, this isn't how I've determined components vs features in the past, is this how others think about it? I've always thought, if a component is used in multiple features it should live outside the feature and be a shared component? 🤔 Would badges then be it's own feature, bc it seems odd now that the send feature is importing a component from the settings feature?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we have some dep cruiser rules for this in the extension we need to add to mobile...

Screenshot 2024-11-15 at 1 36 49 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is similar but that if a shared component is connected to state, it then becomes a feature rather than a component. That's just how I have seen things done in the past generally.

I'm not sure if we can import one feature to another with those cruiser rules? Maybe they are enforcing a different setup we prefer.

Usually only dumb, non state connected components would go to src/components/ then state connected ones into src/features. If a component is used in multiple features:

  • it could be made more dumb and receive props rather than hook into state
  • if it needs to fetch state be promoted to a feature

export function SignPsbt() {
const theme = useTheme<Theme>();

function getButtons(buttonState: 'start' | 'approving' | 'success') {
Copy link
Contributor

@pete-watters pete-watters Nov 15, 2024

Choose a reason for hiding this comment

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

This could be it's own Approver.Action component rather than a function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea! Will do now

Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

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

Great work here @edgarkhanzadian 👍

I added some organisation suggestions but really solid PR overall

@edgarkhanzadian edgarkhanzadian added this pull request to the merge queue Nov 15, 2024
Merged via the queue into dev with commit ac5231b Nov 15, 2024
13 checks passed
@edgarkhanzadian edgarkhanzadian deleted the feat/approver-ux-ui branch November 15, 2024 15:29
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.

5 participants