local q=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local Q=q:WaitForChild("\077\111\100\117\108\101\115")local R=require(Q.src.utils.Logger)local j=((game:GetService("\083\116\097\114\116\101\114\080\108\097\121\101\114")):WaitForChild("\083\116\097\114\116\101\114\080\108\097\121\101\114\083\099\114\105\112\116\115")).clientSrc local E=require(Q.Roact)local x=require(Q.RoactRodux)local F=require(j.getApiFromComponent)local J=require(j.Components.common.SurfaceBillboard)local S=require(j.Components.common.DynamicTable)local k=require(j.Components.NameValueTableRow)local i=E.createElement local g=E.PureComponent:extend("\076\101\097\100\101\114\098\111\097\114\100\115\067\111\110\110\101\099\116")local X=game.Workspace:WaitForChild("\080\108\097\099\101")local L=X.Leaderboards function g.init(q)q.api=F(q)R:d("\073\110\105\116 \076\101\097\100\101\114\098\111\097\114\100\115\067\111\110\110\101\099\116")end function g.render(q)local Q={}if not L then R:w("\076\101\097\100\101\114\098\111\097\114\100\115 \102\111\108\100\101\114 \119\105\116\104 \112\108\097\099\101\104\111\108\100\101\114\115 \100\111\101\115 \110\111\116 \101\120\105\115\116\115\033")return end local j=L.placeholders:WaitForChild("\086\105\115\105\116\111\114\115\080\108\097\099\101\104\111\108\100\101\114",math.huge)local x=L.placeholders:WaitForChild("\067\111\105\110\115\080\108\097\099\101\104\111\108\100\101\114",math.huge)local F=L.placeholders:WaitForChild("\080\108\097\121\101\100\080\108\097\099\101\104\111\108\100\101\114",math.huge)Q.playedPlaceholder=i(J,{item=F,title="\077\111\115\116 \071\097\109\101\115 \070\105\110\105\115\104\101\100";[E.Children]=i(S,{items=q.props.mostPlayed;rowComponent=k,rowProps={TextColor3=Color3.fromRGB(255,255,255)}})})Q.visitorsPlaceholder=i(J,{item=j,title="\084\111\112 \086\105\115\105\116\111\114\115",[E.Children]=i(S,{items=q.props.mostVisited;rowComponent=k,rowProps={TextColor3=Color3.fromRGB(255,255,255)}})})R:w("\115\101\108\102\046\112\114\111\112\115\046\109\111\115\116\067\111\105\110\115",q.props.mostCoins)Q.coinsPlaceholder=i(J,{item=x,title="\084\111\112 \067\111\105\110\115";[E.Children]=i(S,{items=q.props.mostCoins;rowComponent=k,rowProps={TextColor3=Color3.fromRGB(255,255,255)}})})return i("\070\111\108\100\101\114",nil,Q)end g=(x.connect(function(q)return{mostVisited=q.leaderboards.mostVisited,mostCoins=q.leaderboards.mostCoins,mostPlayed=q.leaderboards.mostPlayed}end))(g)return g
--[[
	Creates Leaderboards with correct bindings with different parts
]]
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Modules = ReplicatedStorage:WaitForChild('Modules')
local logger = require(Modules.src.utils.Logger)
local clientSrc = game:GetService('StarterPlayer'):WaitForChild('StarterPlayerScripts').clientSrc

local Roact = require(Modules.Roact)
local RoactRodux = require(Modules.RoactRodux)

local getApiFromComponent = require(clientSrc.getApiFromComponent)
local SurfaceBillboard = require(clientSrc.Components.common.SurfaceBillboard)
local DynamicTable = require(clientSrc.Components.common.DynamicTable)
local NameValueTableRow = require(clientSrc.Components.NameValueTableRow)

local createElement = Roact.createElement

local LeaderboardsConnect = Roact.PureComponent:extend('LeaderboardsConnect')

local Place = game.Workspace:WaitForChild('Place')
local leaderboards = Place.Leaderboards

function LeaderboardsConnect:init()
	self.api = getApiFromComponent(self)
	logger:d('Init LeaderboardsConnect')
end

function LeaderboardsConnect:render()
	local children = {}

	if not leaderboards then
		logger:w('Leaderboards folder with placeholders does not exists!')
		return
	end

	local visitorsPlaceholder =
		leaderboards.placeholders:WaitForChild('VisitorsPlaceholder', math.huge)
	local coinsPlaceholder = leaderboards.placeholders:WaitForChild('CoinsPlaceholder', math.huge)
	local playedPlaceholder = leaderboards.placeholders:WaitForChild('PlayedPlaceholder', math.huge)

	children['playedPlaceholder'] = createElement(SurfaceBillboard, {
		item = playedPlaceholder,
		title = 'Most Games Finished',
		[Roact.Children] = createElement(DynamicTable, {
			items = self.props.mostPlayed,
			rowComponent = NameValueTableRow,
			rowProps = { TextColor3 = Color3.fromRGB(255, 255, 255) },
		}),
	})

	children['visitorsPlaceholder'] = createElement(SurfaceBillboard, {
		item = visitorsPlaceholder,
		title = 'Top Visitors',
		[Roact.Children] = createElement(DynamicTable, {
			items = self.props.mostVisited,
			rowComponent = NameValueTableRow,
			rowProps = { TextColor3 = Color3.fromRGB(255, 255, 255) },
		}),
	})

	logger:w('self.props.mostCoins', self.props.mostCoins)
	children['coinsPlaceholder'] = createElement(SurfaceBillboard, {
		item = coinsPlaceholder,
		title = 'Top Coins',
		[Roact.Children] = createElement(DynamicTable, {
			items = self.props.mostCoins,
			rowComponent = NameValueTableRow,
			rowProps = { TextColor3 = Color3.fromRGB(255, 255, 255) },
		}),
	})
	return createElement('Folder', nil, children)
end

LeaderboardsConnect = RoactRodux.connect(function(state)
	return {
		mostVisited = state.leaderboards.mostVisited,
		mostCoins = state.leaderboards.mostCoins,
		mostPlayed = state.leaderboards.mostPlayed,
	}
end)(LeaderboardsConnect)

return LeaderboardsConnect