Added sort by date Added

09035a71dc16b3d503fde448fd9cb954e99f2db5

DarokCx <77368869+DarokCx@users.noreply.github.com>

3 files changed, +15 -9Showing whitespace changes
public/index.html+2 -0
@@ -2273,6 +2273,8 @@
22732273 <option value="search" data-i18n="Search" hidden>A-Z</option>
22742274 <option value="asc">A-Z</option>
22752275 <option value="desc">Z-A</option>
2276+ <option value="date_asc">Date Asc</option>
2277+ <option value="date_desc">Date Desc</option>
22762278 </select>
22772279 <select id="category_selection">
22782280 <option value="" disabled selected data-i18n="category">category</option>
public/scripts/textgen-models.js+6 -2
@@ -293,7 +293,7 @@ export async function loadFeatherlessModels(data) {
293293 populateClassSelection(data);
294294
295295 // Retrieve the stored number of items per page or default to 5
296296 const perPage = Number(localStorage.getItem(storageKey)) || 56;
297297
298298 // Initialize pagination with the full set of models
299299 setupPagination(originalModels, perPage);
@@ -303,7 +303,7 @@ export async function loadFeatherlessModels(data) {
303303 paginationContainer.pagination({
304304 dataSource: models,
305305 pageSize: perPage,
306306 sizeChangerOptions: [56, 10, 2526, 50, 100, 250, 500, 1000],
307307 pageRange: 1,
308308 pageNumber: 1,
309309 showPageNumbers: true,
@@ -450,6 +450,10 @@ export async function loadFeatherlessModels(data) {
450450 filteredModels.sort((a, b) => a.id.localeCompare(b.id));
451451 } else if (selectedSortOrder === 'desc') {
452452 filteredModels.sort((a, b) => b.id.localeCompare(a.id));
453+ } else if (selectedSortOrder === 'date_asc') {
454+ filteredModels.sort((a, b) => a.updated_at.localeCompare(b.updated_at));
455+ } else if (selectedSortOrder === 'date_desc') {
456+ filteredModels.sort((a, b) => b.updated_at.localeCompare(a.updated_at));
453457 }
454458
455459 // Reinitialize pagination with the filtered and sorted models
public/style.css+7 -7
@@ -5495,22 +5495,22 @@ body:not(.movingUI) .drawer-content.maximized {
54955495 border-radius: 8px; /* Rounded corners for the card */
54965496 background-color: #222; /* Card background color */
54975497 color: #fff; /* Text color */
54985498 margin: 10px7px; /* Space between cards */
54995499 width: calc(100% - 20px7px); /* Full width minus margin */
55005500 box-sizing: border-box; /* Include padding and border in the width */
55015501 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, border 0.2s ease-in-out;
55025502}
55035503
55045504.model-card:hover {
55055505 transform: scale(1.02502); /* Grow the card slightly on hover */
55065506 background-color: #444; /* Highlight background on hover */
55075507 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out; /* Smooth transition */
55085508}
55095509
55105510/* Highlight the selected model card */
55115511.model-card.selected {
55125512 border: 2px solid #00fvar(--okGreen70a); /* Add a blue border to indicate selection */
55135513 background-color: #333var(--okGreen70a); /* Slightly darker background for selected state */
55145514}
55155515
55165516/* Model title information */
@@ -5550,7 +5550,7 @@ body:not(.movingUI) .drawer-content.maximized {
55505550 grid-template-columns: repeat(2, 1fr);
55515551 display: flex;
55525552 flex-wrap: wrap; /* Cards wrap onto new lines when necessary */
55535553 gap: 15px5px; /* Space between grid items */
55545554 justify-content: flex-start; /* Align cards to the left */
55555555}
55565556
@@ -5558,7 +5558,7 @@ body:not(.movingUI) .drawer-content.maximized {
55585558#model_card_block.grid-view .model-card {
55595559 flex-direction: column; /* Stack title, class, and context length vertically for grid */
55605560 flex: 1 1 calc(50% - 30px); /* 3 cards per row with spacing */
55615561 /* margin-bottom: 10px; */
55625562}
55635563
55645564/* Ensure the search bar takes most of the width */