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

Pinned Apps (2 of 2) #1103

Merged
merged 3 commits into from
Apr 5, 2024
Merged

Pinned Apps (2 of 2) #1103

merged 3 commits into from
Apr 5, 2024

Conversation

calebjacob
Copy link
Collaborator

@calebjacob calebjacob commented Apr 4, 2024

Closes: #1056

  • Implement pinned apps in the new sidebar layout. Since our sidebar layout is still not enabled, you'll need to test the preview link by adding ?sidebar=true to the end of your URL. The pinned UI on the ComponentDetailsPage and ProfilePage will only be visible if the sidebar layout is enabled.
  • Implement generic hook and pattern for passing events and data between the gateway and BOS components via useGatewayEvents(). This allows our trusted BOS components to emit an event to the gateway when an app is pinned or unpinned. This allows us to update the sidebar UI optimistically as soon as a user clicks on pin or unpin.
  • When pinned apps are loaded or modified, they are cached in localStorage to provide an instant loading experience in the sidebar when initially loading the page. The pinned apps are fetched from Social DB on page load and will eventually update your UI and localStorage once the request finishes to always be in sync with what's actually stored on chain (follows the stale-while-revalidate pattern).
  • The useGatewayEvents() hook can hopefully be useful for other features down the road.
  • Updated our Star and Pin actions to show descriptive tooltips on hover. When a user isn't signed in yet, the tooltips will notify the user that they need to sign in first.

To test the UI/UX flow:

  • Will rely on BOS component changes in the 1st PR over here: Pinned Apps (1 of 2) near-discovery-components#743
  • Open the test preview and add ?sidebar=true to the URL and go visit the ComponentDetailsPage for any component.
  • Here's a good example: /near/widget/ComponentDetailsPage?src=potlock.near/widget/Index&sidebar=true
  • Try pinning and unpinning a few apps. They should instantly appear and/or disappear from the sidebar as you pin/unpin.
  • Visit your profile page to see a Pins (X) tab: /near/widget/ProfilePage?accountId=calebjacob.near&sidebar=true
  • From there you can click on a card to then view the ComponentDetailsPage to unpin the app.

Copy link

vercel bot commented Apr 4, 2024

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

Name Status Preview Comments Updated (UTC)
near-discovery ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 4:37pm
near-discovery-testnet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 5, 2024 4:37pm

@calebjacob calebjacob added the feature To highlight a PR's description in the 'New Features' changelog section label Apr 4, 2024
@@ -42,7 +42,7 @@ a:hover {
}

#near-wallet-selector-modal .open {
z-index: 1001;
z-index: 5000;
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to check is this doesn't break the turn on notifications prompt 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@shelegdmitriy Fair point. I'd imagine the sign in modal should always take priority over anything else since you have to click the Sign In button to initiate it. Then it would close once you've connected your wallet or canceled.

Are you thinking the notifications prompt needs to render on top of the sign in modal?

Copy link
Contributor

@shelegdmitriy shelegdmitriy left a comment

Choose a reason for hiding this comment

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

Thanks for such a detailed description! LGTM! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature To highlight a PR's description in the 'New Features' changelog section
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pinned Apps (New Navigation)
2 participants