Spaces:
Running
Running
make this website: https://huggingface.co/spaces/enzostvs/deepsite
Browse files- README.md +7 -4
- components/footer.js +79 -0
- components/navbar.js +52 -0
- index.html +118 -19
- script.js +93 -0
- style.css +58 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji: 📊
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
|
|
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: DeepSite Explorer 🚀
|
|
|
|
| 3 |
colorFrom: blue
|
| 4 |
+
colorTo: blue
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://huggingface.co/deepsite).
|
components/footer.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.footer {
|
| 7 |
+
background-color: white;
|
| 8 |
+
border-top: 1px solid #e5e7eb;
|
| 9 |
+
}
|
| 10 |
+
.dark .footer {
|
| 11 |
+
background-color: #1f2937;
|
| 12 |
+
border-top: 1px solid #374151;
|
| 13 |
+
}
|
| 14 |
+
.footer-link {
|
| 15 |
+
color: #6b7280;
|
| 16 |
+
transition: color 0.2s ease;
|
| 17 |
+
}
|
| 18 |
+
.footer-link:hover {
|
| 19 |
+
color: #6366f1;
|
| 20 |
+
}
|
| 21 |
+
.dark .footer-link {
|
| 22 |
+
color: #9ca3af;
|
| 23 |
+
}
|
| 24 |
+
.dark .footer-link:hover {
|
| 25 |
+
color: #8b5cf6;
|
| 26 |
+
}
|
| 27 |
+
</style>
|
| 28 |
+
<footer class="footer py-8 mt-12">
|
| 29 |
+
<div class="container mx-auto px-4">
|
| 30 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 31 |
+
<div>
|
| 32 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">DeepSite Explorer</h3>
|
| 33 |
+
<p class="text-gray-600 dark:text-gray-400 mb-4">Advanced deep learning for site analysis and prediction.</p>
|
| 34 |
+
<div class="flex space-x-4">
|
| 35 |
+
<a href="#" class="footer-link">
|
| 36 |
+
<i data-feather="github"></i>
|
| 37 |
+
</a>
|
| 38 |
+
<a href="#" class="footer-link">
|
| 39 |
+
<i data-feather="twitter"></i>
|
| 40 |
+
</a>
|
| 41 |
+
<a href="#" class="footer-link">
|
| 42 |
+
<i data-feather="linkedin"></i>
|
| 43 |
+
</a>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
<div>
|
| 47 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">Resources</h3>
|
| 48 |
+
<ul class="space-y-2">
|
| 49 |
+
<li><a href="#" class="footer-link">Documentation</a></li>
|
| 50 |
+
<li><a href="#" class="footer-link">Tutorials</a></li>
|
| 51 |
+
<li><a href="#" class="footer-link">API Reference</a></li>
|
| 52 |
+
</ul>
|
| 53 |
+
</div>
|
| 54 |
+
<div>
|
| 55 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">Company</h3>
|
| 56 |
+
<ul class="space-y-2">
|
| 57 |
+
<li><a href="#" class="footer-link">About Us</a></li>
|
| 58 |
+
<li><a href="#" class="footer-link">Careers</a></li>
|
| 59 |
+
<li><a href="#" class="footer-link">Contact</a></li>
|
| 60 |
+
</ul>
|
| 61 |
+
</div>
|
| 62 |
+
<div>
|
| 63 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-4">Legal</h3>
|
| 64 |
+
<ul class="space-y-2">
|
| 65 |
+
<li><a href="#" class="footer-link">Privacy Policy</a></li>
|
| 66 |
+
<li><a href="#" class="footer-link">Terms of Service</a></li>
|
| 67 |
+
<li><a href="#" class="footer-link">Cookie Policy</a></li>
|
| 68 |
+
</ul>
|
| 69 |
+
</div>
|
| 70 |
+
</div>
|
| 71 |
+
<div class="border-t border-gray-200 dark:border-gray-700 mt-8 pt-8 text-center text-gray-500 dark:text-gray-400">
|
| 72 |
+
<p>© 2023 DeepSite Explorer. All rights reserved.</p>
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
</footer>
|
| 76 |
+
`;
|
| 77 |
+
}
|
| 78 |
+
}
|
| 79 |
+
customElements.define('custom-footer', CustomFooter);
|
components/navbar.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomNavbar extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.navbar {
|
| 7 |
+
background-color: white;
|
| 8 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
| 9 |
+
}
|
| 10 |
+
.dark .navbar {
|
| 11 |
+
background-color: #1f2937;
|
| 12 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
| 13 |
+
}
|
| 14 |
+
.nav-link {
|
| 15 |
+
color: #4b5563;
|
| 16 |
+
transition: color 0.2s ease;
|
| 17 |
+
}
|
| 18 |
+
.nav-link:hover {
|
| 19 |
+
color: #6366f1;
|
| 20 |
+
}
|
| 21 |
+
.dark .nav-link {
|
| 22 |
+
color: #d1d5db;
|
| 23 |
+
}
|
| 24 |
+
.dark .nav-link:hover {
|
| 25 |
+
color: #8b5cf6;
|
| 26 |
+
}
|
| 27 |
+
</style>
|
| 28 |
+
<nav class="navbar px-6 py-4">
|
| 29 |
+
<div class="navbar-content max-w-7xl mx-auto flex items-center justify-between">
|
| 30 |
+
<div class="flex items-center space-x-8">
|
| 31 |
+
<a href="/" class="flex items-center space-x-2">
|
| 32 |
+
<i data-feather="cpu" class="w-6 h-6 text-primary-500"></i>
|
| 33 |
+
<span class="text-xl font-bold text-gray-800 dark:text-white">DeepSite Explorer</span>
|
| 34 |
+
</a>
|
| 35 |
+
<div class="hidden md:flex space-x-6">
|
| 36 |
+
<a href="#" class="nav-link font-medium">Home</a>
|
| 37 |
+
<a href="#" class="nav-link font-medium">Models</a>
|
| 38 |
+
<a href="#" class="nav-link font-medium">Documentation</a>
|
| 39 |
+
<a href="#" class="nav-link font-medium">About</a>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
<div class="flex items-center space-x-4">
|
| 43 |
+
<a href="#" class="p-2 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-200 hover:bg-gray-200 dark:hover:bg-gray-600 transition">
|
| 44 |
+
<i data-feather="user"></i>
|
| 45 |
+
</a>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</nav>
|
| 49 |
+
`;
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,118 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>DeepSite Explorer</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 10 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 11 |
+
<script>
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class',
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: {
|
| 18 |
+
500: '#6366f1',
|
| 19 |
+
},
|
| 20 |
+
secondary: {
|
| 21 |
+
500: '#8b5cf6',
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
</script>
|
| 28 |
+
</head>
|
| 29 |
+
<body class="bg-gray-100 dark:bg-gray-900 min-h-screen">
|
| 30 |
+
<custom-navbar></custom-navbar>
|
| 31 |
+
|
| 32 |
+
<main class="container mx-auto px-4 py-8">
|
| 33 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
| 34 |
+
<!-- Left Sidebar -->
|
| 35 |
+
<div class="lg:col-span-1">
|
| 36 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6">
|
| 37 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4">Model Selection</h2>
|
| 38 |
+
<div class="space-y-4">
|
| 39 |
+
<div class="flex items-center space-x-3">
|
| 40 |
+
<input type="radio" id="model1" name="model" class="text-primary-500" checked>
|
| 41 |
+
<label for="model1" class="text-gray-700 dark:text-gray-300">DeepSite v1.0</label>
|
| 42 |
+
</div>
|
| 43 |
+
<div class="flex items-center space-x-3">
|
| 44 |
+
<input type="radio" id="model2" name="model" class="text-primary-500">
|
| 45 |
+
<label for="model2" class="text-gray-700 dark:text-gray-300">DeepSite v2.0</label>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
|
| 50 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
| 51 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4">Parameters</h2>
|
| 52 |
+
<div class="space-y-4">
|
| 53 |
+
<div>
|
| 54 |
+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Confidence Threshold</label>
|
| 55 |
+
<input type="range" min="0" max="100" value="50" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
|
| 56 |
+
</div>
|
| 57 |
+
<div>
|
| 58 |
+
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Batch Size</label>
|
| 59 |
+
<select class="w-full px-3 py-2 bg-gray-100 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-primary-500 focus:border-primary-500">
|
| 60 |
+
<option>8</option>
|
| 61 |
+
<option selected>16</option>
|
| 62 |
+
<option>32</option>
|
| 63 |
+
</select>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
</div>
|
| 67 |
+
</div>
|
| 68 |
+
|
| 69 |
+
<!-- Main Content -->
|
| 70 |
+
<div class="lg:col-span-2">
|
| 71 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 mb-6">
|
| 72 |
+
<div class="flex justify-between items-center mb-4">
|
| 73 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white">Input</h2>
|
| 74 |
+
<div class="flex space-x-2">
|
| 75 |
+
<button class="px-3 py-1 bg-primary-500 text-white rounded-md hover:bg-primary-600 transition">Upload</button>
|
| 76 |
+
<button class="px-3 py-1 bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-white rounded-md hover:bg-gray-300 dark:hover:bg-gray-600 transition">Sample</button>
|
| 77 |
+
</div>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-8 text-center">
|
| 80 |
+
<i data-feather="upload-cloud" class="w-12 h-12 mx-auto text-gray-400 mb-2"></i>
|
| 81 |
+
<p class="text-gray-500 dark:text-gray-400">Drag & drop your image here or click to browse</p>
|
| 82 |
+
</div>
|
| 83 |
+
</div>
|
| 84 |
+
|
| 85 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6">
|
| 86 |
+
<div class="flex justify-between items-center mb-4">
|
| 87 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white">Results</h2>
|
| 88 |
+
<button class="px-3 py-1 bg-primary-500 text-white rounded-md hover:bg-primary-600 transition">Run Model</button>
|
| 89 |
+
</div>
|
| 90 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 91 |
+
<div class="bg-gray-100 dark:bg-gray-700 rounded-lg p-4">
|
| 92 |
+
<div class="aspect-w-16 aspect-h-9 bg-gray-200 dark:bg-gray-600 rounded-md mb-2">
|
| 93 |
+
<img src="http://static.photos/technology/640x360/1" alt="Sample output" class="w-full h-full object-cover rounded-md">
|
| 94 |
+
</div>
|
| 95 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Input Image</h3>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="bg-gray-100 dark:bg-gray-700 rounded-lg p-4">
|
| 98 |
+
<div class="aspect-w-16 aspect-h-9 bg-gray-200 dark:bg-gray-600 rounded-md mb-2 relative">
|
| 99 |
+
<img src="http://static.photos/technology/640x360/2" alt="Sample output" class="w-full h-full object-cover rounded-md">
|
| 100 |
+
<div class="absolute inset-0 border-2 border-primary-500 rounded-md pointer-events-none"></div>
|
| 101 |
+
</div>
|
| 102 |
+
<h3 class="font-medium text-gray-800 dark:text-white">Model Prediction</h3>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
</div>
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
</main>
|
| 109 |
+
|
| 110 |
+
<custom-footer></custom-footer>
|
| 111 |
+
|
| 112 |
+
<script src="components/navbar.js"></script>
|
| 113 |
+
<script src="components/footer.js"></script>
|
| 114 |
+
<script src="script.js"></script>
|
| 115 |
+
<script>feather.replace();</script>
|
| 116 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 117 |
+
</body>
|
| 118 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 2 |
+
// Theme toggle functionality
|
| 3 |
+
const themeToggle = document.createElement('div');
|
| 4 |
+
themeToggle.className = 'theme-toggle ml-4';
|
| 5 |
+
themeToggle.innerHTML = `
|
| 6 |
+
<button id="themeToggle" class="p-2 rounded-full bg-gray-200 dark:bg-gray-700 text-gray-700 dark:text-gray-200">
|
| 7 |
+
<i data-feather="moon" class="hidden dark:block"></i>
|
| 8 |
+
<i data-feather="sun" class="dark:hidden"></i>
|
| 9 |
+
</button>
|
| 10 |
+
`;
|
| 11 |
+
|
| 12 |
+
document.querySelector('custom-navbar').shadowRoot.querySelector('.navbar-content').appendChild(themeToggle);
|
| 13 |
+
|
| 14 |
+
document.getElementById('themeToggle').addEventListener('click', function() {
|
| 15 |
+
const html = document.documentElement;
|
| 16 |
+
html.classList.toggle('dark');
|
| 17 |
+
localStorage.setItem('darkMode', html.classList.contains('dark'));
|
| 18 |
+
feather.replace();
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
// Check for saved theme preference
|
| 22 |
+
if (localStorage.getItem('darkMode') === 'true') {
|
| 23 |
+
document.documentElement.classList.add('dark');
|
| 24 |
+
} else {
|
| 25 |
+
document.documentElement.classList.remove('dark');
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
// Initialize tooltips
|
| 29 |
+
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
| 30 |
+
tooltipTriggerList.map(function (tooltipTriggerEl) {
|
| 31 |
+
return new bootstrap.Tooltip(tooltipTriggerEl);
|
| 32 |
+
});
|
| 33 |
+
|
| 34 |
+
// File upload interaction
|
| 35 |
+
const fileUploadArea = document.querySelector('.border-dashed');
|
| 36 |
+
if (fileUploadArea) {
|
| 37 |
+
fileUploadArea.addEventListener('click', function() {
|
| 38 |
+
const fileInput = document.createElement('input');
|
| 39 |
+
fileInput.type = 'file';
|
| 40 |
+
fileInput.accept = 'image/*';
|
| 41 |
+
fileInput.click();
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
|
| 45 |
+
fileUploadArea.addEventListener(eventName, preventDefaults, false);
|
| 46 |
+
});
|
| 47 |
+
|
| 48 |
+
function preventDefaults(e) {
|
| 49 |
+
e.preventDefault();
|
| 50 |
+
e.stopPropagation();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
['dragenter', 'dragover'].forEach(eventName => {
|
| 54 |
+
fileUploadArea.addEventListener(eventName, highlight, false);
|
| 55 |
+
});
|
| 56 |
+
|
| 57 |
+
['dragleave', 'drop'].forEach(eventName => {
|
| 58 |
+
fileUploadArea.addEventListener(eventName, unhighlight, false);
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
function highlight() {
|
| 62 |
+
fileUploadArea.classList.add('border-primary-500', 'bg-primary-50');
|
| 63 |
+
fileUploadArea.classList.remove('border-gray-300', 'dark:border-gray-600');
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
function unhighlight() {
|
| 67 |
+
fileUploadArea.classList.remove('border-primary-500', 'bg-primary-50');
|
| 68 |
+
fileUploadArea.classList.add('border-gray-300', 'dark:border-gray-600');
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
fileUploadArea.addEventListener('drop', handleDrop, false);
|
| 72 |
+
|
| 73 |
+
function handleDrop(e) {
|
| 74 |
+
const dt = e.dataTransfer;
|
| 75 |
+
const files = dt.files;
|
| 76 |
+
handleFiles(files);
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
function handleFiles(files) {
|
| 80 |
+
if (files.length) {
|
| 81 |
+
const file = files[0];
|
| 82 |
+
if (file.type.startsWith('image/')) {
|
| 83 |
+
const reader = new FileReader();
|
| 84 |
+
reader.onload = function(e) {
|
| 85 |
+
// Handle the uploaded image
|
| 86 |
+
console.log('Image uploaded:', e.target.result);
|
| 87 |
+
};
|
| 88 |
+
reader.readAsDataURL(file);
|
| 89 |
+
}
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
}
|
| 93 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
}
|
| 25 |
|
| 26 |
-
.
|
| 27 |
-
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Custom scrollbar */
|
| 2 |
+
::-webkit-scrollbar {
|
| 3 |
+
width: 8px;
|
| 4 |
+
height: 8px;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
::-webkit-scrollbar-track {
|
| 8 |
+
background: #f1f1f1;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.dark ::-webkit-scrollbar-track {
|
| 12 |
+
background: #1f2937;
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
::-webkit-scrollbar-thumb {
|
| 16 |
+
background: #888;
|
| 17 |
+
border-radius: 4px;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.dark ::-webkit-scrollbar-thumb {
|
| 21 |
+
background: #555;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
::-webkit-scrollbar-thumb:hover {
|
| 25 |
+
background: #555;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.dark ::-webkit-scrollbar-thumb:hover {
|
| 29 |
+
background: #777;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
/* Smooth transitions */
|
| 33 |
body {
|
| 34 |
+
transition: background-color 0.3s ease;
|
|
|
|
| 35 |
}
|
| 36 |
|
| 37 |
+
/* Custom file upload styling */
|
| 38 |
+
input[type="file"] {
|
| 39 |
+
display: none;
|
| 40 |
}
|
| 41 |
|
| 42 |
+
/* Custom radio button styling */
|
| 43 |
+
input[type="radio"] {
|
| 44 |
+
-webkit-appearance: none;
|
| 45 |
+
-moz-appearance: none;
|
| 46 |
+
appearance: none;
|
| 47 |
+
width: 16px;
|
| 48 |
+
height: 16px;
|
| 49 |
+
border: 2px solid #d1d5db;
|
| 50 |
+
border-radius: 50%;
|
| 51 |
+
outline: none;
|
| 52 |
+
cursor: pointer;
|
| 53 |
+
transition: all 0.2s ease;
|
| 54 |
}
|
| 55 |
|
| 56 |
+
input[type="radio"]:checked {
|
| 57 |
+
border-color: #6366f1;
|
| 58 |
+
background-color: #6366f1;
|
| 59 |
+
background-image: radial-gradient(circle, white 35%, transparent 40%);
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
+
.dark input[type="radio"] {
|
| 63 |
+
border-color: #4b5563;
|
| 64 |
}
|
| 65 |
+
|
| 66 |
+
.dark input[type="radio"]:checked {
|
| 67 |
+
border-color: #6366f1;
|
| 68 |
+
}
|