ikram commited on
Commit
3d74941
·
1 Parent(s): 2656fa6

add resources

Browse files
Files changed (3) hide show
  1. static/app.css +37 -16
  2. static/application.js +62 -0
  3. templates/home.html +8 -1
static/app.css CHANGED
@@ -34,31 +34,52 @@ em{
34
  .convo{
35
  height: 75%;
36
  width: 100%;
37
-
 
 
38
  }
 
 
39
  .qt{
40
- height: 10%;
41
- width: 100%;
 
 
42
  display: flex;
43
- justify-content: center;
44
  align-items: center;
45
- background-color: white;
46
- gap: 2%;
47
  }
48
 
49
- .qt{
50
- width: 100%;
51
- height: 100%;
 
 
 
 
 
 
 
 
 
52
  border: none;
53
- background-color: rgb(103, 103, 246);
 
 
 
 
54
  display: flex;
55
-
 
56
  }
57
 
58
- .qt i{
 
 
 
 
59
  cursor: pointer;
60
- }
61
-
62
- .qtdoc{
63
-
64
  }
 
34
  .convo{
35
  height: 75%;
36
  width: 100%;
37
+ overflow-y: auto;
38
+ padding: 10px;
39
+ box-sizing: border-box;
40
  }
41
+
42
+
43
  .qt{
44
+ width: 70%;
45
+ height: 50%;
46
+ border: none;
47
+ background-color: #8d8b8b;
48
  display: flex;
49
+ justify-content: space-between;
50
  align-items: center;
51
+ border-radius: 10px;
52
+ margin: 10px;
53
  }
54
 
55
+ .qt input{
56
+ width: 70%;
57
+ height: 70%;
58
+ border: none;
59
+ background-color: #8d8b8b;
60
+ color:white;
61
+ margin : 10px
62
+ }
63
+ .qt input::placeholder{
64
+ color: white;
65
+ }
66
+ .qt input:focus{
67
  border: none;
68
+ outline: none;
69
+ }
70
+ .qtdoc{
71
+ width: 100%;
72
+ height: 10%;
73
  display: flex;
74
+ justify-content: center;
75
+ align-items: center;
76
  }
77
 
78
+ .icons{
79
+ width: 18%;
80
+ display: flex;
81
+ gap: 2%;
82
+ font-size: large;
83
  cursor: pointer;
84
+ justify-content: space-around;
 
 
 
85
  }
static/application.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const inputField = document.querySelector(".qt input");
2
+ const icons = document.querySelectorAll(".icons i");
3
+ const convo = document.querySelector(".convo");
4
+
5
+ // Create hidden file inputs dynamically
6
+ const imageInput = document.createElement("input");
7
+ imageInput.type = "file";
8
+ imageInput.accept = "image/*";
9
+ imageInput.style.display = "none";
10
+
11
+ const docInput = document.createElement("input");
12
+ docInput.type = "file";
13
+ docInput.accept = ".pdf,.docx,.pptx,.xlsx";
14
+ docInput.style.display = "none";
15
+
16
+ document.body.appendChild(imageInput);
17
+ document.body.appendChild(docInput);
18
+
19
+ let selectedFile = null;
20
+ let selectedType = null;
21
+
22
+ // Icon click handlers
23
+ icons[0].addEventListener("click", () => imageInput.click()); // image icon
24
+ icons[1].addEventListener("click", () => docInput.click()); // file icon
25
+ icons[2].addEventListener("click", handleSubmit); // send icon
26
+
27
+ imageInput.addEventListener("change", () => {
28
+ selectedFile = imageInput.files[0];
29
+ selectedType = "Image";
30
+ showSelectedFile(selectedFile.name, "🖼️");
31
+ });
32
+
33
+ docInput.addEventListener("change", () => {
34
+ selectedFile = docInput.files[0];
35
+ selectedType = "Document";
36
+ showSelectedFile(selectedFile.name, "📄");
37
+ });
38
+
39
+ function handleSubmit() {
40
+ const question = inputField.value.trim();
41
+ if (!question && !selectedFile) {
42
+ alert("Please type a question or select a file.");
43
+ return;
44
+ }
45
+
46
+ convo.innerHTML = `
47
+ <div style="padding: 1rem; border-radius: 10px; background-color: #f1f1f1; margin: 1rem;">
48
+ <strong>Question:</strong> ${question || "(No question)"}<br>
49
+ ${selectedFile ? `<strong>${selectedType}:</strong> ${selectedFile.name}` : ""}
50
+ <br><em>(Simulated - No backend yet)</em>
51
+ </div>
52
+ `;
53
+ }
54
+
55
+ function showSelectedFile(fileName, icon) {
56
+ convo.innerHTML = `
57
+ <div style="padding: 0.8rem; background-color: #f3f3f3; border-radius: 10px; margin: 1rem;">
58
+ ${icon} <strong>Selected file:</strong> ${fileName}
59
+ </div>
60
+ `;
61
+ }
62
+ inputField.value=""
templates/home.html CHANGED
@@ -17,10 +17,17 @@
17
  </div>
18
  <div class="qtdoc">
19
  <div class="qt">
20
- <input type="text" placeholder=" Ask me anything about any document :D ">
 
 
21
  <i class="fa-solid fa-file"></i>
22
  <i class="fa-solid fa-share-from-square"></i>
 
 
23
  </div>
24
  </div>
 
 
 
25
  </body>
26
  </html>
 
17
  </div>
18
  <div class="qtdoc">
19
  <div class="qt">
20
+ <input type="text" placeholder="Ask me anything about any document :D ">
21
+ <div class="icons">
22
+ <i class="fa-solid fa-image"></i>
23
  <i class="fa-solid fa-file"></i>
24
  <i class="fa-solid fa-share-from-square"></i>
25
+
26
+ </div>
27
  </div>
28
  </div>
29
+ <script src="/static/application.js"> </script>
30
+
31
+
32
  </body>
33
  </html>