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

@yomo/group-hug-react

v1.0.15

Published

Live collaborator avatars for multiplayer web apps

Downloads

94

Readme

GroupHug

Live collaborator avatars for multiplayer web apps

Online Demo

🥷🏼 Usage

Install with npm:

$ npm i --save @yomo/group-hug-react

Create a Presence instance

import Presence from "@yomo/presence";

// create an instance.
const presence = new Presence("https://lo.yomo.dev:8443/v1", {
  publicKey: "DEV_TOKEN",
  id,
  debug: true,
});

Add <GroupHug /> to pages:

const App = () => {
  const [darkMode, setDarkMode] = useState(true);
  return (
    <div>
      <GroupHug
        presence={presence}
        id={peerId}
        name={peerDisplayName}
        darkMode={darkMode}
      />
    </div>
  );
};

🧪 Props

According to the demo code above, we can see an avatar with the default style.

Furthermore, we offer the option to utilize custom styles should you desire

If the avatar image is not specified, avvvatars will be utilized as the placeholder.

Similarly, if you do not specify the color of avatarBorderColor, a random color will be assigned automatically.

Grouphug provides many style-related properties, you can customize the avatar with your own style by setting these properties.

Grouphug offers a plethora of style-related properties, enabling you to personalize the avatar according to your own preferences by configuring these properties.

Below are the comprehensive customization options:

<GroupHug
  presence={presence}
  channel={channel}
  id={id}
  name={"Noah"}
  placeholder={shape}
  size={24}
  darkMode={true}
  avatar={"https://avatars.githubusercontent.com/u/33050549?v=4"}
  avatarTextColor={"white"}
  avatarBorderWidth={3}
  avatarBorderColor={"blue"}
  avatarBackgroundColor={"red"}
  overlapping={true}
  transparency={0.5}
  maximum={6}
  MPOP={true}
  onMouseEnter={() => console.log(`mouse enter`)}
  onMouseLeave={() => console.log(`mouse leave`)}
/>;

Here are the full props:

| name | type | description | | --------------------- | -------------------- | --------------------------------------------------------------------------------------------------------- | | presence | Promise | The Presence instance | | channel | string | The channel name of the Presence instance | | id | string | The unique identifier of the user | | name | string | The name or display name of the user | | avatar | string | The avatar image url of the user | | placeholder | 'shape', 'character' | The placeholder image when avatar absence | | MPOP | boolean | A boolean value indicating whether the MPOP (Multiple Points of Presence) feature is enabled for the user | | darkMode | boolean | A boolean value indicating whether the dark mode is enabled for the user | | avatarTextColor | string | The color of the text displayed on the user's avatar | | avatarBackgroundColor | string | The background color of the user's avatar | | avatarBorderColor | string | The border color of the user's avatar | | avatarBorderWidth | number | The width of the border around the user's avatar | | size | number | The size of the avatar in pixels | | overlapping | boolean | A boolean value indicating whether the avatars should overlap when multiple users are present | | transparency | number | The transparency level of the avatars, ranging from 0 (fully transparent) to 1 (fully opaque) | | maximum | number | The maximum number of avatars stacking | | onMouseEnter | (user: User) => void | A callback function triggered when the mouse pointer enters the user's avatar | | onMouseLeave | (user: User) => void | A callback function triggered when the mouse pointer leaves the user's avatar |

👩‍🔬 Local Development

  1. Start local prscd dev server: bun run prscd:dev
  2. Start Grouphug code generator tool: bun run dev

🌎 Self-hosting

see Self-Hosting Doc

🧘🏻 License

The MIT License.