File size: 8,985 Bytes
5c988cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Machine Control FAB</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .fab-container {
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            z-index: 999;
        }
        
        .fab-buttons {
            display: flex;
            flex-direction: column-reverse;
            gap: 15px;
        }
        
        .fab-button {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background: white;
            color: #333;
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            transition: all 0.2s ease;
            position: relative;
        }
        
        .fab-button:hover {
            transform: translateY(-3px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }
        
        .fab-button .tooltip {
            position: absolute;
            right: 60px;
            background: #333;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 12px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s;
        }
        
        .fab-button:hover .tooltip {
            opacity: 1;
        }
        
        .fab-button.active {
            background: #3b82f6;
            color: white;
            transform: scale(1.1);
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
        }
        
        .fab-button.active i {
            animation: bounce 0.5s;
        }
        
        @keyframes bounce {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.3); }
        }
        
        @keyframes pulse {
            0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
            70% { box-shadow: 0 0 0 10px rgba(59, 130, 246, 0); }
            100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
        }
        
        .pulse {
            animation: pulse 1.5s infinite;
        }
    </style>
</head>
<body class="bg-gray-100 min-h-screen">
    <div class="container mx-auto p-8">
        <h1 class="text-3xl font-bold text-gray-800 mb-6">Machine Control Panel</h1>
        <p class="text-gray-600 mb-8">This page demonstrates a floating action button with machine controls. Click the blue button at the bottom right to access the controls.</p>
        
        <div class="bg-white p-6 rounded-lg shadow-md">
            <h2 class="text-xl font-semibold mb-4">Machine Status</h2>
            <div class="space-y-4">
                <div class="flex items-center">
                    <div class="w-3 h-3 rounded-full bg-gray-400 mr-2" id="power-status-indicator"></div>
                    <span id="power-status-text">Machine is off</span>
                </div>
                <div class="flex items-center">
                    <div class="w-3 h-3 rounded-full bg-gray-400 mr-2" id="sleep-status-indicator"></div>
                    <span id="sleep-status-text">Sleep mode inactive</span>
                </div>
            </div>
        </div>
    </div>
    
    <div class="fab-container">
        <div class="fab-buttons" id="fabButtons">
            <div class="fab-button" id="documentBtn">
                <i class="fas fa-file-alt"></i>
                <span class="tooltip">Open Document</span>
            </div>
            <div class="fab-button" id="sleepBtn">
                <i class="fas fa-robot"></i>
                <span class="tooltip">Sleep Mode</span>
            </div>
            <div class="fab-button" id="powerBtn">
                <i class="fas fa-bolt"></i>
                <span class="tooltip">Power Control</span>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const fabMain = document.getElementById('fabMain');
            const fabButtons = document.getElementById('fabButtons');
            const documentBtn = document.getElementById('documentBtn');
            const sleepBtn = document.getElementById('sleepBtn');
            const powerBtn = document.getElementById('powerBtn');
            const sleepSwitch = document.getElementById('sleepSwitch');
            const powerSwitch = document.getElementById('powerSwitch');
            const powerStatusText = document.getElementById('power-status-text');
            const sleepStatusText = document.getElementById('sleep-status-text');
            const powerStatusIndicator = document.getElementById('power-status-indicator');
            const sleepStatusIndicator = document.getElementById('sleep-status-indicator');
            
            let isMenuOpen = false;
            let isMachineOn = false;
            let isSleepModeOn = false;
            
            // Document button
            documentBtn.addEventListener('click', function() {
                alert('Opening machine documentation...');
                // In a real app, this would open a document
                closeMenu();
            });
            
            // Sleep mode button
            sleepBtn.addEventListener('click', function() {
                isSleepModeOn = !isSleepModeOn;
                this.classList.toggle('active');
                
                if (isSleepModeOn) {
                    sleepStatusText.textContent = 'Sleep mode active';
                    sleepStatusIndicator.className = 'w-3 h-3 rounded-full bg-yellow-500 mr-2';
                    this.querySelector('i').className = 'fas fa-bed';
                } else {
                    sleepStatusText.textContent = 'Sleep mode inactive';
                    sleepStatusIndicator.className = 'w-3 h-3 rounded-full bg-gray-400 mr-2';
                    this.querySelector('i').className = 'fas fa-robot';
                }
            });
            
            // Power button
            powerBtn.addEventListener('click', function() {
                isMachineOn = !isMachineOn;
                this.classList.toggle('active');
                
                if (isMachineOn) {
                    powerStatusText.textContent = 'Machine is running';
                    powerStatusIndicator.className = 'w-3 h-3 rounded-full bg-green-500 mr-2';
                    this.querySelector('i').className = 'fas fa-plug-circle-check';
                    
                    // If machine was sleeping, wake it up
                    if (isSleepModeOn) {
                        isSleepModeOn = false;
                        sleepBtn.classList.remove('active');
                        sleepStatusText.textContent = 'Sleep mode inactive';
                        sleepStatusIndicator.className = 'w-3 h-3 rounded-full bg-gray-400 mr-2';
                        sleepBtn.querySelector('i').className = 'fas fa-robot';
                    }
                } else {
                    powerStatusText.textContent = 'Machine is off';
                    powerStatusIndicator.className = 'w-3 h-3 rounded-full bg-gray-400 mr-2';
                    this.querySelector('i').className = 'fas fa-plug-circle-xmark';
                }
            });
            
            function closeMenu() {
                isMenuOpen = false;
                fabButtons.classList.remove('show');
                fabMain.innerHTML = '<i class="fas fa-cogs text-xl"></i>';
                fabMain.style.background = 'linear-gradient(135deg, #3b82f6, #1d4ed8)';
                fabMain.classList.add('pulse');
            }
            
            // Close menu when clicking outside
            document.addEventListener('click', function(e) {
                if (!fabMain.contains(e.target) && !fabButtons.contains(e.target)) {
                    if (isMenuOpen) {
                        closeMenu();
                    }
                }
            });
        });
    </script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MVCavalheiroJr/fab-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>