mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
Show file type icons for each indexed file in config card of web app
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user