Skip to content

Commit 0cb7f51

Browse files
Merge pull request #122 from FATEMEH-Z-HASHEMI/refactor/log-iboard
⚡ 🎨 🔨 ✨ Improve upload page and style
2 parents fa38374 + e86dd14 commit 0cb7f51

File tree

3 files changed

+67
-65
lines changed

3 files changed

+67
-65
lines changed

django_logging/static/LogiBoard/css/app.css

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,10 @@ video {
588588
}
589589
}
590590

591+
.static {
592+
position: static;
593+
}
594+
591595
.absolute {
592596
position: absolute;
593597
}
@@ -628,10 +632,6 @@ video {
628632
margin-left: 0.5rem;
629633
}
630634

631-
.ml-auto {
632-
margin-left: auto;
633-
}
634-
635635
.mr-2 {
636636
margin-right: 0.5rem;
637637
}
@@ -664,10 +664,6 @@ video {
664664
margin-top: 1.25rem;
665665
}
666666

667-
.mr-10 {
668-
margin-right: 2.5rem;
669-
}
670-
671667
.box-border {
672668
box-sizing: border-box;
673669
}
@@ -732,22 +728,6 @@ video {
732728
height: 100vh;
733729
}
734730

735-
.h-3\/4 {
736-
height: 75%;
737-
}
738-
739-
.h-2 {
740-
height: 0.5rem;
741-
}
742-
743-
.h-1 {
744-
height: 0.25rem;
745-
}
746-
747-
.w-10\/12 {
748-
width: 83.333333%;
749-
}
750-
751731
.w-11\/12 {
752732
width: 91.666667%;
753733
}
@@ -792,10 +772,6 @@ video {
792772
width: 1px;
793773
}
794774

795-
.w-2 {
796-
width: 0.5rem;
797-
}
798-
799775
.max-w-full {
800776
max-width: 100%;
801777
}
@@ -809,10 +785,6 @@ video {
809785
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
810786
}
811787

812-
.cursor-default {
813-
cursor: default;
814-
}
815-
816788
.cursor-pointer {
817789
cursor: pointer;
818790
}
@@ -853,10 +825,6 @@ video {
853825
border-radius: 9999px;
854826
}
855827

856-
.rounded-lg {
857-
border-radius: 0.5rem;
858-
}
859-
860828
.rounded-md {
861829
border-radius: 0.375rem;
862830
}
@@ -878,6 +846,11 @@ video {
878846
border-color: rgb(44 51 59 / var(--tw-border-opacity));
879847
}
880848

