local o=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local T=game:GetService("\080\108\097\121\101\114\115")local m=T.LocalPlayer local M=.066666666666667 local N=16 local y=o:WaitForChild("\108\105\098")local k=o:WaitForChild("\099\111\109\109\111\110")local f=script.Parent local P=k:WaitForChild("\117\116\105\108")local V=require(P:WaitForChild("\103\101\116\084\101\120\116\083\105\122\101"))local B=require(k:WaitForChild("\065\099\116\105\111\110\115"))local W=require(f:WaitForChild("\083\104\097\100\111\119\101\100\084\101\120\116\076\097\098\101\108"))local n=require(y:WaitForChild("\082\111\097\099\116"))local F=require(y:WaitForChild("\082\111\097\099\116\082\111\100\117\120"))local c=n.Component:extend("\086\101\114\115\105\111\110\076\097\098\101\108")local E=require(script:WaitForChild("\077\101\110\117\066\117\116\116\111\110"))local function z(o,T)T.menuButtonPressed(o,T)end local function i(o,T,m,M,N,y)return n.createElement(E,{viewId=o,image=T;parentProps=M,layoutOrder=N,callback=y;name=m})end function c.render(o)local T=(game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")).TouchEnabled local y={inventoryButton=i("\105\110\118\101\110\116\111\114\121","\114\098\120\097\115\115\101\116\105\100\058\047\047\054\054\054\052\052\056\056\056\051","\073\110\118\101\110\116\111\114\121",o.props,1,z),shopButton=i("\115\104\111\112","\114\098\120\097\115\115\101\116\105\100\058\047\047\052\049\048\050\057\055\054\057\053\054","\073\116\101\109 \083\104\111\112",o.props,2,z);devproductsButton=i("\100\101\118\112\114\111\100\117\099\116\115","\114\098\120\097\115\115\101\116\105\100\058\047\047\052\052\051\048\056\053\057\051\055","\082\111\098\117\120 \083\104\111\112",o.props,3,z);settingsButton=i("\115\101\116\116\105\110\103\115","\114\098\120\097\115\115\101\116\105\100\058\047\047\050\056\050\051\054\054\056\051\050","\083\101\116\116\105\110\103\115",o.props,4,z);homeButton=i("\104\111\109\101","\114\098\120\097\115\115\101\116\105\100\058\047\047\052\049\052\057\048\052\048\049\057","\082\101\115\112\097\119\110",o.props,5,function()m.Character.PrimaryPart.CFrame=(workspace:WaitForChild("\104\111\109\101\119\097\114\112")).CFrame end)}local k=64 y.scale=n.createElement("\085\073\083\099\097\108\101",{Scale=math.min(1,(o.props.viewportSize.Y*M)/k)})y.layout=n.createElement("\085\073\076\105\115\116\076\097\121\111\117\116",{Padding=UDim.new(0,N);SortOrder=Enum.SortOrder.LayoutOrder,VerticalAlignment=Enum.VerticalAlignment.Top;HorizontalAlignment=Enum.HorizontalAlignment.Center;FillDirection=Enum.FillDirection.Horizontal})return n.createElement("\070\114\097\109\101",{AnchorPoint=Vector2.new(.5,0);Size=UDim2.new(0,0,0,k),Position=UDim2.new(.5,0,0,N),BackgroundTransparency=1;BorderSizePixel=0;BackgroundColor3=Color3.fromRGB(255,255,255),ZIndex=3},y)end local function q(o)return{menuButtonPressed=function(T,m)if m.view==T then o(B.UI_VIEW_SET(nil))return end o(B.UI_VIEW_SET(T))end}end c=(F.connect(nil,q))(c)return c
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

-- scaling constants
local TARGET_SCALE = 1/15
local PADDING = 16

local lib = ReplicatedStorage:WaitForChild("lib")
local common = ReplicatedStorage:WaitForChild("common")
local component = script.Parent
local common_util = common:WaitForChild("util")

local getTextSize = require(common_util:WaitForChild("getTextSize"))

local Actions = require(common:WaitForChild("Actions"))
local ShadowedTextLabel = require(component:WaitForChild("ShadowedTextLabel"))

local Roact = require(lib:WaitForChild("Roact"))
local RoactRodux = require(lib:WaitForChild("RoactRodux"))

local SideMenu = Roact.Component:extend("VersionLabel")
local MenuButton = require(script:WaitForChild("MenuButton"))

local function changeView(viewId,props)
    props.menuButtonPressed(viewId,props)
end

local function newButton(viewId, image, name, props, layoutOrder, callback)
    return Roact.createElement(MenuButton,{
        viewId = viewId,
        image = image,
        parentProps = props,
        layoutOrder = layoutOrder,
        callback = callback,
        name = name
    })
end

function SideMenu:render()

    local touchEnabled = game:GetService("UserInputService").TouchEnabled

    local menuButtons = {
        inventoryButton = newButton("inventory", "rbxassetid://666448883", "Inventory",self.props,1,changeView),
        shopButton = newButton("shop", "rbxassetid://4102976956", "Item Shop",self.props,2,changeView),
        devproductsButton = newButton("devproducts", "rbxassetid://443085937", "Robux Shop",self.props,3,changeView),
        settingsButton = newButton("settings", "rbxassetid://282366832", "Settings",self.props,4,changeView),
        homeButton = newButton("home", "rbxassetid://414904019", "Respawn",self.props,5,(function()
            LocalPlayer.Character.PrimaryPart.CFrame = workspace:WaitForChild("homewarp").CFrame
        end))
    }

    local pixelSize = 64

    menuButtons.scale = Roact.createElement("UIScale", {
        Scale = math.min(1,(self.props.viewportSize.Y * TARGET_SCALE)/pixelSize)
    })

    menuButtons.layout = Roact.createElement("UIListLayout", {
        Padding = UDim.new(0,PADDING),
        SortOrder = Enum.SortOrder.LayoutOrder,
        VerticalAlignment = Enum.VerticalAlignment.Top,
        HorizontalAlignment = Enum.HorizontalAlignment.Center,
        FillDirection = Enum.FillDirection.Horizontal,
    })

    return Roact.createElement("Frame", {
        AnchorPoint = Vector2.new(0.5,0),
        Size = UDim2.new(0,0,0,pixelSize),
        Position = UDim2.new(0.5,0,0,PADDING),

        BackgroundTransparency = 1,
        BorderSizePixel = 0,
        BackgroundColor3 = Color3.fromRGB(255,255,255),
        ZIndex = 3
    }, menuButtons)
end

local function mapDispatchToProps(dispatch)
    return {
        menuButtonPressed = function(viewName,props)
            if props.view == viewName then
                dispatch(Actions.UI_VIEW_SET(nil))
                return
            end
            dispatch(Actions.UI_VIEW_SET(viewName))
        end
    }
end

SideMenu = RoactRodux.connect(nil,mapDispatchToProps)(SideMenu)

return SideMenu