Rende il CRM comodo da usare anche da cellulare.
Aggiunge navigazione mobile dedicata e trasforma le principali liste operative in layout più leggibili e facili da toccare. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["panel"]
|
||||
|
||||
connect() {
|
||||
this.boundKey = this.onKey.bind(this)
|
||||
document.addEventListener("keydown", this.boundKey)
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
document.removeEventListener("keydown", this.boundKey)
|
||||
document.body.classList.remove("overflow-hidden")
|
||||
}
|
||||
|
||||
toggle(event) {
|
||||
event?.preventDefault()
|
||||
event?.stopPropagation()
|
||||
this.panelTarget.classList.contains("hidden") ? this.show() : this.hide()
|
||||
}
|
||||
|
||||
show() {
|
||||
this.panelTarget.classList.remove("hidden")
|
||||
document.body.classList.add("overflow-hidden")
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.panelTarget.classList.add("hidden")
|
||||
document.body.classList.remove("overflow-hidden")
|
||||
}
|
||||
|
||||
onKey(event) {
|
||||
if (event.key === "Escape") this.hide()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user