local h=script.Parent.Parent local z=require(h.Vendor.Roact)local r=require(h.Vendor.StudioComponents)local k=r.Widget local P=require(h.Components.App)local x=z.Component:extend("\077\097\105\110\080\108\117\103\105\110")function x.init(h)h:setEnabled(false)end function x.setEnabled(z,h)z:setState({Enabled=h})z.props.Button:SetActive(h)z.props.OnEnabled(h)end function x.didMount(h)h.buttonClicked=h.props.Button.Click:Connect(function()h:setEnabled(not h.state.Enabled)end)end function x.willUnmount(h)h.buttonClicked:Disconnect()end function x.render(h)return h.state.Enabled and z.createElement(k,{Id="\108\097\121\101\114\115\087\105\100\103\101\116",Name="\108\097\121\101\114\115\087\105\100\103\101\116",Title="\076\097\121\101\114\115",InitialDockState=Enum.InitialDockState.Float,MinimumWindowSize=Vector2.new(300,200);OnClosed=function()h:setEnabled(false)end},{App=z.createElement(P,{Actions=h.props.Actions})})end return x
local Plugin = script.Parent.Parent

local Roact = require(Plugin.Vendor.Roact)
local StudioComponents = require(Plugin.Vendor.StudioComponents)

local Widget = StudioComponents.Widget
local App = require(Plugin.Components.App)

local MainPlugin = Roact.Component:extend("MainPlugin")

function MainPlugin:init()
	self:setEnabled(false)
end

function MainPlugin:setEnabled(enabled)
	self:setState({ Enabled = enabled })
	self.props.Button:SetActive(enabled)
	self.props.OnEnabled(enabled)
end

function MainPlugin:didMount()
	self.buttonClicked = self.props.Button.Click:Connect(function()
		self:setEnabled(not self.state.Enabled)
	end)
end

function MainPlugin:willUnmount()
	self.buttonClicked:Disconnect()
end

function MainPlugin:render()
	return self.state.Enabled and Roact.createElement(Widget, {
		Id = "layersWidget",
		Name = "layersWidget",
		Title = "Layers",
		InitialDockState = Enum.InitialDockState.Float,
		MinimumWindowSize = Vector2.new(300, 200),
		OnClosed = function()
			self:setEnabled(false)
		end,
	}, {
		App = Roact.createElement(App, {
			Actions = self.props.Actions
		}),
	})
end

return MainPlugin