feat(i18n): add saveFailed message and dimensionRatesMixedHint to locale files
- Updated English, Nepali, and Chinese locale files to include a new message for "Failed to save configuration". - Added a hint for mixed rebate rates within the same dimension to enhance user understanding. - Improved internationalization support across multiple locales for better user experience in the admin interface.
This commit is contained in:
12
src/lib/config-version-auto-pick.ts
Normal file
12
src/lib/config-version-auto-pick.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ConfigVersionSummary } from "@/types/api/admin-config";
|
||||
|
||||
/** Prefer newest draft, then active, otherwise highest numeric id — matches config doc UX. */
|
||||
export function pickDefaultConfigVersionId(list: ConfigVersionSummary[]): string | null {
|
||||
if (list.length === 0) {
|
||||
return null;
|
||||
}
|
||||
const drafts = list.filter((x) => x.status === "draft").sort((a, b) => b.id - a.id);
|
||||
const active = list.find((x) => x.status === "active");
|
||||
const pick = drafts[0] ?? active ?? [...list].sort((a, b) => b.id - a.id)[0];
|
||||
return pick ? String(pick.id) : null;
|
||||
}
|
||||
Reference in New Issue
Block a user