Uvix commited on
Commit
94ad5eb
·
verified ·
1 Parent(s): e1f1e4e

אתה מסוגל למשוך פרוייקט גיט ?

Browse files
Files changed (6) hide show
  1. README.md +7 -4
  2. components/footer.js +29 -0
  3. components/navbar.js +32 -0
  4. index.html +57 -19
  5. script.js +157 -0
  6. style.css +30 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Git Project Visualizer Deluxe
3
- emoji: 🐠
4
  colorFrom: gray
5
- colorTo: gray
 
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: Git Project Visualizer Deluxe 🚀
 
3
  colorFrom: gray
4
+ colorTo: green
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,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .footer-link:hover {
7
+ color: #3b82f6;
8
+ }
9
+ </style>
10
+ <footer class="bg-white border-t border-gray-200 py-6">
11
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
12
+ <div class="md:flex md:justify-between">
13
+ <div class="mb-4 md:mb-0">
14
+ <p class="text-gray-500 text-sm">&copy; ${new Date().getFullYear()} Git Project Visualizer. All rights reserved.</p>
15
+ </div>
16
+ <div class="flex space-x-6">
17
+ <a href="https://docs.github.com/en/rest" target="_blank" class="footer-link text-gray-500 hover:text-blue-600 text-sm">GitHub API Docs</a>
18
+ <a href="https://github.com/public-apis/public-apis" target="_blank" class="footer-link text-gray-500 hover:text-blue-600 text-sm">Public APIs</a>
19
+ <a href="https://github.com/hash3liZer/git-project-visualizer" target="_blank" class="footer-link text-gray-500 hover:text-blue-600 text-sm flex items-center">
20
+ <i data-feather="github" class="mr-1"></i> Source
21
+ </a>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </footer>
26
+ `;
27
+ }
28
+ }
29
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .nav-link:hover {
7
+ color: #3b82f6;
8
+ }
9
+ </style>
10
+ <nav class="bg-white shadow-sm">
11
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
12
+ <div class="flex justify-between h-16">
13
+ <div class="flex">
14
+ <div class="flex-shrink-0 flex items-center">
15
+ <a href="index.html" class="font-bold text-xl text-gray-900 flex items-center">
16
+ <i data-feather="git-branch" class="mr-2"></i> GitViz
17
+ </a>
18
+ </div>
19
+ </div>
20
+ <div class="flex items-center space-x-4">
21
+ <a href="index.html" class="nav-link text-gray-700 hover:text-blue-600 px-3 py-2 rounded-md text-sm font-medium">Home</a>
22
+ <a href="https://github.com" target="_blank" class="nav-link text-gray-700 hover:text-blue-600 px-3 py-2 rounded-md text-sm font-medium flex items-center">
23
+ <i data-feather="github" class="mr-1"></i> GitHub
24
+ </a>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </nav>
29
+ `;
30
+ }
31
+ }
32
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,57 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Git Project Visualizer</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-100 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
+ <div class="max-w-3xl mx-auto bg-white rounded-xl shadow-md overflow-hidden p-6">
19
+ <h1 class="text-3xl font-bold text-gray-800 mb-6">Git Project Visualizer</h1>
20
+
21
+ <div class="mb-8">
22
+ <h2 class="text-xl font-semibold text-gray-700 mb-4">Enter GitHub Repository Details</h2>
23
+ <form id="repoForm" class="space-y-4">
24
+ <div>
25
+ <label for="username" class="block text-sm font-medium text-gray-700 mb-1">GitHub Username</label>
26
+ <input type="text" id="username" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required>
27
+ </div>
28
+ <div>
29
+ <label for="repo" class="block text-sm font-medium text-gray-700 mb-1">Repository Name</label>
30
+ <input type="text" id="repo" class="w-full px-4 py-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500" required>
31
+ </div>
32
+ <button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-6 rounded-md transition duration-200 flex items-center">
33
+ <i data-feather="github" class="mr-2"></i> Fetch Repository
34
+ </button>
35
+ </form>
36
+ </div>
37
+
38
+ <div id="loading" class="hidden text-center py-12">
39
+ <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mx-auto mb-4"></div>
40
+ <p class="text-gray-600">Fetching repository data...</p>
41
+ </div>
42
+
43
+ <div id="results" class="hidden">
44
+ <!-- Results will be displayed here -->
45
+ </div>
46
+ </div>
47
+ </main>
48
+
49
+ <custom-footer></custom-footer>
50
+
51
+ <script src="script.js"></script>
52
+ <script>
53
+ feather.replace();
54
+ </script>
55
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
56
+ </body>
57
+ </html>
script.js ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ const repoForm = document.getElementById('repoForm');
3
+ const loading = document.getElementById('loading');
4
+ const results = document.getElementById('results');
5
+
6
+ repoForm.addEventListener('submit', async (e) => {
7
+ e.preventDefault();
8
+
9
+ const username = document.getElementById('username').value.trim();
10
+ const repo = document.getElementById('repo').value.trim();
11
+
12
+ if (!username || !repo) {
13
+ alert('Please enter both GitHub username and repository name');
14
+ return;
15
+ }
16
+
17
+ // Show loading indicator
18
+ loading.classList.remove('hidden');
19
+ results.classList.add('hidden');
20
+
21
+ try {
22
+ const response = await fetch(`https://api.github.com/repos/${username}/${repo}`);
23
+ if (!response.ok) {
24
+ throw new Error('Repository not found or API rate limit exceeded');
25
+ }
26
+
27
+ const data = await response.json();
28
+ displayResults(data, username, repo);
29
+
30
+ // Fetch README.md content
31
+ const readmeResponse = await fetch(`https://api.github.com/repos/${username}/${repo}/readme`, {
32
+ headers: {
33
+ 'Accept': 'application/vnd.github.v3.raw'
34
+ }
35
+ });
36
+
37
+ if (readmeResponse.ok) {
38
+ const readmeContent = await readmeResponse.text();
39
+ displayReadme(readmeContent);
40
+ }
41
+
42
+ } catch (error) {
43
+ results.innerHTML = `
44
+ <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-6">
45
+ <div class="flex">
46
+ <div class="flex-shrink-0">
47
+ <i data-feather="alert-circle" class="text-red-500"></i>
48
+ </div>
49
+ <div class="ml-3">
50
+ <h3 class="text-sm font-medium text-red-800">Error fetching repository</h3>
51
+ <div class="mt-2 text-sm text-red-700">
52
+ <p>${error.message}</p>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ </div>
57
+ `;
58
+ feather.replace();
59
+ } finally {
60
+ loading.classList.add('hidden');
61
+ results.classList.remove('hidden');
62
+ }
63
+ });
64
+
65
+ function displayResults(data, username, repo) {
66
+ results.innerHTML = `
67
+ <div class="mb-8">
68
+ <div class="flex items-start">
69
+ <img src="${data.owner.avatar_url}" alt="Avatar" class="w-16 h-16 rounded-full mr-4">
70
+ <div>
71
+ <h2 class="text-2xl font-bold text-gray-800">${data.name}</h2>
72
+ <p class="text-gray-600 mb-2">${data.description || 'No description'}</p>
73
+ <div class="flex flex-wrap gap-4 text-sm">
74
+ <span class="flex items-center text-gray-600">
75
+ <i data-feather="star" class="w-4 h-4 mr-1"></i> ${data.stargazers_count}
76
+ </span>
77
+ <span class="flex items-center text-gray-600">
78
+ <i data-feather="eye" class="w-4 h-4 mr-1"></i> ${data.watchers_count}
79
+ </span>
80
+ <span class="flex items-center text-gray-600">
81
+ <i data-feather="git-branch" class="w-4 h-4 mr-1"></i> ${data.forks_count}
82
+ </span>
83
+ <span class="flex items-center text-gray-600">
84
+ <i data-feather="alert-circle" class="w-4 h-4 mr-1"></i> ${data.open_issues_count}
85
+ </span>
86
+ <a href="${data.html_url}" target="_blank" class="text-blue-600 hover:text-blue-800 flex items-center">
87
+ <i data-feather="external-link" class="w-4 h-4 mr-1"></i> View on GitHub
88
+ </a>
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </div>
93
+
94
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-8">
95
+ <div class="bg-gray-50 p-4 rounded-lg">
96
+ <h3 class="font-semibold text-gray-700 mb-2">Repository Details</h3>
97
+ <ul class="space-y-2">
98
+ <li class="flex"><span class="text-gray-600 w-32">Language</span> ${data.language || 'Not specified'}</li>
99
+ <li class="flex"><span class="text-gray-600 w-32">License</span> ${data.license?.name || 'Not specified'}</li>
100
+ <li class="flex"><span class="text-gray-600 w-32">Created</span> ${new Date(data.created_at).toLocaleDateString()}</li>
101
+ <li class="flex"><span class="text-gray-600 w-32">Last Updated</span> ${new Date(data.updated_at).toLocaleDateString()}</li>
102
+ <li class="flex"><span class="text-gray-600 w-32">Size</span> ${Math.round(data.size / 1024)} MB</li>
103
+ <li class="flex"><span class="text-gray-600 w-32">Default Branch</span> ${data.default_branch}</li>
104
+ </ul>
105
+ </div>
106
+
107
+ <div class="bg-gray-50 p-4 rounded-lg">
108
+ <h3 class="font-semibold text-gray-700 mb-2">Quick Links</h3>
109
+ <div class="space-y-2">
110
+ <a href="${data.html_url}/archive/refs/heads/${data.default_branch}.zip" class="flex items-center text-blue-600 hover:text-blue-800">
111
+ <i data-feather="download" class="w-4 h-4 mr-2"></i> Download as ZIP
112
+ </a>
113
+ <a href="${data.html_url}/blob/${data.default_branch}/README.md" target="_blank" class="flex items-center text-blue-600 hover:text-blue-800">
114
+ <i data-feather="file-text" class="w-4 h-4 mr-2"></i> View README
115
+ </a>
116
+ <a href="${data.html_url}/issues" target="_blank" class="flex items-center text-blue-600 hover:text-blue-800">
117
+ <i data-feather="alert-circle" class="w-4 h-4 mr-2"></i> View Issues
118
+ </a>
119
+ <a href="${data.html_url}/pulls" target="_blank" class="flex items-center text-blue-600 hover:text-blue-800">
120
+ <i data-feather="git-pull-request" class="w-4 h-4 mr-2"></i> View Pull Requests
121
+ </a>
122
+ </div>
123
+ </div>
124
+ </div>
125
+
126
+ <div id="readme-container" class="mb-8">
127
+ <h3 class="font-semibold text-gray-700 mb-4">README</h3>
128
+ <div class="bg-gray-50 p-4 rounded-lg">
129
+ <div id="readme-content" class="prose max-w-none">
130
+ Loading README...
131
+ </div>
132
+ </div>
133
+ </div>
134
+ `;
135
+ feather.replace();
136
+ }
137
+
138
+ function displayReadme(content) {
139
+ const readmeContainer = document.getElementById('readme-content');
140
+ if (content) {
141
+ // Simple markdown to HTML conversion for basic formatting
142
+ let htmlContent = content
143
+ .replace(/^#\s(.+)$/gm, '<h1>$1</h1>')
144
+ .replace(/^##\s(.+)$/gm, '<h2>$1</h2>')
145
+ .replace(/^###\s(.+)$/gm, '<h3>$1</h3>')
146
+ .replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
147
+ .replace(/\*(.+?)\*/g, '<em>$1</em>')
148
+ .replace(/`(.+?)`/g, '<code>$1</code>')
149
+ .replace(/!\[(.*?)\]\((.*?)\)/g, '<img src="$2" alt="$1">')
150
+ .replace(/\[(.*?)\]\((.*?)\)/g, '<a href="$2" target="_blank">$1</a>');
151
+
152
+ readmeContainer.innerHTML = htmlContent;
153
+ } else {
154
+ readmeContainer.innerHTML = '<p class="text-gray-500">No README found for this repository.</p>';
155
+ }
156
+ }
157
+ });
style.css CHANGED
@@ -1,28 +1,40 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
 
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
28
  }
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
5
+ }
6
+
7
+ #readme-content {
8
+ word-wrap: break-word;
9
  }
10
 
11
+ #readme-content img {
12
+ max-width: 100%;
13
+ height: auto;
14
+ margin: 1rem 0;
15
+ border-radius: 0.5rem;
16
  }
17
 
18
+ #readme-content pre {
19
+ background-color: #f5f5f5;
20
+ padding: 1rem;
21
+ border-radius: 0.5rem;
22
+ overflow-x: auto;
23
+ margin: 1rem 0;
24
  }
25
 
26
+ #readme-content code {
27
+ background-color: #f5f5f5;
28
+ padding: 0.2rem 0.4rem;
29
+ border-radius: 0.25rem;
30
+ font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
 
31
  }
32
 
33
+ #readme-content a {
34
+ color: #3b82f6;
35
+ text-decoration: underline;
36
  }
37
+
38
+ #readme-content a:hover {
39
+ color: #2563eb;
40
+ }