סרגל צף — קוד להעתקה

3 קבצים מוכנים להעתקה ישירה למערכת Base44 אחרת

3 קבצים
Drag & Drop
Dock/Undock
Reorder
RTL Ready

התקנה מהירה

  1. 1. צור תיקייה components/layout/ במערכת החדשה
  2. 2. העתק כל קובץ למיקום שלו (3 קבצים)
  3. 3. הוסף את שורת ה-import ל-Layout.js
  4. 4. התאם את מערך buttons + DEFAULT_DOCKED לכפתורים שלך
  5. 5. שנה את תוכן הפאנלים ב-Container לפי הצורך
components/layout/DockableButtonsSystem.jsx
133 שורות
import React, { useState, useEffect, useRef, createContext, useContext } from "react";
import { motion, AnimatePresence } from "framer-motion";
import { GripVertical, Plus } from "lucide-react";
import { cn } from "@/lib/utils";

const DockContext = createContext(null);
export const useDock = () => useContext(DockContext);

// ═══════════════════════════════════════════
// כפתור צף בודד — מוצג כשהוצא מהסרגל
// ═══════════════════════════════════════════
export function DraggableFloatingButton({ id, icon: Icon, label, gradient, glow, solid, onClick, isActive }) {
  const { addToDock, isInDock } = useDock();
  const [position, setPosition] = useState(() => {
    const saved = localStorage.getItem(`floating-btn-pos-${id}`);
    return saved ? JSON.parse(saved) : { x: window.innerWidth - 80, y: 80 };
  });
  const [isDragging, setIsDragging] = useState(false);
  const dragStartRef = useRef({ x: 0, y: 0, posX: 0, posY: 0 });

  if (isInDock(id)) return null;

  const handleMouseDown = (e) => {
    if (e.target.closest('.btn-drag-handle')) {
      setIsDragging(true);
      dragStartRef.current = { x: e.clientX, y: e.clientY, posX: position.x, posY: position.y };
      e.preventDefault();
    }
  };


// ... (לחץ "הצג הכל" לראות את שאר הקוד)

⚠️ תלויות נדרשות (כבר מותקנות בכל פרויקט Base44)

framer-motion
lucide-react
@/components/ui/tooltip
@/components/ui/card
@/lib/utils (cn)
localStorage