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

[Counterfactual] Add first steps widget #3218

Merged
merged 7 commits into from
Feb 9, 2024
Merged

Conversation

usame-algan
Copy link
Member

@usame-algan usame-algan commented Feb 7, 2024

What it solves

Part of #3207

How this PR fixes it

  • Creates a new widget for the dashboard to show first steps
  • Creates StatusProgress component that can be reused for other widgets

How to test it

  1. Create a new counterfactual safe
  2. Observe first steps card visible on the dashboard
  3. Complete first steps or deploy safe immediately
  4. Observe cards are not visible anymore

Screenshots

Screenshot 2024-02-07 at 16 55 48

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Feb 7, 2024

Branch preview

⏳ Deploying a preview site...

@usame-algan
Copy link
Member Author

I think we can show this widget to any safe and add a close button in the corner to permanently hide it. cc @liliiaorlenko

Copy link

github-actions bot commented Feb 7, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Feb 7, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1.02 MB (🟡 +67 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/home 81.19 KB (🔴 +40.38 KB) 1.1 MB
/new-safe/create 30.9 KB (-1 B) 1.05 MB
/new-safe/load 19.19 KB (🟡 +49 B) 1.04 MB
/settings/security-login 29.6 KB (🟢 -4 B) 1.05 MB
/settings/setup 71.32 KB (🟡 +643 B) 1.09 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Feb 7, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
78.59% (-0.02% 🔻)
11405/14512
🔴 Branches
56.15% (-0.05% 🔻)
2515/4479
🟡 Functions
63.11% (-0.07% 🔻)
1810/2868
🟡 Lines
79.9% (-0.01% 🔻)
10287/12875
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / transaction-guards.ts
77.52% (-1.05% 🔻)
41.94% (-2.89% 🔻)
73.81% (-1.8% 🔻)
78.16% (-0.66% 🔻)
🟢
... / txHistorySlice.ts
84.62% (-10.62% 🔻)
60% (-40% 🔻)
50% (-50% 🔻)
90.91% (-9.09% 🔻)

Test suite run success

1389 tests passing in 188 suites.

Report generated by 🧪jest coverage report action from b86b66c

Comment on lines 27 to 29
const totalNumberOfItems = items.length
const completedItems = items.filter((item) => item.completed)
const progress = Math.round((completedItems.length / totalNumberOfItems) * 100)
Copy link
Member

Choose a reason for hiding this comment

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

These three vars are only needed to compute the progress var. Extract them into a calculateProgress function?

Comment on lines 57 to 61
const items = [
{ name: 'Add funds', completed: hasNonZeroBalance },
{ name: 'Create your first transaction', completed: hasOutgoingTransactions },
{ name: 'Safe is ready', completed: hasNonZeroBalance && hasOutgoingTransactions },
]
Copy link
Member

Choose a reason for hiding this comment

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

I would

  • define the names of steps as a sepate enum
  • memoize this object

Copy link
Member Author

Choose a reason for hiding this comment

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

I also removed the third step as its more like a success step when everything else is completed and the progress bar is more accurate without. I added it as an additional prop to StatusProgress instead.

</StatusItem>
)
})}
{completedName && <StatusItem completed={progress === 100}>{completedName}</StatusItem>}
Copy link
Member

Choose a reason for hiding this comment

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

Aren't all items supposed to be shown at all times? And if not completed it's grey?

Copy link
Member Author

Choose a reason for hiding this comment

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

On secound thought I think I will remove this again because its very specific for the counterfactual flow where we want to show the user the goal of these steps "Safe is ready" and there is an alternative design for that which I am planning to implement.

@usame-algan
Copy link
Member Author

@katspaugh I implemented the alternative design with some placeholder values for counterfactual so I would wait to merge this until #3180 is merged.

Copy link

github-actions bot commented Feb 8, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@usame-algan usame-algan changed the title feat: Add first steps widget [Counterfactual] Add first steps widget Feb 8, 2024
@francovenica
Copy link
Contributor

This ticket was tested and looks good, but with Usame we have decied to merge this ticket along with 3220 and 3214 since these 3 are piceces of a functionality, and it is easier to test all together.

@usame-algan usame-algan changed the base branch from dev to cf-dashboard February 9, 2024 14:09
@usame-algan usame-algan merged commit d0f3fb5 into cf-dashboard Feb 9, 2024
8 of 12 checks passed
@usame-algan usame-algan deleted the first-steps-widget branch February 9, 2024 14:15
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants