npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@gechiui/nux

v5.0.20

Published

NUX (New User eXperience) module for GeChiUI.

Downloads

6

Readme

New User eXperience (NUX)

The NUX module exposes components, and gc.data methods useful for onboarding a new user to the GeChiUI admin interface. Specifically, it exposes tips and guides.

A tip is a component that points to an element in the UI and contains text that explains the element's functionality. The user can dismiss a tip, in which case it never shows again. The user can also disable tips entirely. Information about tips is persisted between sessions using localStorage.

A guide allows a series of of tips to be presented to the user one by one. When a user dismisses a tip that is in a guide, the next tip in the guide is shown.

Installation

Install the module

npm install @gechiui/nux --save

This package assumes that your code will run in an ES2015+ environment. If you're using an environment that has limited or no support for such language features and APIs, you should include the polyfill shipped in @gechiui/babel-preset-default in your code.

DotTip

DotTip is a React component that renders a single tip on the screen. The tip will point to the React element that DotTip is nested within. Each tip is uniquely identified by a string passed to tipId.

See the component's README for more information.

<button onClick={ ... }>
	Add to Cart
	<DotTip tipId="acme/add-to-cart">
		Click here to add the product to your shopping cart.
	</DotTip>
</button>
}

Determining if a tip is visible

You can programmatically determine if a tip is visible using the isTipVisible select method.

const isVisible = select( 'core/nux' ).isTipVisible( 'acme/add-to-cart' );
console.log( isVisible ); // true or false

Manually dismissing a tip

dismissTip is a dispatch method that allows you to programmatically dismiss a tip.

<button
	onClick={ () => {
		dispatch( 'core/nux' ).dismissTip( 'acme/add-to-cart' );
	} }
>
	Dismiss tip
</button>

Disabling and enabling tips

Tips can be programatically disabled or enabled using the disableTips and enableTips dispatch methods. You can query the current setting by using the areTipsEnabled select method.

Calling enableTips will also un-dismiss all previously dismissed tips.

const areTipsEnabled = select( 'core/nux' ).areTipsEnabled();
return (
	<button
		onClick={ () => {
			if ( areTipsEnabled ) {
				dispatch( 'core/nux' ).disableTips();
			} else {
				dispatch( 'core/nux' ).enableTips();
			}
		} }
	>
		{ areTipsEnabled ? 'Disable tips' : 'Enable tips' }
	</button>
);

Triggering a guide

You can group a series of tips into a guide by calling the triggerGuide dispatch method. The given tips will then appear one by one.

A tip cannot be added to more than one guide.

dispatch( 'core/nux' ).triggerGuide( [
	'acme/product-info',
	'acme/add-to-cart',
	'acme/checkout',
] );

Getting information about a guide

getAssociatedGuide is a select method that returns useful information about the state of the guide that a tip is associated with.

const guide = select( 'core/nux' ).getAssociatedGuide( 'acme/add-to-cart' );
console.log( 'Tips in this guide:', guide.tipIds );
console.log( 'Currently showing:', guide.currentTipId );
console.log( 'Next to show:', guide.nextTipId );