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

react-jutsu

v3.0.3

Published

A jitsi meet component & hook moulded with react's chakra

Downloads

896

Readme

<Jutsu />

A jitsi meet component wrapper and custom hook moulded with react's chakra 💠

View live demo

NPM

Install

yarn add react-jutsu

Add the Jitsi Meet API js file to the html body

<body>
  <script src='https://meet.jit.si/external_api.js'></script>
</body>

You can choose to load the script another way, the hook will return an error until the jitsi API is available in window scope.

Two options

You can use the provided component for simple scenarios or the hook for access to the jitsi meet api

import { Jutsu } from 'react-jutsu' // Component
import { useJitsi } from 'react-jutsu' // Custom hook

Sample Usage (Hook)

import React, { useEffect } from 'react'
import { useJitsi } from 'react-jutsu'

const App = () => {
  const jitsiConfig = {
    roomName: 'konoha',
    displayName: 'Naruto Uzumaki',
    password: 'dattebayo',
    subject: 'fan',
    parentNode: 'jitsi-container',
  };
  const { loading, error, jitsi } = useJitsi(jitsiConfig);

  return (
    <div>
      {error && <p>{error}</p>}
      <div id={jitsiConfig.parentNode} />
    </div>
  );
}

Sample Usage (Component)

import React, { useState } from 'react'

import { Jutsu } from 'react-jutsu'

const App = () => {
  const [room, setRoom] = useState('')
  const [name, setName] = useState('')
  const [call, setCall] = useState(false)
  const [password, setPassword] = useState('')

  const handleClick = event => {
    event.preventDefault()
    if (room && name) setCall(true)
  }

  return call ? (
    <Jutsu
      roomName={room}
      displayName={name}
      password={password}
      onMeetingEnd={() => console.log('Meeting has ended')}
      loadingComponent={<p>loading ...</p>}
      errorComponent={<p>Oops, something went wrong</p>} />
  ) : (
    <form>
      <input id='room' type='text' placeholder='Room' value={room} onChange={(e) => setRoom(e.target.value)} />
      <input id='name' type='text' placeholder='Name' value={name} onChange={(e) => setName(e.target.value)} />
      <input id='password' type='text' placeholder='Password (optional)' value={password} onChange={(e) => setPassword(e.target.value)} />
      <button onClick={handleClick} type='submit'>
        Start / Join
      </button>
    </form>
  )
}

export default App

Supported Configuration

Check the Jitsi Meet API docs for full configuration and how to use api commands when using the useJitsi hook

Room Name

The meeting room name

This prop is required to start a meeting

Display Name

The participant's displayed name

This prop is optional

Password

The meeting room password

This prop is optional

onMeetingEnd

Callback function executed after readyToClose event is fired

This prop is optional

Subject

The meeting subject (what is displayed at the top)

This prop is optional

<Jutsu
  subject='fan'
  roomName='naruto'
  password='dattebayo'
  displayName='uzumaki'
  onMeetingEnd={() => console.log('Meeting has ended')}
/>

Domain

<Jutsu domain='my-custom-domain.com'>

Your Jitsi domain to use, the default value is meet.jit.si

Loading Component

<Jutsu loadingComponent={<ProgressBar />}>

An optional loading component, the default value is <p>Loading ...</p>

Error Component

<Jutsu errorComponent={<p>Oops, something went wrong...</p>}>

An optional error component, the default value is a <p> containing the error.

Styles

Internally Jutsu is constructed inside 2 containers, you can add custom styles for each by specifying containerStyles and jitsiContainerstyles

The default values set as

<div
  style={{...{
    width: '800px',
    height: '400px'
  }, ...containerStyles}}
>
  <div
    style={{...{
      display: loading ? 'none' : 'block', // <- used for loadingComponent logic
      width: '100%',
      height: '100%'
    }, ...jitsiContainerStyles}}
  />
</div>

An example override could be

<Jutsu containerStyles={{ width: '1200px', height: '800px' }}>

configOverwrite

Configuration object to overwrite.

This prop is optional More details about possible key/values here

interfaceConfigOverwrite

Interface configuration object to overwrite.

This prop is optional More details about possible key/values here

onError

Callback function to be called with an error as the only parameter if any.

This prop is optional

onJitsi

Callback function to be called with the jitsi API client when instantiated.

This prop is optional

any other prop

Any other prop passed to the component will be passed to jitsi API constructor as part of the options parameter.

For instance: jwt, devices, userInfo

License

MIT © this-fifo