Clone a fully working replicate of site: https://trystructa.com/
Browse files- README.md +8 -5
- components/footer.js +75 -0
- components/navbar.js +67 -0
- index.html +141 -19
- script.js +64 -0
- style.css +31 -18
README.md
CHANGED
|
@@ -1,10 +1,13 @@
|
|
| 1 |
---
|
| 2 |
-
title: Structa Clone Data Structure Visualizer
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Structa Clone - Data Structure Visualizer 🧱
|
| 3 |
+
colorFrom: purple
|
| 4 |
+
colorTo: purple
|
| 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,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class CustomFooter extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
.footer {
|
| 7 |
+
background-color: #f8fafc;
|
| 8 |
+
border-top: 1px solid #e2e8f0;
|
| 9 |
+
}
|
| 10 |
+
.footer-link {
|
| 11 |
+
transition: color 0.2s ease;
|
| 12 |
+
}
|
| 13 |
+
.footer-link:hover {
|
| 14 |
+
color: #3b82f6;
|
| 15 |
+
}
|
| 16 |
+
.social-icon {
|
| 17 |
+
transition: all 0.2s ease;
|
| 18 |
+
}
|
| 19 |
+
.social-icon:hover {
|
| 20 |
+
color: #3b82f6;
|
| 21 |
+
transform: translateY(-2px);
|
| 22 |
+
}
|
| 23 |
+
</style>
|
| 24 |
+
<footer class="footer py-8">
|
| 25 |
+
<div class="container mx-auto px-4">
|
| 26 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 27 |
+
<div>
|
| 28 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-4">Structa Clone</h3>
|
| 29 |
+
<p class="text-gray-600 mb-4">
|
| 30 |
+
An interactive tool to visualize and understand data structures and algorithms
|
| 31 |
+
</p>
|
| 32 |
+
<div class="flex space-x-4">
|
| 33 |
+
<a href="#" class="social-icon text-gray-500">
|
| 34 |
+
<i data-feather="github"></i>
|
| 35 |
+
</a>
|
| 36 |
+
<a href="#" class="social-icon text-gray-500">
|
| 37 |
+
<i data-feather="twitter"></i>
|
| 38 |
+
</a>
|
| 39 |
+
<a href="#" class="social-icon text-gray-500">
|
| 40 |
+
<i data-feather="linkedin"></i>
|
| 41 |
+
</a>
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
<div>
|
| 46 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-4">Structures</h3>
|
| 47 |
+
<ul class="space-y-2">
|
| 48 |
+
<li><a href="array.html" class="footer-link text-gray-600">Array</a></li>
|
| 49 |
+
<li><a href="linked-list.html" class="footer-link text-gray-600">Linked List</a></li>
|
| 50 |
+
<li><a href="stack.html" class="footer-link text-gray-600">Stack</a></li>
|
| 51 |
+
<li><a href="queue.html" class="footer-link text-gray-600">Queue</a></li>
|
| 52 |
+
<li><a href="tree.html" class="footer-link text-gray-600">Tree</a></li>
|
| 53 |
+
<li><a href="graph.html" class="footer-link text-gray-600">Graph</a></li>
|
| 54 |
+
</ul>
|
| 55 |
+
</div>
|
| 56 |
+
|
| 57 |
+
<div>
|
| 58 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-4">Resources</h3>
|
| 59 |
+
<ul class="space-y-2">
|
| 60 |
+
<li><a href="#" class="footer-link text-gray-600">Documentation</a></li>
|
| 61 |
+
<li><a href="#" class="footer-link text-gray-600">Tutorials</a></li>
|
| 62 |
+
<li><a href="#" class="footer-link text-gray-600">Examples</a></li>
|
| 63 |
+
<li><a href="#" class="footer-link text-gray-600">Blog</a></li>
|
| 64 |
+
</ul>
|
| 65 |
+
</div>
|
| 66 |
+
|
| 67 |
+
<div>
|
| 68 |
+
<h3 class="text-lg font-semibold text-gray-800 mb-4">Company</h3>
|
| 69 |
+
<ul class="space-y-2">
|
| 70 |
+
<li><a href="#" class="footer-link text-gray-600">About</a></li>
|
| 71 |
+
<li><a href="#" class="footer-link text-gray-600">Contact</a></li>
|
| 72 |
+
<li><a href="#" class="footer-link text-gray-600">Privacy Policy</a></li>
|
| 73 |
+
<li><a href="#" class="footer-link text-gray-600">Terms of Service</a></li>
|
| 74 |
+
</ul>
|
| 75 |
+
</
|
components/navbar.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 2px 4px rgba(0, 0, 0, 0.05);
|
| 9 |
+
}
|
| 10 |
+
.nav-link {
|
| 11 |
+
transition: color 0.2s ease;
|
| 12 |
+
}
|
| 13 |
+
.nav-link:hover {
|
| 14 |
+
color: #3b82f6;
|
| 15 |
+
}
|
| 16 |
+
.logo {
|
| 17 |
+
font-weight: 700;
|
| 18 |
+
letter-spacing: -0.025em;
|
| 19 |
+
}
|
| 20 |
+
</style>
|
| 21 |
+
<nav class="navbar px-4 py-4 md:px-6">
|
| 22 |
+
<div class="container mx-auto flex justify-between items-center">
|
| 23 |
+
<a href="index.html" class="logo text-xl text-gray-800 flex items-center">
|
| 24 |
+
<i data-feather="box" class="mr-2 text-blue-500"></i>
|
| 25 |
+
Structa Clone
|
| 26 |
+
</a>
|
| 27 |
+
|
| 28 |
+
<div class="hidden md:flex space-x-8">
|
| 29 |
+
<a href="index.html" class="nav-link text-gray-600 hover:text-blue-500">Home</a>
|
| 30 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">About</a>
|
| 31 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Documentation</a>
|
| 32 |
+
<a href="#" class="nav-link text-gray-600 hover:text-blue-500">Contact</a>
|
| 33 |
+
</div>
|
| 34 |
+
|
| 35 |
+
<button id="mobile-menu-button" class="md:hidden text-gray-600">
|
| 36 |
+
<i data-feather="menu"></i>
|
| 37 |
+
</button>
|
| 38 |
+
</div>
|
| 39 |
+
|
| 40 |
+
<!-- Mobile menu -->
|
| 41 |
+
<div id="mobile-menu" class="hidden md:hidden px-4 py-2">
|
| 42 |
+
<a href="index.html" class="block py-2 text-gray-600 hover:text-blue-500">Home</a>
|
| 43 |
+
<a href="#" class="block py-2 text-gray-600 hover:text-blue-500">About</a>
|
| 44 |
+
<a href="#" class="block py-2 text-gray-600 hover:text-blue-500">Documentation</a>
|
| 45 |
+
<a href="#" class="block py-2 text-gray-600 hover:text-blue-500">Contact</a>
|
| 46 |
+
</div>
|
| 47 |
+
</nav>
|
| 48 |
+
`;
|
| 49 |
+
|
| 50 |
+
// Add mobile menu toggle functionality
|
| 51 |
+
const menuButton = this.shadowRoot.getElementById('mobile-menu-button');
|
| 52 |
+
const mobileMenu = this.shadowRoot.getElementById('mobile-menu');
|
| 53 |
+
|
| 54 |
+
menuButton.addEventListener('click', () => {
|
| 55 |
+
mobileMenu.classList.toggle('hidden');
|
| 56 |
+
const icon = menuButton.querySelector('i');
|
| 57 |
+
if (mobileMenu.classList.contains('hidden')) {
|
| 58 |
+
icon.setAttribute('data-feather', 'menu');
|
| 59 |
+
} else {
|
| 60 |
+
icon.setAttribute('data-feather', 'x');
|
| 61 |
+
}
|
| 62 |
+
feather.replace();
|
| 63 |
+
});
|
| 64 |
+
}
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
customElements.define('custom-navbar', CustomNavbar);
|
index.html
CHANGED
|
@@ -1,19 +1,141 @@
|
|
| 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">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Structa Clone - Visualize Data Structures</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 src="components/navbar.js"></script>
|
| 12 |
+
<script src="components/footer.js"></script>
|
| 13 |
+
</head>
|
| 14 |
+
<body class="bg-gray-50 min-h-screen flex flex-col">
|
| 15 |
+
<custom-navbar></custom-navbar>
|
| 16 |
+
|
| 17 |
+
<main class="flex-grow container mx-auto px-4 py-8">
|
| 18 |
+
<section class="text-center mb-12">
|
| 19 |
+
<h1 class="text-4xl md:text-5xl font-bold text-gray-800 mb-4">Visualize Data Structures</h1>
|
| 20 |
+
<p class="text-xl text-gray-600 max-w-3xl mx-auto">
|
| 21 |
+
An interactive tool to visualize and understand data structures and algorithms
|
| 22 |
+
</p>
|
| 23 |
+
</section>
|
| 24 |
+
|
| 25 |
+
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-12">
|
| 26 |
+
<!-- Array Card -->
|
| 27 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 28 |
+
<div class="bg-blue-500 p-4">
|
| 29 |
+
<h2 class="text-white text-xl font-semibold">Array</h2>
|
| 30 |
+
</div>
|
| 31 |
+
<div class="p-4">
|
| 32 |
+
<p class="text-gray-600 mb-4">A collection of elements identified by index or key</p>
|
| 33 |
+
<a href="array.html" class="inline-flex items-center text-blue-500 hover:text-blue-700">
|
| 34 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 35 |
+
</a>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
|
| 39 |
+
<!-- Linked List Card -->
|
| 40 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 41 |
+
<div class="bg-green-500 p-4">
|
| 42 |
+
<h2 class="text-white text-xl font-semibold">Linked List</h2>
|
| 43 |
+
</div>
|
| 44 |
+
<div class="p-4">
|
| 45 |
+
<p class="text-gray-600 mb-4">A linear collection of data elements whose order is not given by their physical placement</p>
|
| 46 |
+
<a href="linked-list.html" class="inline-flex items-center text-green-500 hover:text-green-700">
|
| 47 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 48 |
+
</a>
|
| 49 |
+
</div>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
<!-- Stack Card -->
|
| 53 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 54 |
+
<div class="bg-purple-500 p-4">
|
| 55 |
+
<h2 class="text-white text-xl font-semibold">Stack</h2>
|
| 56 |
+
</div>
|
| 57 |
+
<div class="p-4">
|
| 58 |
+
<p class="text-gray-600 mb-4">A collection of elements with LIFO (Last In First Out) principle</p>
|
| 59 |
+
<a href="stack.html" class="inline-flex items-center text-purple-500 hover:text-purple-700">
|
| 60 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 61 |
+
</a>
|
| 62 |
+
</div>
|
| 63 |
+
</div>
|
| 64 |
+
|
| 65 |
+
<!-- Queue Card -->
|
| 66 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 67 |
+
<div class="bg-yellow-500 p-4">
|
| 68 |
+
<h2 class="text-white text-xl font-semibold">Queue</h2>
|
| 69 |
+
</div>
|
| 70 |
+
<div class="p-4">
|
| 71 |
+
<p class="text-gray-600 mb-4">A collection of elements with FIFO (First In First Out) principle</p>
|
| 72 |
+
<a href="queue.html" class="inline-flex items-center text-yellow-500 hover:text-yellow-700">
|
| 73 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 74 |
+
</a>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<!-- Tree Card -->
|
| 79 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 80 |
+
<div class="bg-red-500 p-4">
|
| 81 |
+
<h2 class="text-white text-xl font-semibold">Tree</h2>
|
| 82 |
+
</div>
|
| 83 |
+
<div class="p-4">
|
| 84 |
+
<p class="text-gray-600 mb-4">A hierarchical data structure with a root value and subtrees of children</p>
|
| 85 |
+
<a href="tree.html" class="inline-flex items-center text-red-500 hover:text-red-700">
|
| 86 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 87 |
+
</a>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<!-- Graph Card -->
|
| 92 |
+
<div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow">
|
| 93 |
+
<div class="bg-indigo-500 p-4">
|
| 94 |
+
<h2 class="text-white text-xl font-semibold">Graph</h2>
|
| 95 |
+
</div>
|
| 96 |
+
<div class="p-4">
|
| 97 |
+
<p class="text-gray-600 mb-4">A non-linear data structure consisting of nodes and edges</p>
|
| 98 |
+
<a href="graph.html" class="inline-flex items-center text-indigo-500 hover:text-indigo-700">
|
| 99 |
+
Visualize <i data-feather="arrow-right" class="ml-2 w-4 h-4"></i>
|
| 100 |
+
</a>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
</div>
|
| 104 |
+
|
| 105 |
+
<section class="bg-white rounded-lg shadow-md p-6 mb-12">
|
| 106 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4">How it works</h2>
|
| 107 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 108 |
+
<div class="text-center">
|
| 109 |
+
<div class="bg-blue-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
|
| 110 |
+
<i data-feather="edit" class="text-blue-500 w-8 h-8"></i>
|
| 111 |
+
</div>
|
| 112 |
+
<h3 class="text-lg font-medium text-gray-800 mb-2">1. Choose a Structure</h3>
|
| 113 |
+
<p class="text-gray-600">Select from various data structures to visualize</p>
|
| 114 |
+
</div>
|
| 115 |
+
<div class="text-center">
|
| 116 |
+
<div class="bg-green-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
|
| 117 |
+
<i data-feather="sliders" class="text-green-500 w-8 h-8"></i>
|
| 118 |
+
</div>
|
| 119 |
+
<h3 class="text-lg font-medium text-gray-800 mb-2">2. Configure Options</h3>
|
| 120 |
+
<p class="text-gray-600">Customize the visualization parameters</p>
|
| 121 |
+
</div>
|
| 122 |
+
<div class="text-center">
|
| 123 |
+
<div class="bg-purple-100 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4">
|
| 124 |
+
<i data-feather="play" class="text-purple-500 w-8 h-8"></i>
|
| 125 |
+
</div>
|
| 126 |
+
<h3 class="text-lg font-medium text-gray-800 mb-2">3. Visualize & Learn</h3>
|
| 127 |
+
<p class="text-gray-600">Watch the structure come to life with animations</p>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
</section>
|
| 131 |
+
</main>
|
| 132 |
+
|
| 133 |
+
<custom-footer></custom-footer>
|
| 134 |
+
|
| 135 |
+
<script>
|
| 136 |
+
feather.replace();
|
| 137 |
+
</script>
|
| 138 |
+
<script src="script.js"></script>
|
| 139 |
+
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 140 |
+
</body>
|
| 141 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Main application script
|
| 2 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 3 |
+
console.log('Structa Clone loaded');
|
| 4 |
+
|
| 5 |
+
// Initialize tooltips
|
| 6 |
+
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
| 7 |
+
tooltipTriggerList.map(function (tooltipTriggerEl) {
|
| 8 |
+
return new bootstrap.Tooltip(tooltipTriggerEl);
|
| 9 |
+
});
|
| 10 |
+
|
| 11 |
+
// Smooth scrolling for anchor links
|
| 12 |
+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
|
| 13 |
+
anchor.addEventListener('click', function (e) {
|
| 14 |
+
e.preventDefault();
|
| 15 |
+
document.querySelector(this.getAttribute('href')).scrollIntoView({
|
| 16 |
+
behavior: 'smooth'
|
| 17 |
+
});
|
| 18 |
+
});
|
| 19 |
+
});
|
| 20 |
+
});
|
| 21 |
+
|
| 22 |
+
// Data structure visualization functions
|
| 23 |
+
class StructaVisualizer {
|
| 24 |
+
constructor(canvasId) {
|
| 25 |
+
this.canvas = document.getElementById(canvasId);
|
| 26 |
+
this.ctx = this.canvas.getContext('2d');
|
| 27 |
+
this.structures = {};
|
| 28 |
+
this.currentStructure = null;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
addStructure(name, config) {
|
| 32 |
+
this.structures[name] = config;
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
visualize(name, data) {
|
| 36 |
+
if (!this.structures[name]) {
|
| 37 |
+
console.error(`Structure ${name} not found`);
|
| 38 |
+
return;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
this.currentStructure = name;
|
| 42 |
+
this.clearCanvas();
|
| 43 |
+
this.structures[name].draw(this.ctx, data);
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
clearCanvas() {
|
| 47 |
+
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
resizeCanvas() {
|
| 51 |
+
const container = this.canvas.parentElement;
|
| 52 |
+
this.canvas.width = container.clientWidth;
|
| 53 |
+
this.canvas.height = container.clientHeight;
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
// Initialize visualizer when needed
|
| 58 |
+
function initVisualizer() {
|
| 59 |
+
if (document.getElementById('visualization-canvas')) {
|
| 60 |
+
const visualizer = new StructaVisualizer('visualization-canvas');
|
| 61 |
+
return visualizer;
|
| 62 |
+
}
|
| 63 |
+
return null;
|
| 64 |
+
}
|
style.css
CHANGED
|
@@ -1,28 +1,41 @@
|
|
|
|
|
| 1 |
body {
|
| 2 |
-
|
| 3 |
-
|
| 4 |
}
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
}
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
}
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* Base styles */
|
| 2 |
body {
|
| 3 |
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
| 4 |
+
line-height: 1.6;
|
| 5 |
}
|
| 6 |
|
| 7 |
+
/* Custom animations */
|
| 8 |
+
@keyframes fadeIn {
|
| 9 |
+
from { opacity: 0; }
|
| 10 |
+
to { opacity: 1; }
|
| 11 |
}
|
| 12 |
|
| 13 |
+
.fade-in {
|
| 14 |
+
animation: fadeIn 0.5s ease-in-out;
|
|
|
|
|
|
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
+
/* Structure visualization canvas */
|
| 18 |
+
.visualization-canvas {
|
| 19 |
+
width: 100%;
|
| 20 |
+
height: 400px;
|
| 21 |
+
background-color: #f8fafc;
|
| 22 |
+
border-radius: 0.5rem;
|
| 23 |
+
border: 1px solid #e2e8f0;
|
| 24 |
+
margin: 1rem 0;
|
| 25 |
}
|
| 26 |
|
| 27 |
+
/* Control panel */
|
| 28 |
+
.control-panel {
|
| 29 |
+
background-color: white;
|
| 30 |
+
border-radius: 0.5rem;
|
| 31 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
| 32 |
+
padding: 1.5rem;
|
| 33 |
+
margin-bottom: 1.5rem;
|
| 34 |
}
|
| 35 |
+
|
| 36 |
+
/* Responsive adjustments */
|
| 37 |
+
@media (max-width: 768px) {
|
| 38 |
+
.visualization-canvas {
|
| 39 |
+
height: 300px;
|
| 40 |
+
}
|
| 41 |
+
}
|