Enhance UI components for map editing and school creation. Update styles for improved layout and responsiveness, including adjustments to dialog positioning and flex properties. Introduce new localization strings for better user guidance in both English and Russian. Refactor code structure for clarity and maintainability, ensuring a more intuitive user experience.
This commit is contained in:
@@ -63,13 +63,11 @@ public static class MapView
|
||||
|
||||
foreach (var floor in map.Floors)
|
||||
{
|
||||
var defLabel = LabelOf(catalog, locale, DefKind.Floor, floor.Def);
|
||||
var name = string.IsNullOrWhiteSpace(floor.Label) ? defLabel : floor.Label;
|
||||
nodes.Add(Node(
|
||||
MapNodeKind.Floor,
|
||||
floor.Id,
|
||||
floor.Building,
|
||||
name,
|
||||
FloorName(catalog, locale, floor),
|
||||
[],
|
||||
PositionsOf(catalog, locale, DefKind.Floor, floor.Def)));
|
||||
}
|
||||
@@ -111,6 +109,22 @@ public static class MapView
|
||||
Positions = positions,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// A floor's <see cref="FloorNode.Label"/> is its designation, not a replacement name — the
|
||||
/// vanilla map says "1". On its own that is a stray digit in the client's tree, so it follows
|
||||
/// the localized def label: "Этаж 1", "Floor 1". Mirrored by <c>floorName</c> in the editor.
|
||||
/// </summary>
|
||||
private static string FloorName(DefCatalog catalog, string locale, FloorNode floor)
|
||||
{
|
||||
var defLabel = LabelOf(catalog, locale, DefKind.Floor, floor.Def);
|
||||
if (string.IsNullOrWhiteSpace(floor.Label))
|
||||
{
|
||||
return defLabel;
|
||||
}
|
||||
|
||||
return defLabel == floor.Def ? floor.Label : $"{defLabel} {floor.Label}";
|
||||
}
|
||||
|
||||
private static string LabelOf(DefCatalog catalog, string locale, DefKind kind, string defName) =>
|
||||
catalog.TryGet(kind, defName, out var def) ? catalog.Label(locale, def) : defName;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user