Add permission management listings

This commit is contained in:
boatbomber 2023-01-04 18:20:57 -05:00
parent 4275783ba4
commit 7c1afd5aa9
5 changed files with 256 additions and 0 deletions

View file

@ -11,6 +11,7 @@ local Theme = require(Plugin.App.Theme)
local IconButton = require(Plugin.App.Components.IconButton)
local ScrollingFrame = require(Plugin.App.Components.ScrollingFrame)
local Tooltip = require(Plugin.App.Components.Tooltip)
local Listing = require(script.Listing)
local e = Roact.createElement
@ -64,6 +65,42 @@ function PermissionsPage:render()
return Theme.with(function(theme)
theme = theme.Settings
local sources = {}
if next(self.props.headlessAPI._permissions) == nil then
sources.noSources = e("TextLabel", {
Text = "No third-party plugins have been granted permissions.",
Font = Enum.Font.Gotham,
TextSize = 18,
TextColor3 = theme.Setting.DescriptionColor,
TextTransparency = self.props.transparency,
TextWrapped = true,
Size = UDim2.new(1, 0, 0, 48),
LayoutOrder = 0,
BackgroundTransparency = 1,
})
else
for source in self.props.headlessAPI._permissions do
local meta = self.props.headlessAPI:_getMetaFromSource(source)
sources[source] = e(Listing, {
layoutOrder = string.byte(source),
transparency = self.props.transparency,
name = meta.Name,
description = string.format(
"%s plugin%s",
meta.Type,
if meta.Creator then " by " .. meta.Creator else ""
),
onClick = function()
self.props.onEdit(source, meta, self.props.headlessAPI._permissions[source] or {})
end,
})
end
end
return e(ScrollingFrame, {
size = UDim2.new(1, 0, 1, 0),
contentSize = self.contentSize,
@ -84,6 +121,8 @@ function PermissionsPage:render()
end,
}),
Sources = Roact.createFragment(sources),
Padding = e("UIPadding", {
PaddingLeft = UDim.new(0, 20),
PaddingRight = UDim.new(0, 20),