mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-24 06:35:39 +00:00
plugin: Add dummy settings panel
This commit is contained in:
@@ -13,11 +13,12 @@ local Version = require(Plugin.Version)
|
|||||||
local preloadAssets = require(Plugin.preloadAssets)
|
local preloadAssets = require(Plugin.preloadAssets)
|
||||||
local strict = require(Plugin.strict)
|
local strict = require(Plugin.strict)
|
||||||
|
|
||||||
local Theme = require(Plugin.Components.Theme)
|
|
||||||
local ConnectPanel = require(Plugin.Components.ConnectPanel)
|
local ConnectPanel = require(Plugin.Components.ConnectPanel)
|
||||||
local ConnectingPanel = require(Plugin.Components.ConnectingPanel)
|
local ConnectingPanel = require(Plugin.Components.ConnectingPanel)
|
||||||
local ConnectionActivePanel = require(Plugin.Components.ConnectionActivePanel)
|
local ConnectionActivePanel = require(Plugin.Components.ConnectionActivePanel)
|
||||||
local ErrorPanel = require(Plugin.Components.ErrorPanel)
|
local ErrorPanel = require(Plugin.Components.ErrorPanel)
|
||||||
|
local SettingsPanel = require(Plugin.Components.SettingsPanel)
|
||||||
|
local Theme = require(Plugin.Components.Theme)
|
||||||
|
|
||||||
local e = Roact.createElement
|
local e = Roact.createElement
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ local AppStatus = strict("AppStatus", {
|
|||||||
Connecting = "Connecting",
|
Connecting = "Connecting",
|
||||||
Connected = "Connected",
|
Connected = "Connected",
|
||||||
Error = "Error",
|
Error = "Error",
|
||||||
|
Settings = "Settings",
|
||||||
})
|
})
|
||||||
|
|
||||||
local App = Roact.Component:extend("App")
|
local App = Roact.Component:extend("App")
|
||||||
@@ -155,6 +157,11 @@ function App:render()
|
|||||||
startSession = function(address, port)
|
startSession = function(address, port)
|
||||||
self:startSession(address, port)
|
self:startSession(address, port)
|
||||||
end,
|
end,
|
||||||
|
openSettings = function()
|
||||||
|
self:setState({
|
||||||
|
appStatus = AppStatus.Settings,
|
||||||
|
})
|
||||||
|
end,
|
||||||
cancel = function()
|
cancel = function()
|
||||||
Log.trace("Canceling session configuration")
|
Log.trace("Canceling session configuration")
|
||||||
|
|
||||||
@@ -166,7 +173,7 @@ function App:render()
|
|||||||
}
|
}
|
||||||
elseif self.state.appStatus == AppStatus.Connecting then
|
elseif self.state.appStatus == AppStatus.Connecting then
|
||||||
children = {
|
children = {
|
||||||
ConnectingPanel = Roact.createElement(ConnectingPanel),
|
ConnectingPanel = e(ConnectingPanel),
|
||||||
}
|
}
|
||||||
elseif self.state.appStatus == AppStatus.Connected then
|
elseif self.state.appStatus == AppStatus.Connected then
|
||||||
children = {
|
children = {
|
||||||
@@ -184,9 +191,19 @@ function App:render()
|
|||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
elseif self.state.appStatus == AppStatus.Settings then
|
||||||
|
children = {
|
||||||
|
e(SettingsPanel, {
|
||||||
|
back = function()
|
||||||
|
self:setState({
|
||||||
|
appStatus = AppStatus.NotStarted,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
}
|
||||||
elseif self.state.appStatus == AppStatus.Error then
|
elseif self.state.appStatus == AppStatus.Error then
|
||||||
children = {
|
children = {
|
||||||
ErrorPanel = Roact.createElement(ErrorPanel, {
|
ErrorPanel = e(ErrorPanel, {
|
||||||
errorMessage = self.state.errorMessage,
|
errorMessage = self.state.errorMessage,
|
||||||
onDismiss = function()
|
onDismiss = function()
|
||||||
self:setState({
|
self:setState({
|
||||||
@@ -197,8 +214,8 @@ function App:render()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return Roact.createElement(Theme.StudioProvider, nil, {
|
return e(Theme.StudioProvider, nil, {
|
||||||
UI = Roact.createElement(Roact.Portal, {
|
UI = e(Roact.Portal, {
|
||||||
target = self.dockWidget,
|
target = self.dockWidget,
|
||||||
}, children),
|
}, children),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ end
|
|||||||
|
|
||||||
function ConnectPanel:render()
|
function ConnectPanel:render()
|
||||||
local startSession = self.props.startSession
|
local startSession = self.props.startSession
|
||||||
|
local openSettings = self.props.openSettings
|
||||||
|
|
||||||
return Theme.with(function(theme)
|
return Theme.with(function(theme)
|
||||||
return e(Panel, nil, {
|
return e(Panel, nil, {
|
||||||
@@ -136,6 +137,17 @@ function ConnectPanel:render()
|
|||||||
PaddingRight = UDim.new(0, 24),
|
PaddingRight = UDim.new(0, 24),
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
|
e(FormButton, {
|
||||||
|
layoutOrder = 1,
|
||||||
|
text = "Settings",
|
||||||
|
secondary = true,
|
||||||
|
onClick = function()
|
||||||
|
if openSettings ~= nil then
|
||||||
|
openSettings()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
|
||||||
e(FormButton, {
|
e(FormButton, {
|
||||||
layoutOrder = 2,
|
layoutOrder = 2,
|
||||||
text = "Connect",
|
text = "Connect",
|
||||||
|
|||||||
47
plugin/src/Components/SettingsPanel.lua
Normal file
47
plugin/src/Components/SettingsPanel.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
local Roact = require(script:FindFirstAncestor("Rojo").Roact)
|
||||||
|
|
||||||
|
local Plugin = script:FindFirstAncestor("Plugin")
|
||||||
|
|
||||||
|
local Theme = require(Plugin.Components.Theme)
|
||||||
|
local Panel = require(Plugin.Components.Panel)
|
||||||
|
local FitText = require(Plugin.Components.FitText)
|
||||||
|
local FormButton = require(Plugin.Components.FormButton)
|
||||||
|
|
||||||
|
local e = Roact.createElement
|
||||||
|
|
||||||
|
local SettingsPanel = Roact.Component:extend("SettingsPanel")
|
||||||
|
|
||||||
|
function SettingsPanel:render()
|
||||||
|
local back = self.props.back
|
||||||
|
|
||||||
|
return Theme.with(function(theme)
|
||||||
|
return e(Panel, nil, {
|
||||||
|
Layout = Roact.createElement("UIListLayout", {
|
||||||
|
HorizontalAlignment = Enum.HorizontalAlignment.Center,
|
||||||
|
VerticalAlignment = Enum.VerticalAlignment.Center,
|
||||||
|
SortOrder = Enum.SortOrder.LayoutOrder,
|
||||||
|
Padding = UDim.new(0, 8),
|
||||||
|
}),
|
||||||
|
|
||||||
|
Text = e(FitText, {
|
||||||
|
Padding = Vector2.new(12, 6),
|
||||||
|
Font = theme.ButtonFont,
|
||||||
|
TextSize = 18,
|
||||||
|
Text = "This will be a settings panel.",
|
||||||
|
TextColor3 = theme.Text1,
|
||||||
|
BackgroundTransparency = 1,
|
||||||
|
}),
|
||||||
|
|
||||||
|
DisconnectButton = e(FormButton, {
|
||||||
|
layoutOrder = 2,
|
||||||
|
text = "Okay",
|
||||||
|
secondary = true,
|
||||||
|
onClick = function()
|
||||||
|
back()
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
return SettingsPanel
|
||||||
Reference in New Issue
Block a user