mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
* Create plugin action component * Add plugin action for session start/end * Add output for connection status change * Move host & port refs to App level so keybind can access them * Use passed function directly * Improve the action text clarity * Add actions for single action * Add to changelog * Explicitly return nil Co-authored-by: Lucien Greathouse <me@lpghatguy.com> * Change log level to info * Refactor startSession to contain the logic * Formatting Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
41 lines
978 B
Lua
41 lines
978 B
Lua
local Rojo = script:FindFirstAncestor("Rojo")
|
|
local Plugin = Rojo.Plugin
|
|
|
|
local Roact = require(Rojo.Roact)
|
|
|
|
local Dictionary = require(Plugin.Dictionary)
|
|
|
|
local StudioPluginContext = require(script.Parent.StudioPluginContext)
|
|
|
|
local e = Roact.createElement
|
|
|
|
local StudioPluginAction = Roact.Component:extend("StudioPluginAction")
|
|
|
|
function StudioPluginAction:init()
|
|
self.pluginAction = self.props.plugin:CreatePluginAction(
|
|
self.props.name, self.props.title, self.props.description, self.props.icon, self.props.bindable
|
|
)
|
|
|
|
self.pluginAction.Triggered:Connect(self.props.onTriggered)
|
|
end
|
|
|
|
function StudioPluginAction:render()
|
|
return nil
|
|
end
|
|
|
|
function StudioPluginAction:willUnmount()
|
|
self.pluginAction:Destroy()
|
|
end
|
|
|
|
local function StudioPluginActionWrapper(props)
|
|
return e(StudioPluginContext.Consumer, {
|
|
render = function(plugin)
|
|
return e(StudioPluginAction, Dictionary.merge(props, {
|
|
plugin = plugin,
|
|
}))
|
|
end,
|
|
})
|
|
end
|
|
|
|
return StudioPluginActionWrapper
|