local A=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local p=A:WaitForChild("\077\111\100\117\108\101\115")local f=require(p.Roact)local R=((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 u=require(R.Components.common.TextLabel)local K=f.createElement local d=4 local i=40 local function g(A)local p=A.items local f={}for A,p in pairs(p)do table.insert(f,p)end table.sort(f,function(A,p)return A.name<p.name end)local R={}R.Layout=K("\085\073\076\105\115\116\076\097\121\111\117\116",{SortOrder=Enum.SortOrder.LayoutOrder})for A,p in ipairs(f)do local f=K(u,{Text=p.name,TextColor3=Color3.new(.9,.9,.9);TextSize=32;Size=UDim2.new(1,-d*2,1,-d*2),Position=UDim2.new(0,d,0,d);Font=Enum.Font.SourceSans;BorderSizePixel=0})local g=K("\070\114\097\109\101",{Size=UDim2.new(1,0,0,i),LayoutOrder=A},{Inner=f})R[p.id]=g end return K("\083\099\114\111\108\108\105\110\103\070\114\097\109\101",{Size=UDim2.new(1,0,1,0),BackgroundColor3=Color3.new(0,0,0);BackgroundTransparency=1;BorderSizePixel=0;CanvasSize=UDim2.new(1,0,0,i*#f);LayoutOrder=100},R)end return g
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Modules = ReplicatedStorage:WaitForChild('Modules')
-- local logger = require(Modules.src.utils.Logger)

local Roact = require(Modules.Roact)
local clientSrc = game:GetService('StarterPlayer'):WaitForChild('StarterPlayerScripts').clientSrc
local TextLabel = require(clientSrc.Components.common.TextLabel)

local createElement = Roact.createElement

local ITEM_PADDING = 4
local ITEM_HEIGHT = 40

local function TextList(props)
	local items = props.items

	-- The order that items appear must be deterministic, so we create a list!
	local itemList = {}

	for _, item in pairs(items) do
		table.insert(itemList, item)
	end

	table.sort(itemList, function(a, b)
		return a.name < b.name
	end)

	-- It's easy to dynamically build up children in Roact since the description
	-- of our UI is just a function returning objects.
	local children = {}

	children.Layout = createElement('UIListLayout', { SortOrder = Enum.SortOrder.LayoutOrder })

	for index, item in ipairs(itemList) do
		local playerName = createElement(TextLabel, {
			Text = item.name,
			TextColor3 = Color3.new(0.9, 0.9, 0.9),
			TextSize = 32,
			Size = UDim2.new(1, -ITEM_PADDING * 2, 1, -ITEM_PADDING * 2),
			Position = UDim2.new(0, ITEM_PADDING, 0, ITEM_PADDING),
			Font = Enum.Font.SourceSans,
			BorderSizePixel = 0,
		})
		local slot = createElement(
			'Frame',
			{
				Size = UDim2.new(1, 0, 0, ITEM_HEIGHT),
				LayoutOrder = index,
			},
			{ Inner = playerName }
		)

		children[item.id] = slot
	end

	return createElement(
		'ScrollingFrame',
		{
			Size = UDim2.new(1, 0, 1, 0),
			BackgroundColor3 = Color3.new(0, 0, 0),
			BackgroundTransparency = 1,
			BorderSizePixel = 0,
			CanvasSize = UDim2.new(1, 0, 0, ITEM_HEIGHT * #itemList),
			LayoutOrder = 100,
		},
		children
	)
end

return TextList