Merge branch 'zustand/io/migration' into new_project_modal

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-05 21:48:40 -03:00
commit 97b574272f
4 changed files with 45 additions and 42 deletions

View file

@ -727,4 +727,14 @@ export const STATUS_BUILD = "Build to validate status.";
export const STATUS_BUILDING = "Building...";
export const SAVED_HOVER = "Last saved at ";
export const RUN_TIMESTAMP_PREFIX = "Last Run: ";
export const STARTER_FOLDER_NAME = "Starter Projects";
export const PRIORITY_SIDEBAR_ORDER = [
"saved_components",
"inputs",
"outputs",
"prompts",
"data",
"prompt",
"models",
"helpers",
];

View file

@ -1,17 +1,10 @@
import { PRIORITY_SIDEBAR_ORDER } from "../../../../constants/constants";
export function sortKeys(a: string, b: string) {
// Define the order of specific keys
const order = [
"saved_components",
"inputs",
"outputs",
"prompts",
"data",
"prompts",
"models",
"helpers",
];
const indexA = order.indexOf(a.toLowerCase());
const indexB = order.indexOf(b.toLowerCase());
const indexA = PRIORITY_SIDEBAR_ORDER.indexOf(a.toLowerCase());
const indexB = PRIORITY_SIDEBAR_ORDER.indexOf(b.toLowerCase());
// Check if both keys are in the predefined order
if (indexA !== -1 && indexB !== -1) {