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

@charisma-ai/react-comic-player

v2.0.1

Published

Charisma.ai React component for web stories

Downloads

1,107

Readme

React Comic Player

Charisma.ai React component for playing web stories like an interactive comic.

Screenshot of a Charisma comic, with a message bubble displaying the character's text over a full-screen image.

pnpm i @charisma-ai/react-comic-player

Integrating into your own app

There's a demo app in ./demo/comic which shows how to integrate the comic player into a React app.

First, integrate @charisma-ai/react into your React app. Once that's done, you should have at least a playthroughToken, a conversationUuid, a Playthrough component, and a Conversation component.

Then, the <ComicPlayer> needs to be linked to the same conversation, so it can display the media for the messages as they arrive.

To do this, render your <ComicPlayer> inside the same <Playthrough> and <Conversation> component, and pass in the same conversation into <ComicPlayer>. The best way to do this is to use the useConversationContext context:

<Playthrough {...playthroughProps}>
  <Conversation {conversationProps}>
    <MyPlayer />
  </Conversation>
</Playthough>

MyPlayer.tsx

const conversation = useConversationContext()

return (
  <div style={{ width: 340, height: 600 }}>
    <ComicPlayer cconversation={conversation} />
  </div>
)

To style the component, import the stylesheet:

import "@charisma-ai/react-comic-player/styles.css";

ComicPlayer is a responsive component, and fills 100% of the height and width of its parent container. If you wanted a full-screen player, for example, you could set the parent's height and width to 100vh and 100vw. Depending on if the comic player is in a portrait or landscape orientation, the ComicPlayer will only display media layers that are configured for that orientation.

ComicPlayer is designed to only display the media of the story. To add controls such as tapping or replying, these should be implemented outside the ComicPlayer. The useConversation hook or Conversation component can be used to link the controls to the same conversationUuid.