Added sort by date Added

09035a71dc16b3d503fde448fd9cb954e99f2db5

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

3 files changed, +15 -9Ignore whitespace
public/index.html+2 -0
@@ -2273,6 +2273,8 @@
2273 <option value="search" data-i18n="Search" hidden>A-Z</option>2273 <option value="search" data-i18n="Search" hidden>A-Z</option>
2274 <option value="asc">A-Z</option>2274 <option value="asc">A-Z</option>
2275 <option value="desc">Z-A</option>2275 <option value="desc">Z-A</option>
2276 <option value="date_asc">Date Asc</option>
2277 <option value="date_desc">Date Desc</option>
2276 </select>2278 </select>
2277 <select id="category_selection">2279 <select id="category_selection">
2278 <option value="" disabled selected data-i18n="category">category</option>2280 <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) {
293 populateClassSelection(data);293 populateClassSelection(data);
294294
295 // Retrieve the stored number of items per page or default to 5295 // Retrieve the stored number of items per page or default to 5
296 const perPage = Number(localStorage.getItem(storageKey)) || 5;296 const perPage = Number(localStorage.getItem(storageKey)) || 6;
297297
298 // Initialize pagination with the full set of models298 // Initialize pagination with the full set of models
299 setupPagination(originalModels, perPage);299 setupPagination(originalModels, perPage);
@@ -303,7 +303,7 @@ export async function loadFeatherlessModels(data) {
303 paginationContainer.pagination({303 paginationContainer.pagination({
304 dataSource: models,304 dataSource: models,
305 pageSize: perPage,305 pageSize: perPage,
306 sizeChangerOptions: [5, 10, 25, 50, 100, 250, 500, 1000],306 sizeChangerOptions: [6, 10, 26, 50, 100, 250, 500, 1000],
307 pageRange: 1,307 pageRange: 1,
308 pageNumber: 1,308 pageNumber: 1,
309 showPageNumbers: true,309 showPageNumbers: true,
@@ -450,6 +450,10 @@ export async function loadFeatherlessModels(data) {
450 filteredModels.sort((a, b) => a.id.localeCompare(b.id));450 filteredModels.sort((a, b) => a.id.localeCompare(b.id));
451 } else if (selectedSortOrder === 'desc') {451 } else if (selectedSortOrder === 'desc') {
452 filteredModels.sort((a, b) => b.id.localeCompare(a.id));452 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));
453 }457 }
454458
455 // Reinitialize pagination with the filtered and sorted models459 // Reinitialize pagination with the filtered and sorted models
public/style.css+7 -7
@@ -5495,22 +5495,22 @@ body:not(.movingUI) .drawer-content.maximized {
5495 border-radius: 8px; /* Rounded corners for the card */5495 border-radius: 8px; /* Rounded corners for the card */
5496 background-color: #222; /* Card background color */5496 background-color: #222; /* Card background color */
5497 color: #fff; /* Text color */5497 color: #fff; /* Text color */
5498 margin: 10px; /* Space between cards */5498 margin: 7px; /* Space between cards */
5499 width: calc(100% - 20px); /* Full width minus margin */5499 width: calc(100% - 7px); /* Full width minus margin */
5500 box-sizing: border-box; /* Include padding and border in the width */5500 box-sizing: border-box; /* Include padding and border in the width */
5501 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, border 0.2s ease-in-out;5501 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out, border 0.2s ease-in-out;
5502}5502}
55035503
5504.model-card:hover {5504.model-card:hover {
5505 transform: scale(1.025); /* Grow the card slightly on hover */5505 transform: scale(1.02); /* Grow the card slightly on hover */
5506 background-color: #444; /* Highlight background on hover */5506 background-color: #444; /* Highlight background on hover */
5507 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out; /* Smooth transition */5507 transition: transform 0.2s ease-in-out, background-color 0.2s ease-in-out; /* Smooth transition */
5508}5508}
55095509
5510/* Highlight the selected model card */5510/* Highlight the selected model card */
5511.model-card.selected {5511.model-card.selected {
5512 border: 2px solid #00f; /* Add a blue border to indicate selection */5512 border: 2px solid var(--okGreen70a); /* Add a blue border to indicate selection */
5513 background-color: #333; /* Slightly darker background for selected state */5513 background-color: var(--okGreen70a); /* Slightly darker background for selected state */
5514}5514}
55155515
5516/* Model title information */5516/* Model title information */
@@ -5550,7 +5550,7 @@ body:not(.movingUI) .drawer-content.maximized {
5550 grid-template-columns: repeat(2, 1fr);5550 grid-template-columns: repeat(2, 1fr);
5551 display: flex;5551 display: flex;
5552 flex-wrap: wrap; /* Cards wrap onto new lines when necessary */5552 flex-wrap: wrap; /* Cards wrap onto new lines when necessary */
5553 gap: 15px; /* Space between grid items */5553 gap: 5px; /* Space between grid items */
5554 justify-content: flex-start; /* Align cards to the left */5554 justify-content: flex-start; /* Align cards to the left */
5555}5555}
55565556
@@ -5558,7 +5558,7 @@ body:not(.movingUI) .drawer-content.maximized {
5558#model_card_block.grid-view .model-card {5558#model_card_block.grid-view .model-card {
5559 flex-direction: column; /* Stack title, class, and context length vertically for grid */5559 flex-direction: column; /* Stack title, class, and context length vertically for grid */
5560 flex: 1 1 calc(50% - 30px); /* 3 cards per row with spacing */5560 flex: 1 1 calc(50% - 30px); /* 3 cards per row with spacing */
5561 margin-bottom: 10px;5561 /* margin-bottom: 10px; */
5562}5562}
55635563
5564/* Ensure the search bar takes most of the width */5564/* Ensure the search bar takes most of the width */