GuaccO commited on
Commit
e0b6e4d
·
verified ·
1 Parent(s): 04475cf

Please allow to Send attachment files like: javascript, typescript, SQL etc.

Browse files
auth/github/callback.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>GitHub Auth Callback</title>
 
7
  <script>
8
  // Process the GitHub callback
9
  const urlParams = new URLSearchParams(window.location.search);
@@ -25,6 +26,15 @@
25
  <div class="text-center">
26
  <h1 class="text-2xl font-bold mb-4">Processing GitHub Authentication...</h1>
27
  <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary mx-auto"></div>
 
 
 
 
 
 
 
 
 
28
  </div>
29
  </div>
30
  </body>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>GitHub Auth Callback</title>
7
+ <script src="../components/file-uploader.js"></script>
8
  <script>
9
  // Process the GitHub callback
10
  const urlParams = new URLSearchParams(window.location.search);
 
26
  <div class="text-center">
27
  <h1 class="text-2xl font-bold mb-4">Processing GitHub Authentication...</h1>
28
  <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary mx-auto"></div>
29
+
30
+ <!-- File Upload Section -->
31
+ <div class="mt-8 p-6 max-w-md mx-auto bg-white rounded-lg shadow-md">
32
+ <h2 class="text-xl font-semibold mb-4">Upload Files</h2>
33
+ <file-uploader></file-uploader>
34
+ <button id="upload-submit" class="mt-4 px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
35
+ Upload Files
36
+ </button>
37
+ </div>
38
  </div>
39
  </div>
40
  </body>
components/file-uploader.js ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class FileUploader extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ .upload-container {
7
+ margin: 1rem 0;
8
+ border: 2px dashed #ccc;
9
+ border-radius: 0.5rem;
10
+ padding: 1.5rem;
11
+ text-align: center;
12
+ transition: all 0.3s;
13
+ }
14
+ .upload-container:hover {
15
+ border-color: #667eea;
16
+ background: #f7fafc;
17
+ }
18
+ .file-input {
19
+ display: none;
20
+ }
21
+ .upload-btn {
22
+ background: #667eea;
23
+ color: white;
24
+ padding: 0.5rem 1rem;
25
+ border-radius: 0.25rem;
26
+ cursor: pointer;
27
+ display: inline-block;
28
+ margin-bottom: 1rem;
29
+ }
30
+ .file-list {
31
+ text-align: left;
32
+ margin-top: 1rem;
33
+ }
34
+ .file-item {
35
+ display: flex;
36
+ align-items: center;
37
+ padding: 0.5rem;
38
+ border-bottom: 1px solid #eee;
39
+ }
40
+ .file-name {
41
+ flex-grow: 1;
42
+ margin-left: 0.5rem;
43
+ }
44
+ .remove-btn {
45
+ color: #f56565;
46
+ cursor: pointer;
47
+ margin-left: 0.5rem;
48
+ }
49
+ </style>
50
+ <div class="upload-container">
51
+ <input type="file" class="file-input" multiple accept=".js,.ts,.sql,.json,.txt,.md,.html,.css">
52
+ <button class="upload-btn">Choose Files</button>
53
+ <div class="file-list"></div>
54
+ <p>Supported files: JavaScript, TypeScript, SQL, JSON, etc.</p>
55
+ </div>
56
+ `;
57
+
58
+ const input = this.shadowRoot.querySelector('.file-input');
59
+ const button = this.shadowRoot.querySelector('.upload-btn');
60
+ const fileList = this.shadowRoot.querySelector('.file-list');
61
+ const files = [];
62
+
63
+ button.addEventListener('click', () => input.click());
64
+
65
+ input.addEventListener('change', (e) => {
66
+ files.length = 0; // Clear previous files
67
+ fileList.innerHTML = '';
68
+
69
+ Array.from(e.target.files).forEach(file => {
70
+ files.push(file);
71
+
72
+ const fileItem = document.createElement('div');
73
+ fileItem.className = 'file-item';
74
+ fileItem.innerHTML = `
75
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
76
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
77
+ </svg>
78
+ <span class="file-name">${file.name} (${(file.size / 1024).toFixed(2)} KB)</span>
79
+ <span class="remove-btn">×</span>
80
+ `;
81
+
82
+ fileItem.querySelector('.remove-btn').addEventListener('click', () => {
83
+ const index = files.indexOf(file);
84
+ if (index > -1) {
85
+ files.splice(index, 1);
86
+ }
87
+ fileItem.remove();
88
+ });
89
+
90
+ fileList.appendChild(fileItem);
91
+ });
92
+ });
93
+
94
+ // Expose files to parent component
95
+ this.getFiles = () => files;
96
+ }
97
+ }
98
+
99
+ customElements.define('file-uploader', FileUploader);