Skip to content

Feature/improve asset panel - #235

Open
engbergandreas wants to merge 11 commits into
masterfrom
feature/improve-asset-panel
Open

Feature/improve asset panel#235
engbergandreas wants to merge 11 commits into
masterfrom
feature/improve-asset-panel

Conversation

@engbergandreas

Copy link
Copy Markdown
Member

This PR improves the asset panel load times, adds a new Topic (assettreetopic) and adds a new button to the ... menu to show the asset in Windows Explorer (should work on Linux as well, but I have not tested it).

Also in the process of updating the README so that it's clearer how to generate new topics/types and linking stuff both to the openspace-api-js repository and a new docs page (will be created)

To be used with Openspace version:

Load assets from persistent state (topic) instead of using Lua functions each time the panel is opened (~3-5x speedup)
Add "Show in explorer" for asset paths
Update `CopyToClipboardButton` for additional use-case - `Menu.Item`
# Conflicts:
#	public/locales/en/panel-assets.json
#	src/panels/AssetsPanel/AssetEntry/AssetEntryMenu.tsx
These are the same rules used in the OpenSpace-docs repository

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The asset-state type mismatch blocks type checking, and asset-tree updates can leave navigation stale.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Improves asset-panel loading by using the new asset-tree topic and centralized Redux state.

Changes:

  • Adds asset-tree subscriptions, state management, rescanning, and folder construction.
  • Adds file-explorer actions and refactors asset/copy controls.
  • Updates API dependency, documentation, localization, and formatting configuration.
File summaries
File Description
src/redux/store.ts Registers asset-tree state.
src/redux/listenerMiddleware.ts Registers asset-tree listeners.
src/redux/assettree/assetTreeSlice.ts Stores asset paths and loading states.
src/redux/assettree/assetTreeMiddleware.ts Manages topic subscriptions and rescans.
src/panels/LogPanel/ScriptLogPanel.tsx Adopts the copy-button mode API.
src/panels/AssetsPanel/util.ts Builds folder trees from paths.
src/panels/AssetsPanel/types.ts Uses generated asset-state types.
src/panels/AssetsPanel/hooks.ts Builds folders from Redux data.
src/panels/AssetsPanel/AssetsPanel.tsx Adds subscription and rescan UI.
src/panels/AssetsPanel/AssetEntry/AssetsEntry.tsx Removes the former entry implementation.
src/panels/AssetsPanel/AssetEntry/AssetLoadingStateIcon.tsx Handles generated state values.
src/panels/AssetsPanel/AssetEntry/AssetEntryMenu.tsx Adds file-explorer and updated menu actions.
src/panels/AssetsPanel/AssetEntry/AssetEntry.tsx Adds the Redux-backed entry implementation.
src/hooks/topicSubscriptions.ts Adds an asset-tree subscription hook.
src/components/Property/Types/NumericProperty.tsx Reformats value validation.
src/components/CopyToClipboardButton/CopyToClipboardButton.tsx Supports button, menu-item, and icon modes.
README.md Updates API generation and publishing guidance.
public/locales/en/panel-assets.json Adds labels for new asset actions.
package.json Updates the OpenSpace API dependency.
package-lock.json Locks the updated API package.
.prettierignore Updates excluded files.
.markdownlint.json Adds Markdown lint configuration.
Review details
  • Files reviewed: 21/22 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/redux/assettree/assetTreeSlice.ts Outdated
Comment on lines +22 to +23
const states = useAppSelector((state) => state.assetTree.states);
const assetLoadingState = states[asset.path] ?? 'Unloaded';
Comment on lines +31 to +34
const navigatedFolder = useMemo(
() => (rootFolder ? findNavigatedFolder(rootFolder, currentPath) : null),
[rootFolder, currentPath]
);
Comment thread src/redux/assettree/assetTreeMiddleware.ts
Comment thread README.md Outdated
Comment thread public/locales/en/panel-assets.json Outdated
Comment thread src/components/CopyToClipboardButton/CopyToClipboardButton.tsx Outdated

@WeirdRubberDuck WeirdRubberDuck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it :) Did some testing, but not a lot.

The only issue I ran into is that the refresh button freezes my application, as the regular loading did before. Would be nice if it was made a bit smaller or something to signal that it's not something we suggest people do frequently. See suggestions.

Also tested loading an asset in another location, and found it a bit confusing that the resulting folder looks so similar to the built-in and user assets. Would be nice to distinguish it from the actual folders somehow, maybe using another icon, if possible. Or just see suggestion on alternative folder name

Image

Comment thread src/panels/AssetsPanel/AssetEntry/AssetEntry.tsx
Comment thread src/panels/AssetsPanel/AssetEntry/AssetEntryMenu.tsx Outdated
Comment thread src/panels/AssetsPanel/AssetsPanel.tsx Outdated
Comment thread src/panels/AssetsPanel/AssetsPanel.tsx Outdated
Comment thread .markdownlint.json
Comment thread src/panels/AssetsPanel/AssetsPanel.tsx Outdated
Comment thread src/panels/AssetsPanel/AssetsPanel.tsx
Comment thread public/locales/en/panel-assets.json Outdated
Comment thread src/components/CopyToClipboardButton/CopyToClipboardButton.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants