mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: landing list crash — title is now LocaleDict, not string
- Update LandingListItem.title type to LocaleDict - Add resolveLocaleDisplay() helper for extracting display string - Use resolveLocaleDisplay() in landing list and delete confirm
This commit is contained in:
@@ -108,7 +108,7 @@ export interface AdminLandingFeature {
|
||||
export interface LandingListItem {
|
||||
id: number;
|
||||
slug: string;
|
||||
title: string;
|
||||
title: LocaleDict;
|
||||
is_active: boolean;
|
||||
display_order: number;
|
||||
gift_enabled: boolean;
|
||||
@@ -167,6 +167,13 @@ export type LandingUpdateRequest = Partial<LandingCreateRequest>;
|
||||
* If it's a string, wraps it as `{ ru: value }`.
|
||||
* If null/undefined, returns the fallback.
|
||||
*/
|
||||
/** Extract best display string from a LocaleDict: ru → en → first available → '' */
|
||||
export function resolveLocaleDisplay(dict: LocaleDict | string | null | undefined): string {
|
||||
if (!dict) return '';
|
||||
if (typeof dict === 'string') return dict;
|
||||
return dict.ru || dict.en || Object.values(dict).find((v) => v?.trim()) || '';
|
||||
}
|
||||
|
||||
export function toLocaleDict(
|
||||
value: string | LocaleDict | null | undefined,
|
||||
fallback: LocaleDict = {},
|
||||
|
||||
Reference in New Issue
Block a user