Comments (12)
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
Could you please provide more details about it? to try to reproduce it
from react-seat-picker.
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
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.
@roggervalf any updates for my request?
from react-seat-picker.
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.
My browser is Edge. I tried reinstall the seat-picker but got this error
from react-seat-picker.
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..."
also how to remove an empty row character
from react-seat-picker.
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.
@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
from react-seat-picker.
@ryanFonseka for now it does not support that, I will add an enhancement label in this issue
from react-seat-picker.
@roggervalf Hi brother any updates for the above?
from react-seat-picker.
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.
My browser is Edge. I tried reinstall the seat-picker but got this error
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-seat-picker.