Skip to content

Commit

Permalink
Update ui and search speed
Browse files Browse the repository at this point in the history
  • Loading branch information
hantang committed Mar 12, 2024
1 parent 9e5704c commit 5e2a19d
Show file tree
Hide file tree
Showing 4 changed files with 170 additions and 141 deletions.
174 changes: 96 additions & 78 deletions site/assets/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,78 @@
body {
font-family: Arial, sans-serif;
font-family: sans-serif;
margin: 0;
padding: 0;
}

#main {
margin: 0 auto;
header {
background-color: #4051b5;
color: #fff;
padding: 30px;
}

header div {
display: inline;

}

header svg {
height: 32px;
}

header h1 {
display: inline;
}

main {
margin: 10px auto;
max-width: 90%;
}

#uploadArea {
footer {
background-color: #333;
color: #fff;
padding: 5px;
text-align: center;
}

/* buttons */
.upload-btn,
.clear-btn,
.search-btn,
.expand-btn,
.search-btn,
.reset-btn {
padding: 12px 24px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
text-transform: uppercase;
transition: background-color 0.3s;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.upload-btn {
background-color: #1dca88;
color: white;
}

.search-btn {
background-color: #007bff;
color: white;
}

.reset-btn {
background-color: #f44336;
color: white;
}

#note-area {
margin: auto 15%;
}

#upload-area {
border: 2px solid #1dca88;
margin: auto;
width: 80%;
Expand All @@ -18,20 +81,20 @@ body {
text-align: center;
}

#uploadArea button {
#upload-area button {
display: inline-block;
}

#dropArea {
width: 300px;
#drop-area {
max-width: 300px;
height: 200px;
border: 2px dashed #ddd;
text-align: center;
line-height: 200px;
margin: 0 auto;
}

#searchArea {
#search-area {
border: 2px solid #007bff;
padding: 20px;
margin: auto;
Expand All @@ -41,42 +104,6 @@ body {
text-align: center;
}


/* table */
#fileContent {
margin: 30px auto 30px auto;
width: 90%;
}

table,
th,
td {
border-collapse: collapse;
border: 1px solid #ddd;
padding: 8px;

}

th {
cursor: pointer;
position: relative;
background-color: #f2f2f2;
font-weight: bold;
text-align: center;
}

th.asc::after {
content: " ⬆️";
position: absolute;
right: 5px;
}

th.desc::after {
content: " ⬇️";
position: absolute;
right: 5px;
}

.filter-condition {
margin-bottom: 10px;
}
Expand All @@ -95,46 +122,37 @@ th.desc::after {
width: 250px;
}

/* buttons */
.upload-btn,
.clear-btn,
.search-btn,
.expand-btn,
.search-btn,
.reset-btn {
padding: 12px 24px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-weight: 500;
text-transform: uppercase;
transition: background-color 0.3s;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
#file-area {
margin: 50px auto;
max-width: 90%;
}

.upload-btn {
background-color: #1dca88;
color: white;
table, th, td {
border-collapse: collapse;
border: 1px solid #ddd;
}

.search-btn {
background-color: #007bff;
color: white;
#file-area table {
margin: 0 auto;
}

.reset-btn {
background-color: #f44336;
color: white;
#file-area th {
cursor: pointer;
position: relative;
background-color: #f2f2f2;
font-weight: bold;
text-align: center;
font-size: large;
}

footer {
background-color: #333;
color: white;
padding-top: 10px;
text-align: center;
position: fixed;
bottom: 0;
width: 90%;
/* margin: 0 auto; */
#file-area th.asc::after {
content: " ⬆️";
position: absolute;
right: 5px;
}

#file-area th.desc::after {
content: " ⬇️";
position: absolute;
right: 5px;
}
20 changes: 7 additions & 13 deletions site/assets/js/loadfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ function processFile(file) {
}

function displayTable(table) {
const tableDiv = document.getElementById('fileContent');
tableDiv.innerHTML = '';
table.id = "dataTable";
tableDiv.appendChild(table.cloneNode(true));
const tableDiv = document.getElementById('dataTable');
tableDiv.innerHTML = table.innerHTML;
}

function findFolder(bookmarkElement) {
Expand All @@ -48,12 +46,7 @@ function findFolder(bookmarkElement) {
}

function displayBookmarks(fileContent) {
const tableDiv = document.getElementById('fileContent');
tableDiv.innerHTML = '';

const table = document.createElement('table');
table.id = "dataTable"

const thead = document.createElement('thead');
const tbody = document.createElement('tbody');
const trHead = document.createElement('tr');
Expand Down Expand Up @@ -93,13 +86,15 @@ function displayBookmarks(fileContent) {
}
tbody.appendChild(tr);
});

table.appendChild(tbody);
tableDiv.appendChild(table.cloneNode(true));
displayTable(table)
}

function clearContent() {
document.getElementById('fileContent').innerHTML = '';
document.getElementById("filterConditions").innerHTML = "";
document.getElementById('dataTable').innerHTML = '';
document.getElementById('dataCount').innerHTML = '';
document.getElementById("search-options").innerHTML = "";
}

function dragOverHandler(event) {
Expand All @@ -120,7 +115,6 @@ function openFile() {
fileInput.addEventListener('change', function(event) {
const selectedFile = event.target.files[0];
if (selectedFile) {
// console.log("open", selectedFile.name)
const file = event.target.files[0];
processFile(file);
event.target.value = ''; // allow open same file again
Expand Down
Loading

0 comments on commit 5e2a19d

Please sign in to comment.