mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-21 13:15:50 +00:00
Stylua formatting (#785)
Uses Stylua to format all existing Lua files, and adds a CI check in `lint` to pin this improvement. Excludes formatting dependencies, of course.
This commit is contained in:
@@ -85,7 +85,7 @@ function ConfirmingPage:render()
|
||||
onClick = self.props.onAbort,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Stop the connection process"
|
||||
text = "Stop the connection process",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -98,7 +98,7 @@ function ConfirmingPage:render()
|
||||
onClick = self.props.onReject,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Push Studio changes to the Rojo server"
|
||||
text = "Push Studio changes to the Rojo server",
|
||||
}),
|
||||
})
|
||||
else nil,
|
||||
@@ -111,7 +111,7 @@ function ConfirmingPage:render()
|
||||
onClick = self.props.onAccept,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Pull Rojo server changes to Studio"
|
||||
text = "Pull Rojo server changes to Studio",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -169,7 +169,7 @@ function ConfirmingPage:render()
|
||||
|
||||
oldText = self.state.oldSource,
|
||||
newText = self.state.newSource,
|
||||
})
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -21,7 +21,17 @@ local StringDiffVisualizer = require(Plugin.App.Components.StringDiffVisualizer)
|
||||
|
||||
local e = Roact.createElement
|
||||
|
||||
local AGE_UNITS = { {31556909, "year"}, {2629743, "month"}, {604800, "week"}, {86400, "day"}, {3600, "hour"}, {60, "minute"}, }
|
||||
local AGE_UNITS = {
|
||||
{ 31556909, "year" },
|
||||
{ 2629743, "month" },
|
||||
{ 604800, "week" },
|
||||
{ 86400, "day" },
|
||||
{ 3600, "hour" },
|
||||
{
|
||||
60,
|
||||
"minute",
|
||||
},
|
||||
}
|
||||
function timeSinceText(elapsed: number): string
|
||||
if elapsed < 3 then
|
||||
return "just now"
|
||||
@@ -159,16 +169,15 @@ function ConnectedPage:getChangeInfoText()
|
||||
local elapsed = os.time() - patchData.timestamp
|
||||
local unapplied = PatchSet.countChanges(patchData.unapplied)
|
||||
|
||||
return
|
||||
"<i>Synced "
|
||||
return "<i>Synced "
|
||||
.. timeSinceText(elapsed)
|
||||
.. (if unapplied > 0 then
|
||||
string.format(
|
||||
", <font color=\"#FF8E3C\">but %d change%s failed to apply</font>",
|
||||
.. (if unapplied > 0
|
||||
then string.format(
|
||||
', <font color="#FF8E3C">but %d change%s failed to apply</font>',
|
||||
unapplied,
|
||||
unapplied == 1 and "" or "s"
|
||||
)
|
||||
else "")
|
||||
else "")
|
||||
.. "</i>"
|
||||
end
|
||||
|
||||
@@ -297,7 +306,7 @@ function ConnectedPage:render()
|
||||
onClick = self.props.onNavigateSettings,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "View and modify plugin settings"
|
||||
text = "View and modify plugin settings",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -309,7 +318,7 @@ function ConnectedPage:render()
|
||||
onClick = self.props.onDisconnect,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Disconnect from the Rojo sync server"
|
||||
text = "Disconnect from the Rojo sync server",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -427,7 +436,7 @@ function ConnectedPage:render()
|
||||
|
||||
oldText = self.state.oldSource,
|
||||
newText = self.state.newSource,
|
||||
})
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -50,7 +50,9 @@ function Error:render()
|
||||
local containerSize = object.AbsoluteSize - ERROR_PADDING * 2
|
||||
|
||||
local textBounds = TextService:GetTextSize(
|
||||
self.props.errorMessage, 16, Enum.Font.Code,
|
||||
self.props.errorMessage,
|
||||
16,
|
||||
Enum.Font.Code,
|
||||
Vector2.new(containerSize.X, math.huge)
|
||||
)
|
||||
|
||||
@@ -60,12 +62,13 @@ function Error:render()
|
||||
ErrorMessage = Theme.with(function(theme)
|
||||
return e("TextBox", {
|
||||
[Roact.Event.InputBegan] = function(rbx, input)
|
||||
if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end
|
||||
if input.UserInputType ~= Enum.UserInputType.MouseButton1 then
|
||||
return
|
||||
end
|
||||
rbx.SelectionStart = 0
|
||||
rbx.CursorPosition = #rbx.Text+1
|
||||
rbx.CursorPosition = #rbx.Text + 1
|
||||
end,
|
||||
|
||||
|
||||
Text = self.props.errorMessage,
|
||||
TextEditable = false,
|
||||
Font = Enum.Font.Code,
|
||||
@@ -126,7 +129,7 @@ function ErrorPage:render()
|
||||
onClick = self.props.onClose,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Dismiss message"
|
||||
text = "Dismiss message",
|
||||
}),
|
||||
}),
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ local function AddressEntry(props)
|
||||
if props.onHostChange ~= nil then
|
||||
props.onHostChange(object.Text)
|
||||
end
|
||||
end
|
||||
end,
|
||||
}),
|
||||
|
||||
Port = e("TextBox", {
|
||||
@@ -120,7 +120,7 @@ function NotConnectedPage:render()
|
||||
onClick = self.props.onNavigateSettings,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "View and modify plugin settings"
|
||||
text = "View and modify plugin settings",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -132,7 +132,7 @@ function NotConnectedPage:render()
|
||||
onClick = self.props.onConnect,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Connect to a Rojo sync server"
|
||||
text = "Connect to a Rojo sync server",
|
||||
}),
|
||||
}),
|
||||
|
||||
|
||||
@@ -81,40 +81,39 @@ function Setting:render()
|
||||
end,
|
||||
}),
|
||||
|
||||
Input =
|
||||
if self.props.input ~= nil then
|
||||
self.props.input
|
||||
elseif self.props.options ~= nil then
|
||||
e(Dropdown, {
|
||||
locked = self.props.locked,
|
||||
options = self.props.options,
|
||||
active = self.state.setting,
|
||||
transparency = self.props.transparency,
|
||||
onClick = function(option)
|
||||
Settings:set(self.props.id, option)
|
||||
end,
|
||||
})
|
||||
else
|
||||
e(Checkbox, {
|
||||
locked = self.props.locked,
|
||||
active = self.state.setting,
|
||||
transparency = self.props.transparency,
|
||||
onClick = function()
|
||||
local currentValue = Settings:get(self.props.id)
|
||||
Settings:set(self.props.id, not currentValue)
|
||||
end,
|
||||
}),
|
||||
Input = if self.props.input ~= nil
|
||||
then self.props.input
|
||||
elseif self.props.options ~= nil then e(Dropdown, {
|
||||
locked = self.props.locked,
|
||||
options = self.props.options,
|
||||
active = self.state.setting,
|
||||
transparency = self.props.transparency,
|
||||
onClick = function(option)
|
||||
Settings:set(self.props.id, option)
|
||||
end,
|
||||
})
|
||||
else e(Checkbox, {
|
||||
locked = self.props.locked,
|
||||
active = self.state.setting,
|
||||
transparency = self.props.transparency,
|
||||
onClick = function()
|
||||
local currentValue = Settings:get(self.props.id)
|
||||
Settings:set(self.props.id, not currentValue)
|
||||
end,
|
||||
}),
|
||||
|
||||
Reset = if self.props.onReset then e(IconButton, {
|
||||
icon = Assets.Images.Icons.Reset,
|
||||
iconSize = 24,
|
||||
color = theme.BackButtonColor,
|
||||
transparency = self.props.transparency,
|
||||
visible = self.props.showReset,
|
||||
layoutOrder = -1,
|
||||
Reset = if self.props.onReset
|
||||
then e(IconButton, {
|
||||
icon = Assets.Images.Icons.Reset,
|
||||
iconSize = 24,
|
||||
color = theme.BackButtonColor,
|
||||
transparency = self.props.transparency,
|
||||
visible = self.props.showReset,
|
||||
layoutOrder = -1,
|
||||
|
||||
onClick = self.props.onReset,
|
||||
}) else nil,
|
||||
onClick = self.props.onReset,
|
||||
})
|
||||
else nil,
|
||||
}),
|
||||
|
||||
Text = e("Frame", {
|
||||
@@ -122,7 +121,8 @@ function Setting:render()
|
||||
BackgroundTransparency = 1,
|
||||
}, {
|
||||
Name = e("TextLabel", {
|
||||
Text = (if self.props.experimental then "<font color=\"#FF8E3C\">⚠ </font>" else "") .. self.props.name,
|
||||
Text = (if self.props.experimental then '<font color="#FF8E3C">⚠ </font>' else "")
|
||||
.. self.props.name,
|
||||
Font = Enum.Font.GothamBold,
|
||||
TextSize = 17,
|
||||
TextColor3 = theme.Setting.NameColor,
|
||||
@@ -137,7 +137,8 @@ function Setting:render()
|
||||
}),
|
||||
|
||||
Description = e("TextLabel", {
|
||||
Text = (if self.props.experimental then "<font color=\"#FF8E3C\">[Experimental] </font>" else "") .. self.props.description,
|
||||
Text = (if self.props.experimental then '<font color="#FF8E3C">[Experimental] </font>' else "")
|
||||
.. self.props.description,
|
||||
Font = Enum.Font.Gotham,
|
||||
LineHeight = 1.2,
|
||||
TextSize = 14,
|
||||
@@ -151,10 +152,14 @@ function Setting:render()
|
||||
containerSize = self.containerSize,
|
||||
inputSize = self.inputSize,
|
||||
}):map(function(values)
|
||||
local desc = (if self.props.experimental then "[Experimental] " else "") .. self.props.description
|
||||
local desc = (if self.props.experimental then "[Experimental] " else "")
|
||||
.. self.props.description
|
||||
local offset = values.inputSize.X + 5
|
||||
local textBounds = getTextBounds(
|
||||
desc, 14, Enum.Font.Gotham, 1.2,
|
||||
desc,
|
||||
14,
|
||||
Enum.Font.Gotham,
|
||||
1.2,
|
||||
Vector2.new(values.containerSize.X - offset, math.huge)
|
||||
)
|
||||
return UDim2.new(1, -offset, 0, textBounds.Y)
|
||||
|
||||
@@ -49,7 +49,7 @@ local function Navbar(props)
|
||||
onClick = props.onBack,
|
||||
}, {
|
||||
Tip = e(Tooltip.Trigger, {
|
||||
text = "Back"
|
||||
text = "Back",
|
||||
}),
|
||||
}),
|
||||
|
||||
@@ -63,7 +63,7 @@ local function Navbar(props)
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
|
||||
BackgroundTransparency = 1,
|
||||
})
|
||||
}),
|
||||
})
|
||||
end)
|
||||
end
|
||||
@@ -138,7 +138,10 @@ function SettingsPage:render()
|
||||
Settings:set("largeChangesConfirmationThreshold", math.clamp(number, 1, 999))
|
||||
else
|
||||
-- Force text back to last valid value
|
||||
Settings:set("largeChangesConfirmationThreshold", Settings:get("largeChangesConfirmationThreshold"))
|
||||
Settings:set(
|
||||
"largeChangesConfirmationThreshold",
|
||||
Settings:get("largeChangesConfirmationThreshold")
|
||||
)
|
||||
end
|
||||
end,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user