Giter Club home page Giter Club logo

Comments (12)

roggervalf avatar roggervalf commented on August 14, 2024

hi @ryanFonseka, react-seat-picker does not have a declaration file for now, also you could run the example project that it's in this repo, testing from there I'm getting the expected result
Selection_040
Could you please provide more details about it? to try to reproduce it

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

Hi,
this is my code

`import React, {Component} from 'react'
 
import SeatPicker from 'react-seat-picker';
// const SeatPicker = require('react-seat-picker');

 
export default class SeatPlan extends Component {
  state = {
    loading: false
  }
 
  addSeatCallback = ({ row, number, id }, addCb) => {
    this.setState({
      loading: true
    }, async () => {
      await new Promise(resolve => setTimeout(resolve, 1500))
      console.log(`Added seat ${number}, row ${row}, id ${id}`)
      const newTooltip = `tooltip for id-${id} added by callback`
      addCb(row, number, id, newTooltip)
      this.setState({ loading: false })
    })
  }
 
  addSeatCallbackContinousCase = ({ row, number, id }, addCb, params, removeCb) => {
    this.setState({
      loading: true
    }, async () => {
      if (removeCb) {
        await new Promise(resolve => setTimeout(resolve, 750))
        console.log(`Removed seat ${params.number}, row ${params.row}, id ${params.id}`)
        removeCb(params.row, params.number)
      }
      await new Promise(resolve => setTimeout(resolve, 750))
      console.log(`Added seat ${number}, row ${row}, id ${id}`)
      const newTooltip = `tooltip for id-${id} added by callback`
      addCb(row, number, id, newTooltip)
      this.setState({ loading: false })
    })
  }
 
  removeSeatCallback = ({ row, number, id }, removeCb) => {
    this.setState({
      loading: true
    }, async () => {
      await new Promise(resolve => setTimeout(resolve, 1500))
      console.log(`Removed seat ${number}, row ${row}, id ${id}`)
      // A value of null will reset the tooltip to the original while '' will hide the tooltip
      const newTooltip = ['A', 'B', 'C'].includes(row) ? null : ''
      removeCb(row, number, newTooltip)
      this.setState({ loading: false })
    })
  }
 
  render() {
    const rows = [
      [
        { id: 1, number: 1, isSelected: true, tooltip: "Reserved by you" },
        { id: 2, number: 2, tooltip: "Cost: 15$" },
        null,
        {
          id: 3,
          number: "3",
          isReserved: true,
          orientation: "east",
          tooltip: "Reserved by Rogger"
        },
        { id: 4, number: "4", orientation: "west" },
        null,
        { id: 5, number: 5 },
        { id: 6, number: 6 }
      ],
      [
        {
          id: 7,
          number: 1,
          isReserved: true,
          tooltip: "Reserved by Matthias Nadler"
        },
        { id: 8, number: 2, isReserved: true },
        null,
        { id: 9, number: "3", isReserved: true, orientation: "east" },
        { id: 10, number: "4", orientation: "west" },
        null,
        { id: 11, number: 5 },
        { id: 12, number: 6 }
      ],
      [
        { id: 13, number: 1 },
        { id: 14, number: 2 },
        null,
        { id: 15, number: 3, isReserved: true, orientation: "east" },
        { id: 16, number: "4", orientation: "west" },
        null,
        { id: 17, number: 5 },
        { id: 18, number: 6 }
      ],
      [
        { id: 19, number: 1, tooltip: "Cost: 25$" },
        { id: 20, number: 2 },
        null,
        { id: 21, number: 3, orientation: "east" },
        { id: 22, number: "4", orientation: "west" },
        null,
        { id: 23, number: 5 },
        { id: 24, number: 6, orientation: "west" }
      ],

    ]
    const {loading} = this.state
    return (
      <div>
        <h1>Seat Picker</h1>
        <div>
          <SeatPicker   className="AppSeat"
            addSeatCallback={this.addSeatCallback}
            removeSeatCallback={this.removeSeatCallback}
            rows={rows}
            maxReservableSeats={10}
            alpha
            visible
            selectedByDefault
            loading={loading}
            tooltipProps={{multiline: true}}
          />
        </div>
        <h1>Seat Picker Continuous Case</h1>
        <div style={{ marginTop: '100px' }}>
          <SeatPicker
            addSeatCallback={this.addSeatCallbackContinousCase}
            removeSeatCallback={this.removeSeatCallback}
            rows={rows}
            maxReservableSeats={3}
            alpha
            visible
            selectedByDefault
            loading={loading}
            tooltipProps={{ multiline: true }}
            continuous
          />
        </div>



      </div>
    )
  } 
}`

this is my repo at Node modules
image

I face some errors when installing this package as npm install react-seat-picker too.
I really want to use this library for my exam. what more details do you need?

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

@roggervalf any updates for my request?

from react-seat-picker.

roggervalf avatar roggervalf commented on August 14, 2024

hi @ryanFonseka, sorry for the delay these days are holidays in my country, I tried your code in Firefox and Chrome and it shows the null seat properly, which browser are you using?

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

My browser is Edge. I tried reinstall the seat-picker but got this error
image

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

Hi, It was a CSS issue and I got it fixed by commenting on the following code in my CSS file

div.seat {
	background-color: green;
  }
  
  div.seat--reserved {
	background-color: rgb(209, 7, 7);
  }
  
  div.seat--selected {
	background-color: blue;
  }
  
  .seat-picker {
	margin: auto;
  }
  
  .seat-picker__row {
  }
  
  .seat-picker__row__number {
  }
  
  /* div.blank {
	display: none;
  } */

Thanks, @roggervalf for your help. can we change the row characters as we desired as in "A1, A2, A3.." or "AL1,AR1,AL2..."
image

also how to remove an empty row character
image

from react-seat-picker.

roggervalf avatar roggervalf commented on August 14, 2024

Thanks, @roggervalf for your help. can we change the row characters as we desired as in "A1, A2, A3.." or "AL1,AR1,AL2..."

also how to remove an empty row character

Hey @ryanFonseka, rows only can be alpha true or false (letters or numbers) and the row could not be removed as well, but there is a prop visible that hides the row title, and maybe use the seat number could help like AL1, AL2 and so on.

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

@roggervalf Hi thanks for the information. If i want to add a title text in a blank row(in row D ) is there a workaround like
image

from react-seat-picker.

roggervalf avatar roggervalf commented on August 14, 2024

@ryanFonseka for now it does not support that, I will add an enhancement label in this issue

from react-seat-picker.

ryanFonseka avatar ryanFonseka commented on August 14, 2024

@roggervalf Hi brother any updates for the above?

from react-seat-picker.

roggervalf avatar roggervalf commented on August 14, 2024

Hi @ryanFonseka, sorry but I didn't have the time to work on this, but I'm open to receive prs for it

from react-seat-picker.

congvinhnguyennn avatar congvinhnguyennn commented on August 14, 2024

My browser is Edge. I tried reinstall the seat-picker but got this error image

hi, can i ask the way to solve this problem ? I got this problem too.

from react-seat-picker.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.