mirror of
https://github.com/TemujinCalidius/SurvivorCore.git
synced 2026-08-14 00:58:01 +00:00
fix(builder): point first-time creators at Content when a picker is empty
Found in real use: with no gatherables authored yet, the Build form's Resource field has no ⌄ picker (there's nothing to cycle) and nothing explains where entries come from — so the very first no-code run dead-ends at the moment the flow should feel best. A field that references authored content now shows "No Gatherables yet — create one →" when that category is empty, which jumps straight to the right Content page. Not a mutation, so it isn't wrapped in a ChangeHistory recording. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
e640fd6a79
commit
d15b47e7d8
@@ -220,6 +220,27 @@ function BuildAdminUi.mount(container: Frame, BuildAdmin: any, ContentAdmin: any
|
||||
})
|
||||
row.LayoutOrder = i
|
||||
row.Parent = panel
|
||||
|
||||
-- First-run dead end: a field that points at authored content is useless until some
|
||||
-- exists, and the picker simply isn't there to hint at it. Say where to go, and
|
||||
-- offer to take them.
|
||||
if spec.ref and (not choices or #choices == 0) then
|
||||
local cat = ContentAdmin.CATEGORIES and ContentAdmin.CATEGORIES[spec.ref]
|
||||
local catTitle = (cat and cat.title) or spec.ref
|
||||
local jump = Theme.button({
|
||||
Size = UDim2.new(1, 0, 0, 22),
|
||||
Text = `No {catTitle} yet — create one →`,
|
||||
TextColor3 = Theme.COLOR.ACCENT,
|
||||
TextSize = 11,
|
||||
LayoutOrder = i,
|
||||
})
|
||||
jump.Parent = panel
|
||||
jump.MouseButton1Click:Connect(function()
|
||||
if actions.selectPage then
|
||||
actions.selectPage("content/" .. spec.ref)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -138,6 +138,13 @@ local buildActions = {
|
||||
return BuildAdmin.resetField(instance, spec)
|
||||
end)
|
||||
end,
|
||||
-- Not a mutation (no recording): jump to a Content page so a field that references authored
|
||||
-- content can send a first-time creator somewhere useful instead of dead-ending.
|
||||
selectPage = function(id: string)
|
||||
if nav then
|
||||
nav.selectPage(id)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
-- ── Content callbacks (authored + overrides), bundled for the pages ──────────
|
||||
|
||||
Reference in New Issue
Block a user