849+
.bg-\[rgb\(1\2c 0\2c 4\)\] {
850+
--tw-bg-opacity: 1;
851+
background-color: rgb(1 0 4 / var(--tw-bg-opacity));
852+
}
853+
881854
.bg-back-0 {
882855
--tw-bg-opacity: 1;
883856
background-color: rgb(213 244 255 / var(--tw-bg-opacity));
@@ -905,26 +878,10 @@ video {
905878
padding: 1rem;
906879
}
907880

908-
.pb-2 {
909-
padding-bottom: 0.5rem;
910-
}
911-
912881
.pl-2 {
913882
padding-left: 0.5rem;
914883
}
915884

916-
.pl-8 {
917-
padding-left: 2rem;
918-
}
919-
920-
.pr-8 {
921-
padding-right: 2rem;
922-
}
923-
924-
.pt-2 {
925-
padding-top: 0.5rem;
926-
}
927-
928885
.text-center {
929886
text-align: center;
930887
}
@@ -968,11 +925,6 @@ video {
968925
color: rgb(44 51 59 / var(--tw-text-opacity));
969926
}
970927

971-
.text-neutral-50 {
972-
--tw-text-opacity: 1;
973-
color: rgb(250 250 250 / var(--tw-text-opacity));
974-
}
975-
976928
.text-rose-800 {
977929
--tw-text-opacity: 1;
978930
color: rgb(159 18 57 / var(--tw-text-opacity));

django_logging/static/LogiBoard/js/scripts.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const mainupload = document.getElementById("main-upload");
2+
const dropZone = document.getElementById('drop-zone');
23

34
let folderTree = {};
45
let interval;
@@ -26,6 +27,33 @@ document.getElementById('file-input').addEventListener('change', (event) => {
2627
document.getElementById('drag-drop-area').style.display = "block";
2728
document.getElementById('upload-area').style.display = "none";
2829

30+
['dragenter', 'dragover', 'dragleave', 'drop'].forEach(eventName => {
31+
dropZone.addEventListener(eventName, preventDefaults, false);
32+
});
33+
34+
function preventDefaults(e) {
35+
e.preventDefault();
36+
e.stopPropagation();
37+
}
38+
39+
['dragenter', 'dragover'].forEach(eventName => {
40+
dropZone.addEventListener(eventName, () => dropZone.classList.add('highlight'), false);
41+
});
42+
43+
['dragleave', 'drop'].forEach(eventName => {
44+
dropZone.addEventListener(eventName, () => dropZone.classList.remove('highlight'), false);
45+
});
46+
47+
dropZone.addEventListener('drop', (e) => {
48+
const file = e.dataTransfer.files[0];
49+
if (file && validFileTypes.includes(file.type)) {
50+
resetProgress();
51+
uploadFile(file);
52+
} else {
53+
alert("Only ZIP files are allowed!");
54+
}
55+
});
56+
2957
function uploadFile(file) {
3058
document.getElementById('drag-drop-area').style.display = "none";
3159
document.getElementById('upload-area').style.display = "flex";
@@ -102,6 +130,14 @@ function displayFolderContents(folder, container, zip, path) {
102130
fileElement.innerHTML = `<img src="${icons[isFile ? getIcon(item) : 'folder']}" class="inline-block w-5 h-5 mr-2" alt="">${item}`;
103131

104132
fileElement.addEventListener('click', async () => {
133+
134+
const previouslySelected = document.querySelector('.selected-file');
135+
if (previouslySelected) {
136+
previouslySelected.classList.remove('selected-file');
137+
}
138+
139+
fileElement.classList.add('selected-file');
140+
105141
if (isFile) {
106142
const fileData = await zip.file(itemPath).async('blob');
107143
renderFile(fileData, item);

django_logging/templates/log_iboard.html

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
transition: transform 0.4s ease;
4949
animation: uploadIcon 2.5s infinite;
5050
}
51+
.highlight {
52+
background-color: #edeaf7;
53+
}
5154
@keyframes blinkBorder {
5255
0% {
5356
border-color: #d8daf6;
@@ -110,7 +113,10 @@
110113
grid-template-columns: 5fr 0.2fr 3fr;
111114
}
112115
#send-another:hover{
113-
color:rgb(141, 18, 18)
116+
color:rgb(141, 18, 18);
117+
}
118+
#open:hover{
119+
background-color: rgb(141, 18, 18);
114120
}
115121
#back-link{
116122
height: 85vh;
@@ -125,6 +131,16 @@
125131
#file-structure{
126132
overflow-y: auto;
127133
}
134+
.selected-file {
135+
background-color: #2c2f33;
136+
color: #ffffff;
137+
border-radius: 5px;
138+
padding-left: 5px;
139+
display: flex;
140+
align-items: center;
141+
flex-direction: row;
142+
box-shadow: rgba(50, 50, 93, 0.296) 0 50px 100px -20px, rgba(0, 0, 0, 0.29) 0 30px 60px -30px, rgba(10, 37, 64, 0.257) 0 -2px 6px 0 inset;
143+
}
128144
</style>
129145

130146
</head>
@@ -179,10 +195,10 @@ <h3 id="send-another" class="mt-4 cursor-pointer" style="transition: 0.3s ease;
179195

180196
<div class="flex flex-col items-center justify-evenly">
181197

182-
<button id="open" class="flex flex-row items-center justify-center bg-gray-0 rounded-xl shadow-2xl cursor-pointer" style="transition: 0.4s ease; padding: 5px 20px ">
183-
<img src="{%static 'LogiBoard/imgs/open-50.png' %}" alt="open-icon" class="w-4 h-4">
184-
Open Link
185-
</button>
198+
<button id="open" class="flex flex-row items-center justify-center bg-[rgb(1,0,4)] rounded-xl shadow-2xl cursor-pointer"style="transition: 0.4s ease; padding: 5px 20px ;">
199+
<img src="{%static 'LogiBoard/imgs/open-50.png' %}" alt="open-icon" class="w-4 h-4">
200+
<p class="text-sm text-white ml-2">Open Link</p>
201+
</button>
186202

187203
</div>
188204

@@ -199,9 +215,7 @@ <h3 id="send-another" class="mt-4 cursor-pointer" style="transition: 0.3s ease;
199215
<div id="file-display" class="p-4 bg-black" style="overflow-y: auto; height: 100%; font-size: 12px;"></div>
200216
</span>
201217
</div>
202-
203-
204-
<!-- All image paths that used in scripts -->
218+
<!-- All image paths that used in scripts -->
205219
<div id="image-paths"
206220
data-stop-icon="{% static 'LOGiBoard/imgs/stop-50.png' %}"
207221
data-pause-icon="{% static 'LOGiBoard/imgs/pause-50.png' %}"

0 commit comments

Comments
 (0)