Show file type icons for each indexed file in config card of web app

This commit is contained in:
Debanjum Singh Solanky
2023-11-07 05:16:41 -08:00
parent 045c2252d6
commit 156421d30a
2 changed files with 28 additions and 2 deletions

View File

@@ -209,16 +209,20 @@
border: none;
color: var(--flower);
padding: 4px;
width: 32px;
margin-bottom: 0px
}
div.file-element {
display: grid;
grid-template-columns: 1fr auto;
grid-template-columns: 1fr 5fr 1fr;
border: 1px solid rgb(229, 229, 229);
border-radius: 4px;
box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.1),0px 1px 2px -1px rgba(0,0,0,0.8);
padding: 4px;
padding: 4px 0;
margin-bottom: 8px;
justify-items: center;
align-items: center;
}
div.remove-button-container {

View File

@@ -23,6 +23,12 @@
#desktop-client {
font-weight: normal;
}
.indexed-files {
width: 100%;
}
.content-name {
font-size: smaller;
}
</style>
<script>
function removeFile(path) {
@@ -59,6 +65,22 @@
let fileElement = document.createElement("div");
fileElement.classList.add("file-element");
let fileExtension = filename.split('.').pop();
if (fileExtension === "org")
image_name = "org.svg"
else if (fileExtension === "pdf")
image_name = "pdf.svg"
else if (fileExtension === "markdown" || fileExtension === "md")
image_name = "markdown.svg"
else
image_name = "plaintext.svg"
let fileIconElement = document.createElement("img");
fileIconElement.classList.add("card-icon");
fileIconElement.src = `/static/assets/icons/${image_name}`;
fileIconElement.alt = "File";
fileElement.appendChild(fileIconElement);
let fileNameElement = document.createElement("div");
fileNameElement.classList.add("content-name");
fileNameElement.innerHTML = filename;