Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not find a declaration file for module 'react-seat-picker' #46

Open
ryanFonseka opened this issue Jul 27, 2021 · 12 comments
Open
Labels
enhancement New feature or request

Comments

@ryanFonseka
Copy link

Hi, I get the following error when trying to render the seat plan.
image

also "Null" in between seats also not been taken properly
image
image

hope someone will help

@roggervalf
Copy link
Owner

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

@ryanFonseka
Copy link
Author

ryanFonseka commented Jul 28, 2021

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?

@ryanFonseka
Copy link
Author

@roggervalf any updates for my request?

@roggervalf
Copy link
Owner

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?

@ryanFonseka
Copy link
Author

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

@ryanFonseka
Copy link
Author

ryanFonseka commented Jul 30, 2021

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

@roggervalf
Copy link
Owner

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.

@ryanFonseka
Copy link
Author

@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

@roggervalf
Copy link
Owner

roggervalf commented Aug 4, 2021

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

@roggervalf roggervalf added the enhancement New feature or request label Aug 5, 2021
@ryanFonseka
Copy link
Author

@roggervalf Hi brother any updates for the above?

@roggervalf
Copy link
Owner

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

@congvinhnguyennn
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants