mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-24 22:56:02 +00:00
Better settings control (#725)
- Lock some settings during sync - Make experimental features more clearly labelled
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
* Patch visualizer now indicates what changes failed to apply. ([#717])
|
* Patch visualizer now indicates what changes failed to apply. ([#717])
|
||||||
* Add buttons for navigation on the Connected page ([#722])
|
* Add buttons for navigation on the Connected page ([#722])
|
||||||
* Improve tooltip behavior ([#723])
|
* Improve tooltip behavior ([#723])
|
||||||
|
* Better settings controls ([#725])
|
||||||
|
|
||||||
[#668]: https://github.com/rojo-rbx/rojo/pull/668
|
[#668]: https://github.com/rojo-rbx/rojo/pull/668
|
||||||
[#674]: https://github.com/rojo-rbx/rojo/pull/674
|
[#674]: https://github.com/rojo-rbx/rojo/pull/674
|
||||||
@@ -28,6 +29,7 @@
|
|||||||
[#717]: https://github.com/rojo-rbx/rojo/pull/717
|
[#717]: https://github.com/rojo-rbx/rojo/pull/717
|
||||||
[#722]: https://github.com/rojo-rbx/rojo/pull/722
|
[#722]: https://github.com/rojo-rbx/rojo/pull/722
|
||||||
[#723]: https://github.com/rojo-rbx/rojo/pull/723
|
[#723]: https://github.com/rojo-rbx/rojo/pull/723
|
||||||
|
[#725]: https://github.com/rojo-rbx/rojo/pull/725
|
||||||
|
|
||||||
## [7.3.0] - April 22, 2023
|
## [7.3.0] - April 22, 2023
|
||||||
* Added `$attributes` to project format. ([#574])
|
* Added `$attributes` to project format. ([#574])
|
||||||
|
|||||||
@@ -51,10 +51,15 @@ function Checkbox:render()
|
|||||||
ZIndex = self.props.zIndex,
|
ZIndex = self.props.zIndex,
|
||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
|
|
||||||
[Roact.Event.Activated] = self.props.onClick,
|
[Roact.Event.Activated] = function()
|
||||||
|
if self.props.locked then return end
|
||||||
|
self.props.onClick()
|
||||||
|
end,
|
||||||
}, {
|
}, {
|
||||||
StateTip = e(Tooltip.Trigger, {
|
StateTip = e(Tooltip.Trigger, {
|
||||||
text = if self.props.active then "Enabled" else "Disabled",
|
text =
|
||||||
|
(if self.props.locked then "[LOCKED] " else "")
|
||||||
|
.. (if self.props.active then "Enabled" else "Disabled"),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Active = e(SlicedImage, {
|
Active = e(SlicedImage, {
|
||||||
@@ -65,7 +70,7 @@ function Checkbox:render()
|
|||||||
zIndex = 2,
|
zIndex = 2,
|
||||||
}, {
|
}, {
|
||||||
Icon = e("ImageLabel", {
|
Icon = e("ImageLabel", {
|
||||||
Image = Assets.Images.Checkbox.Active,
|
Image = if self.props.locked then Assets.Images.Checkbox.Locked else Assets.Images.Checkbox.Active,
|
||||||
ImageColor3 = theme.Active.IconColor,
|
ImageColor3 = theme.Active.IconColor,
|
||||||
ImageTransparency = activeTransparency,
|
ImageTransparency = activeTransparency,
|
||||||
|
|
||||||
@@ -84,7 +89,7 @@ function Checkbox:render()
|
|||||||
size = UDim2.new(1, 0, 1, 0),
|
size = UDim2.new(1, 0, 1, 0),
|
||||||
}, {
|
}, {
|
||||||
Icon = e("ImageLabel", {
|
Icon = e("ImageLabel", {
|
||||||
Image = Assets.Images.Checkbox.Inactive,
|
Image = if self.props.locked then Assets.Images.Checkbox.Locked else Assets.Images.Checkbox.Inactive,
|
||||||
ImageColor3 = theme.Inactive.IconColor,
|
ImageColor3 = theme.Inactive.IconColor,
|
||||||
ImageTransparency = self.props.transparency,
|
ImageTransparency = self.props.transparency,
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,13 @@ function Dropdown:init()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function Dropdown:didUpdate()
|
function Dropdown:didUpdate(prevProps)
|
||||||
|
if self.props.locked and not prevProps.locked then
|
||||||
|
self:setState({
|
||||||
|
open = false,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
self.openMotor:setGoal(
|
self.openMotor:setGoal(
|
||||||
Flipper.Spring.new(self.state.open and 1 or 0, {
|
Flipper.Spring.new(self.state.open and 1 or 0, {
|
||||||
frequency = 6,
|
frequency = 6,
|
||||||
@@ -68,6 +74,7 @@ function Dropdown:render()
|
|||||||
Font = Enum.Font.GothamMedium,
|
Font = Enum.Font.GothamMedium,
|
||||||
|
|
||||||
[Roact.Event.Activated] = function()
|
[Roact.Event.Activated] = function()
|
||||||
|
if self.props.locked then return end
|
||||||
self:setState({
|
self:setState({
|
||||||
open = false,
|
open = false,
|
||||||
})
|
})
|
||||||
@@ -89,6 +96,7 @@ function Dropdown:render()
|
|||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
|
|
||||||
[Roact.Event.Activated] = function()
|
[Roact.Event.Activated] = function()
|
||||||
|
if self.props.locked then return end
|
||||||
self:setState({
|
self:setState({
|
||||||
open = not self.state.open,
|
open = not self.state.open,
|
||||||
})
|
})
|
||||||
@@ -101,7 +109,7 @@ function Dropdown:render()
|
|||||||
size = UDim2.new(1, 0, 1, 0),
|
size = UDim2.new(1, 0, 1, 0),
|
||||||
}, {
|
}, {
|
||||||
DropArrow = e("ImageLabel", {
|
DropArrow = e("ImageLabel", {
|
||||||
Image = Assets.Images.Dropdown.Arrow,
|
Image = if self.props.locked then Assets.Images.Dropdown.Locked else Assets.Images.Dropdown.Arrow,
|
||||||
ImageColor3 = self.openBinding:map(function(a)
|
ImageColor3 = self.openBinding:map(function(a)
|
||||||
return theme.Closed.IconColor:Lerp(theme.Open.IconColor, a)
|
return theme.Closed.IconColor:Lerp(theme.Open.IconColor, a)
|
||||||
end),
|
end),
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ function Setting:render()
|
|||||||
}, {
|
}, {
|
||||||
Input = if self.props.options ~= nil then
|
Input = if self.props.options ~= nil then
|
||||||
e(Dropdown, {
|
e(Dropdown, {
|
||||||
|
locked = self.props.locked,
|
||||||
options = self.props.options,
|
options = self.props.options,
|
||||||
active = self.state.setting,
|
active = self.state.setting,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
@@ -78,6 +79,7 @@ function Setting:render()
|
|||||||
})
|
})
|
||||||
else
|
else
|
||||||
e(Checkbox, {
|
e(Checkbox, {
|
||||||
|
locked = self.props.locked,
|
||||||
active = self.state.setting,
|
active = self.state.setting,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
position = UDim2.new(1, 0, 0.5, 0),
|
position = UDim2.new(1, 0, 0.5, 0),
|
||||||
@@ -106,12 +108,13 @@ function Setting:render()
|
|||||||
BackgroundTransparency = 1,
|
BackgroundTransparency = 1,
|
||||||
}, {
|
}, {
|
||||||
Name = e("TextLabel", {
|
Name = e("TextLabel", {
|
||||||
Text = self.props.name,
|
Text = (if self.props.experimental then "<font color=\"#FF8E3C\">⚠ </font>" else "") .. self.props.name,
|
||||||
Font = Enum.Font.GothamBold,
|
Font = Enum.Font.GothamBold,
|
||||||
TextSize = 17,
|
TextSize = 17,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
RichText = true,
|
||||||
|
|
||||||
Size = UDim2.new(1, 0, 0, 17),
|
Size = UDim2.new(1, 0, 0, 17),
|
||||||
|
|
||||||
@@ -120,7 +123,7 @@ function Setting:render()
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
Description = e("TextLabel", {
|
Description = e("TextLabel", {
|
||||||
Text = self.props.description,
|
Text = (if self.props.experimental then "<font color=\"#FF8E3C\">[Experimental] </font>" else "") .. self.props.description,
|
||||||
Font = Enum.Font.Gotham,
|
Font = Enum.Font.Gotham,
|
||||||
LineHeight = 1.2,
|
LineHeight = 1.2,
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
@@ -128,11 +131,13 @@ function Setting:render()
|
|||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
RichText = true,
|
||||||
|
|
||||||
Size = self.containerSize:map(function(value)
|
Size = self.containerSize:map(function(value)
|
||||||
|
local desc = (if self.props.experimental then "[Experimental] " else "") .. self.props.description
|
||||||
local offset = (self.props.onReset and 34 or 0) + (self.props.options ~= nil and 120 or 40)
|
local offset = (self.props.onReset and 34 or 0) + (self.props.options ~= nil and 120 or 40)
|
||||||
local textBounds = getTextBounds(
|
local textBounds = getTextBounds(
|
||||||
self.props.description, 14, Enum.Font.Gotham, 1.2,
|
desc, 14, Enum.Font.Gotham, 1.2,
|
||||||
Vector2.new(value.X - offset, math.huge)
|
Vector2.new(value.X - offset, math.huge)
|
||||||
)
|
)
|
||||||
return UDim2.new(1, -offset, 0, textBounds.Y)
|
return UDim2.new(1, -offset, 0, textBounds.Y)
|
||||||
|
|||||||
@@ -115,7 +115,9 @@ function SettingsPage:render()
|
|||||||
OpenScriptsExternally = e(Setting, {
|
OpenScriptsExternally = e(Setting, {
|
||||||
id = "openScriptsExternally",
|
id = "openScriptsExternally",
|
||||||
name = "Open Scripts Externally",
|
name = "Open Scripts Externally",
|
||||||
description = "EXPERIMENTAL! Attempt to open scripts in an external editor",
|
description = "Attempt to open scripts in an external editor",
|
||||||
|
locked = self.props.syncActive,
|
||||||
|
experimental = true,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
layoutOrder = 4,
|
layoutOrder = 4,
|
||||||
}),
|
}),
|
||||||
@@ -123,7 +125,9 @@ function SettingsPage:render()
|
|||||||
TwoWaySync = e(Setting, {
|
TwoWaySync = e(Setting, {
|
||||||
id = "twoWaySync",
|
id = "twoWaySync",
|
||||||
name = "Two-Way Sync",
|
name = "Two-Way Sync",
|
||||||
description = "EXPERIMENTAL! Editing files in Studio will sync them into the filesystem",
|
description = "Editing files in Studio will sync them into the filesystem",
|
||||||
|
locked = self.props.syncActive,
|
||||||
|
experimental = true,
|
||||||
transparency = self.props.transparency,
|
transparency = self.props.transparency,
|
||||||
layoutOrder = 5,
|
layoutOrder = 5,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -606,6 +606,8 @@ function App:render()
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
Settings = createPageElement(AppStatus.Settings, {
|
Settings = createPageElement(AppStatus.Settings, {
|
||||||
|
syncActive = self.serveSession ~= nil and self.serveSession:getStatus() == ServeSession.Status.Connected,
|
||||||
|
|
||||||
onBack = function()
|
onBack = function()
|
||||||
self:setState({
|
self:setState({
|
||||||
appStatus = self.backPage or AppStatus.NotConnected,
|
appStatus = self.backPage or AppStatus.NotConnected,
|
||||||
|
|||||||
@@ -33,9 +33,11 @@ local Assets = {
|
|||||||
Checkbox = {
|
Checkbox = {
|
||||||
Active = "rbxassetid://6016251644",
|
Active = "rbxassetid://6016251644",
|
||||||
Inactive = "rbxassetid://6016251963",
|
Inactive = "rbxassetid://6016251963",
|
||||||
|
Locked = "rbxassetid://14011257320",
|
||||||
},
|
},
|
||||||
Dropdown = {
|
Dropdown = {
|
||||||
Arrow = "rbxassetid://10131770538",
|
Arrow = "rbxassetid://10131770538",
|
||||||
|
Locked = "rbxassetid://14011257320",
|
||||||
},
|
},
|
||||||
Spinner = {
|
Spinner = {
|
||||||
Foreground = "rbxassetid://3222731032",
|
Foreground = "rbxassetid://3222731032",
|
||||||
|
|||||||
Reference in New Issue
Block a user