File size: 11,537 Bytes
337d870
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Panel - Unnoticed</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        body {
            background: #f8fafc;
        }
        .sidebar {
            width: 250px;
            transition: all 0.3s;
        }
        .main-content {
            margin-left: 250px;
            transition: all 0.3s;
        }
        @media (max-width: 768px) {
            .sidebar {
                margin-left: -250px;
            }
            .main-content {
                margin-left: 0;
            }
            .sidebar.active {
                margin-left: 0;
            }
            .main-content.active {
                margin-left: 250px;
            }
        }
    </style>
</head>
<body class="font-sans">
    <!-- Login Modal -->
    <div id="loginModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
        <div class="bg-white rounded-lg p-8 max-w-md w-full mx-4">
            <h2 class="text-2xl font-bold mb-6 text-center">Admin Login</h2>
            <form id="loginForm">
                <div class="mb-4">
                    <label for="username" class="block text-gray-700 mb-2">Username</label>
                    <input type="text" id="username" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" required>
                </div>
                <div class="mb-6">
                    <label for="password" class="block text-gray-700 mb-2">Password</label>
                    <input type="password" id="password" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" required>
                </div>
                <button type="submit" class="w-full bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition mb-3">Login</button>
                <button type="button" onclick="window.location.href='/'" class="w-full bg-gray-600 text-white py-2 px-4 rounded-md hover:bg-gray-700 transition">Exit to Home</button>
            </form>
            <p id="loginError" class="text-red-500 mt-4 text-center hidden">Invalid credentials. Please try again.</p>
        </div>
    </div>

    <!-- Main Admin Layout (hidden until login) -->
    <div id="adminLayout" class="hidden">
        <!-- Sidebar -->
        <div class="sidebar fixed inset-y-0 left-0 bg-gray-800 text-white z-40">
            <div class="p-4 border-b border-gray-700">
                <h1 class="text-xl font-semibold">Unnoticed Admin</h1>
            </div>
            <nav class="mt-6">
                <a href="#" class="block py-2 px-4 bg-gray-700">Dashboard</a>
                <a href="#music-management" class="block py-2 px-4 hover:bg-gray-700 transition">Music Management</a>
                <a href="#settings" class="block py-2 px-4 hover:bg-gray-700 transition">Settings</a>
                <a href="/" class="block py-2 px-4 hover:bg-gray-700 transition">View Site</a>
                <a href="#" id="logoutBtn" class="block py-2 px-4 hover:bg-gray-700 transition">Logout</a>
            </nav>
        </div>

        <!-- Main Content -->
        <div class="main-content min-h-screen">
            <!-- Top Bar -->
            <div class="bg-white shadow-sm border-b border-gray-200 p-4 flex justify-between items-center">
                <button id="sidebarToggle" class="md:hidden">
                    <i data-feather="menu"></i>
                </button>
                <h2 class="text-lg font-semibold">Admin Dashboard</h2>
                <div class="flex items-center space-x-4">
                    <span>Welcome, Admin</span>
                    <div class="w-8 h-8 bg-gray-300 rounded-full"></div>
                </div>
            </div>

            <!-- Dashboard Content -->
            <div class="p-6">
                <!-- Music Management Section -->
                <section id="music-management" class="mb-8">
                    <h3 class="text-xl font-semibold mb-4">Music Management</h3>
                    <div class="bg-white shadow rounded-lg p-6 mb-6">
                        <h4 class="text-lg font-medium mb-4">Add New Track</h4>
                        <form id="addTrackForm" class="grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <label class="block text-gray-700 mb-2">Title</label>
                                <input type="text" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
                            </div>
                            <div>
                                <label class="block text-gray-700 mb-2">Platform Link</label>
                                <input type="url" class="w-full px-3 py-2 border border-gray-300 rounded-md" required>
                            </div>
                            <div>
                                <label class="block text-gray-700 mb-2">Album Art URL</label>
                                <input type="url" class="w-full px-3 py-2 border border-gray-300 rounded-md">
                            </div>
                            <div>
                                <label class="block text-gray-700 mb-2">Audio File/URL</label>
                                <input type="file" accept="audio/*" class="w-full px-3 py-2 border border-gray-300 rounded-md">
                            </div>
                            <div class="md:col-span-2">
                                <button type="submit" class="bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition">Add Track</button>
                            </div>
                        </form>
                    </div>

                    <div class="bg-white shadow rounded-lg p-6">
                        <h4 class="text-lg font-medium mb-4">Current Tracks</h4>
                        <div class="overflow-x-auto">
                            <table class="min-w-full">
                                <thead>
                                    <tr class="border-b">
                                        <th class="py-2 px-4 text-left">Title</th>
                                        <th class="py-2 px-4 text-left">Platform</th>
                                        <th class="py-2 px-4 text-left">Actions</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="border-b">
                                        <td class="py-2 px-4">Sample Track 1</td>
                                        <td class="py-2 px-4">Spotify</td>
                                        <td class="py-2 px-4">
                                            <button class="text-blue-600 hover:text-blue-800 mr-2">Edit</button>
                                            <button class="text-red-600 hover:text-red-800">Delete</button>
                                        </td>
                                    </tr>
                                    <tr class="border-b">
                                        <td class="py-2 px-4">Sample Track 2</td>
                                        <td class="py-2 px-4">YouTube</td>
                                        <td class="py-2 px-4">
                                            <button class="text-blue-600 hover:text-blue-800 mr-2">Edit</button>
                                            <button class="text-red-600 hover:text-red-800">Delete</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </section>

                <!-- Settings Section -->
                <section id="settings">
                    <h3 class="text-xl font-semibold mb-4">Settings</h3>
                    <div class="bg-white shadow rounded-lg p-6">
                        <div class="mb-4">
                            <label class="flex items-center space-x-2">
                                <input type="checkbox" id="fullSongToggle" class="rounded text-blue-600">
                                <span>Enable full song playback (instead of preview)</span>
                            </label>
                        </div>
                        <div class="mb-4">
                            <label class="block text-gray-700 mb-2">Scrape Interval (minutes)</label>
                            <input type="number" value="60" min="5" class="w-full px-3 py-2 border border-gray-300 rounded-md max-w-xs">
                        </div>
                        <div>
                            <button class="bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-blue-700 transition">Save Settings</button>
                        </div>
                    </div>
                </section>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            
            // Check if already logged in
            if (localStorage.getItem('adminLoggedIn') === 'true') {
                document.getElementById('loginModal').classList.add('hidden');
                document.getElementById('adminLayout').classList.remove('hidden');
            }
            
            // Login form handling
            document.getElementById('loginForm').addEventListener('submit', function(e) {
                e.preventDefault();
                const username = document.getElementById('username').value;
                const password = document.getElementById('password').value;
                
                if (username === 'youngtoaster' && password === '160582') {
                    localStorage.setItem('adminLoggedIn', 'true');
                    document.getElementById('loginModal').classList.add('hidden');
                    document.getElementById('adminLayout').classList.remove('hidden');
                } else {
                    document.getElementById('loginError').classList.remove('hidden');
                }
            });
            
            // Logout functionality
            document.getElementById('logoutBtn').addEventListener('click', function() {
                localStorage.removeItem('adminLoggedIn');
                location.reload();
            });
            
            // Mobile sidebar toggle
            document.getElementById('sidebarToggle').addEventListener('click', function() {
                document.querySelector('.sidebar').classList.toggle('active');
                document.querySelector('.main-content').classList.toggle('active');
            });
            
            // Full song toggle functionality
            const fullSongToggle = document.getElementById('fullSongToggle');
            if (localStorage.getItem('fullSongEnabled') === 'true') {
                fullSongToggle.checked = true;
            }
            
            fullSongToggle.addEventListener('change', function() {
                localStorage.setItem('fullSongEnabled', this.checked);
            });
        });
    </script>
</body>
</html>