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

seat-charts

v0.0.21

Published

A React component for seat selection

Downloads

13

Readme

Bus and Event Seat Charts

Bus Seat Selection Functionality

This component allows users to select seats on a bus, providing a visual representation of the bus layout and interactive seat selection. It handles different seat statuses and gender-based seat reservations.

Installation

To install the required dependencies, run the following command:

npm install seat-charts

and i used sass

npm install -D sass-embedded

Seat Statuses

Seats have various statuses indicated by a Durum property:

  • 0: Seat is empty
  • 1: Seat sold to a female
  • 2: Seat reserved for a female
  • 3: Seat sold to a male
  • 4: Seat reserved for a male
  • 5: Seat is being sold
  • 6: Seat is unavailable

Adjacent seats (DurumYan) also have statuses:

  • 0: Adjacent seat is empty (can be sold to any gender)
  • 1: Adjacent seat sold to a female (can only be sold to females)
  • 2: Adjacent seat sold to a male (can only be sold to males)
  • 3, 4, 5, 6: Adjacent seat is undefined (cannot be sold)

Seats with seat numbers -1 represent corridors, doors, or tables:

  • "KO": Corridor
  • "KA", "PI": Door

Example Seat Data

The example seat data is included in your Bus.tsx file:

export const placeHolderBusSeats = [
  {
    KoltukStr: "01",
    KoltukNo: "1",
    Durum: "3",
    DurumYan: "0",
    KoltukFiyatiInternet: "350",
  },
  {
    KoltukStr: "KO",
    KoltukNo: "-1",
    Durum: "0",
    DurumYan: "0",
    KoltukFiyatiInternet: "0",
  },
  {
    KoltukStr: "KO",
    KoltukNo: "-1",
    Durum: "0",
    DurumYan: "0",
    KoltukFiyatiInternet: "0",
  },
  {
    KoltukStr: "02",
    KoltukNo: "2",
    Durum: "1",
    DurumYan: "1",
    KoltukFiyatiInternet: "350",
  },
  // Add more seats as needed
];

Event Seat Selection Functionality

This component describes the seating arrangement, including the status (occupied or available) and the price of each seat.

Data Format

The data is presented in the following format:

  • ': Start of row
  • ;: End of row
  • a: Available seat
  • x: Occupied seat
  • _: Space
  • [A1, 1, 45]: Seat information, [seat name, seat number, seat price]

Example Data

"'a[A1, 1, 45]a[A2, 2, 25]a[A3, 3, 25]a[A4, 4, 251]a[A5, 5, 25]a[A6, 6, 25]x[A7, 7, 25]; a[B1, 1, 25]a[B2, 2, 25]x[B3, 3, 25]a[B4, 4, 25]_a[B5, 5, 25]'"

Usage Example

The data I use for the bus and the event are in the src/data folder. You can get it from here
import "./App.css";
import { BusList, Event } from "seat-charts"; // required
import { placeHolderBusSeats } from "./Bus"; // required
import { BusListData } from "./BusListData"; // required
import "rsuite/dist/rsuite.min.css"; // required
import "../node_modules/seat-charts/src/styles/BusList.scss"; // required
import "../node_modules/seat-charts/src/styles/BusSeat.scss"; // required
import "../node_modules/seat-charts/src/styles/EventSeat.scss"; // required
import "../node_modules/seat-charts/src/styles/Event.scss"; // required
import { useState } from "react"; // required
import { seatMap } from "./EventSeat"; // required

function App() {
  const [userSelectedSeats, setUserSelectedSeats] = useState({}); // required
  const [selectedSeat, setSelectedSeat] = useState(""); // required
  const [busData, setBusData] = useState<any[]>([]); // required

  const [userSelectedEventSeats, setUserSelectedEventSeats] = useState([]); // required

  return (
    <>
      <BusList
        busSeats={placeHolderBusSeats}
        busTicketData={BusListData as any} // needs to be specified as any
        onUserSelectedSeatsChange={setUserSelectedSeats}
        onSelectedSeatChange={setSelectedSeat}
        onBusDataChange={setBusData}
      />
      <Event
        seatMap={seatMap}
        onUserSelectedSeatsChange={setUserSelectedEventSeats as any} // needs to be specified as any
      />
    </>
  );
}

export default App;

Dependencies:

{
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "react-icons": "^5.2.1",
  "rsuite": "^5.64.0",
  "sass": "^1.77.3"
}