Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add changing toolbar icon to indicate state #538

Merged
merged 6 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
* Added support for optional paths in project files. ([#472])
* Added support for the new Open Cloud API when uploading. ([#504])
* Added `sourcemap` command for generating sourcemaps to feed into other tools. ([#530])
* Added changing toolbar icon to indicate state ([#538])

[#472]: https://github.com/rojo-rbx/rojo/pull/472
[#504]: https://github.com/rojo-rbx/rojo/pull/504
[#507]: https://github.com/rojo-rbx/rojo/pull/507
[#530]: https://github.com/rojo-rbx/rojo/pull/530
[#538]: https://github.com/rojo-rbx/rojo/pull/538

## [7.0.0] - December 10, 2021
* Fixed Rojo's interactions with properties enabled by FFlags that are not yet enabled. ([#493])
Expand Down Expand Up @@ -96,7 +98,7 @@ The shorthand property format that most users use is not impacted. For reference
## [7.0.0-alpha.4][7.0.0-alpha.4] (May 5, 2021)
* Added the `gameId` and `placeId` optional properties to project files.
* When connecting from the Rojo Roblox Studio plugin, Rojo will set the game and place ID of the current place to these values, if set.
* This is equivalent to running `game:SetUniverseId(...)` and `game:SetPlaceId(...)` from the command bar in Studio.
* This is equivalent to running `game:SetUniverseId(...)` and `game:SetPlaceId(...)` from the command bar in Studio.
* Added "EXPERIMENTAL!" label to two-way sync toggle in Rojo's Roblox Studio plugin.
* Fixed `Name` and `Parent` properties being allowed in Rojo projects. ([#413][pr-413])
* Fixed "Open Scripts Externally" feature crashing Studio. ([#369][issue-369])
Expand Down Expand Up @@ -484,4 +486,4 @@ This is a general maintenance release for the Rojo 0.5.x release series.
* More robust syncing with a new reconciler

## [0.1.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.1.0) (November 29, 2017)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)
Binary file added assets/icon-link-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-warn-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion plugin/src/App/Components/Studio/StudioToggleButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function StudioToggleButton:didUpdate(lastProps)
self.button.Enabled = self.props.enabled
end

if self.props.icon ~= lastProps.icon then
self.button.Icon = self.props.icon
end

if self.props.active ~= lastProps.active then
self.button:SetActive(self.props.active)
end
Expand All @@ -63,4 +67,4 @@ local function StudioToggleButtonWrapper(props)
})
end

return StudioToggleButtonWrapper
return StudioToggleButtonWrapper
10 changes: 8 additions & 2 deletions plugin/src/App/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function App:init()
self:setState({
appStatus = AppStatus.NotConnected,
guiEnabled = false,
toolbarIcon = Assets.Images.PluginButton,
})
end

Expand All @@ -57,13 +58,15 @@ function App:startSession(host, port, sessionOptions)
if status == ServeSession.Status.Connecting then
self:setState({
appStatus = AppStatus.Connecting,
toolbarIcon = Assets.Images.PluginButton,
})
elseif status == ServeSession.Status.Connected then
local address = ("%s:%s"):format(host, port)
self:setState({
appStatus = AppStatus.Connected,
projectName = details,
address = address,
toolbarIcon = Assets.Images.PluginButtonConnected,
})
elseif status == ServeSession.Status.Disconnected then
self.serveSession = nil
Expand All @@ -76,10 +79,12 @@ function App:startSession(host, port, sessionOptions)
self:setState({
appStatus = AppStatus.Error,
errorMessage = tostring(details),
toolbarIcon = Assets.Images.PluginButtonWarning,
})
else
self:setState({
appStatus = AppStatus.NotConnected,
toolbarIcon = Assets.Images.PluginButton,
})
end
end
Expand Down Expand Up @@ -186,6 +191,7 @@ function App:render()
onClose = function()
self:setState({
appStatus = AppStatus.NotConnected,
toolbarIcon = Assets.Images.PluginButton,
})
end,
}),
Expand All @@ -206,7 +212,7 @@ function App:render()
button = e(StudioToggleButton, {
name = "Rojo",
tooltip = "Show or hide the Rojo panel",
icon = Assets.Images.PluginButton,
icon = self.state.toolbarIcon,
active = self.state.guiEnabled,
enabled = true,
onClick = function()
Expand All @@ -223,4 +229,4 @@ function App:render()
})
end

return App
return App
2 changes: 2 additions & 0 deletions plugin/src/Assets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ local Assets = {
Images = {
Logo = "rbxassetid://5990772764",
PluginButton = "rbxassetid://3405341609",
PluginButtonConnected = "rbxassetid://9529783993",
PluginButtonWarning = "rbxassetid://9529784530",
Icons = {
Close = "rbxassetid://6012985953",
Back = "rbxassetid://6017213752",
Expand Down