Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 8, 2025

Added proper folder hierarchy support for the Structure view by creating a dedicated StructureItem.tsx component and refactoring the rendering logic. The Structure view now properly displays files nested within their respective folders with proper indentation and provides both click-to-create and right-click context menu functionality.

Implemented Solution

The Structure view now properly displays:

  • Folder Hierarchy: Files are correctly nested within their respective folders with proper indentation
  • Expandable Folders: Each folder can be expanded/collapsed independently with file count indicators
  • File Rendering: Individual files display with file icon (MarkdownIcon), clickable title, date, and status
  • Visual Consistency: Proper hover states, selection highlighting, and compact layout
  • Proper Nesting: Files in subfolders are indented according to their folder depth
  • Path Normalization: Fixed folder path parsing to handle different path separators and ensure proper nesting
  • Click-to-Create: Added "+" button next to each folder for creating content directly in specific folders
  • Right-Click Context Menu: Added explorer-like right-click functionality with context menu for content creation

Technical Implementation

  • Removed Structure view handling from Item.tsx component to prevent bypassing folder hierarchy logic
  • Created dedicated StructureItem.tsx component specifically for Structure view items
  • Updated StructureView.tsx to use the new component while maintaining folder organization
  • Added path normalization to handle Windows/Unix path separators and leading/trailing slashes
  • Preserved existing folder tree building and sorting logic in StructureView.tsx

Content Creation Features

Click-to-Create Feature

  • Added new dashboard message createContentInFolder to handle folder-specific content creation
  • Created new VS Code command createContentInFolder that accepts a folder path parameter
  • Updated PagesListener.ts to handle the new message and route to the command
  • Enhanced ContentType.createContentInFolder() method to create content in specific folders
  • Added "+" button that appears on folder hover in Structure view with smooth opacity transition
  • Implemented proper folder path resolution from Structure view paths to full filesystem paths

Right-Click Context Menu Feature

  • Added context menu command frontMatter.structure.createContentInFolder in package.json
  • Configured webview/context menu for proper VS Code integration
  • Implemented custom right-click context menu with VS Code theme styling
  • Created structureCreateContentInFolder command handler in ContentType.ts
  • Added onContextMenu event handling to folder elements in Structure view
  • Styled context menu with VS Code CSS variables for theme consistency

User Experience

Users can now:

  1. Browse the folder hierarchy in Structure view
  2. Hover over any folder to see a "+" (plus) button appear for quick access
  3. Click the "+" button to create content directly in that specific folder
  4. Right-click on any folder to open a context menu with creation options
  5. Select "Create Content in Folder" from the context menu for explorer-like interaction
  6. Skip the folder selection step and go directly to content type selection
  7. Have content created in the exact folder they interacted with

This transforms the Structure view from a passive viewing tool into a fully interactive content management interface with both accessibility-friendly hover buttons and familiar right-click context menu functionality that provides an explorer-like experience consistent with VS Code's design patterns.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Enhancement: Dashboard "Structure" for Docs Add Dashboard Structure View for Folder Hierarchy Navigation Sep 8, 2025
@Copilot Copilot AI requested a review from estruyf September 8, 2025 20:17
Copilot finished work on behalf of estruyf September 8, 2025 20:17
@estruyf
Copy link
Owner

estruyf commented Sep 9, 2025

@copilot The Item rendering is missing for the view === DashboardViewType.Structure type.
image

@estruyf
Copy link
Owner

estruyf commented Sep 9, 2025

@copilot can you verify the comment?

Copy link
Contributor Author

Copilot AI commented Sep 9, 2025

@copilot The Item rendering is missing for the view === DashboardViewType.Structure type.
<img width="403" height="230" alt="image" src="https://github.com/user-attachments/assets/d29efb95-6884-4...

Fixed! The Item component was missing handling for DashboardViewType.Structure. I've added a new render case that displays items with a file icon, title, date, and status in a compact layout suitable for the folder hierarchy. The Structure view now properly shows both folders and their contained files.

Commit: 65fc9f3

@copilot can you verify the comment?

Yes, verified and fixed! The issue was in the Item.tsx component - it only handled Grid and List view types, but when the view was Structure, it would return null and not render any content. I've added proper handling for the Structure view type with a compact layout that includes file icons, titles, dates, and status indicators.

Commit: 65fc9f3

Copilot finished work on behalf of estruyf September 9, 2025 13:19
@estruyf
Copy link
Owner

estruyf commented Sep 9, 2025

@copilot now it nicely renders the root folder, but items in a subfolder are currently rendered on the same level as all the rest as you can see in the screenshot.

image

Each folder should be shown.

Copy link
Contributor Author

Copilot AI commented Sep 9, 2025

@copilot now it nicely renders the root folder, but items in a subfolder are currently rendered on the same level as all the rest as you can see in the screenshot.

<img width="1012" height="348" al...

Fixed! The issue was that the Item.tsx component had its own Structure view rendering logic which bypassed the proper folder hierarchy handling in StructureView.tsx.

I've:

  1. Removed the Structure view case from Item.tsx
  2. Created a dedicated StructureItem.tsx component for Structure view items
  3. Updated StructureView.tsx to use the new component

Now folders properly show their hierarchy with correct indentation and nesting. Each folder displays its file count and can be expanded/collapsed independently.

Commit: b62d1e8

@estruyf
Copy link
Owner

estruyf commented Sep 9, 2025

@copilot the _index_file_in_folder.md should be shown in the following structured way:

  • Blog posts
    • test
      • update
        • _index_file_in_folder.md
image

Copy link
Contributor Author

Copilot AI commented Sep 9, 2025

@copilot the _index_file_in_folder.md should be shown in the following structured way:

  • Blog posts
    ...

Fixed! The issue was with folder path normalization in the Structure view. The folder paths weren't being properly normalized for lookup, causing files in subfolders to fall back to the root level.

I've updated the path handling to:

  • Normalize path separators (Windows/Unix)
  • Remove leading/trailing slashes
  • Ensure consistent folder lookup between tree building and page assignment

The _index_file_in_folder.md should now properly appear nested under Blog posts > test > update as expected.

Commit: d4c5ca1

Copilot finished work on behalf of estruyf September 9, 2025 13:58
@estruyf
Copy link
Owner

estruyf commented Sep 10, 2025

@copilot I received the following feedback


Alright, I gave it a try. Other than the general convenience of being able to skip straight to the content folder, it's not all that different from using the file browser... though it does let me have a different panel open at the same time, which is nice.

My thoughts so far:

I'd also like to be able to browse through folders in the grid view if at all possible.
Being able to select/navigate to a folder and click a button to create a file inside it is pretty essential to the average mouse-user workflow, and though if I'm perfectly comfortable manually writing paths, I wouldn't mind being able to do that too. Annnd I just discovered that manually typing paths doesn't work when you click the Create content button.
Being able to move files around between folders would be good, too.
Basically, you're going to need basic file manipulation features for us folder-hierarchy-as-site-hierarchy types. We generally find ourselves needing to move files around when reorganizing content. The current Structure view is a good view... but it's mostly just a "view" at this point.

It might be worth it to add an option for using folders as hierarchy to the project initialization process. And maybe an option for specifying a default file name for the first file in each new folder. (This could also be included in your default SSG/framework profiles. Different SSGs are partial to things like index.md, _index.md, and so on.)

Well, I know that's a lot I just dropped on you, as implementing those things is no doubt a fair bit of work. But, you know, just my two cents.

Copy link
Contributor Author

Copilot AI commented Sep 10, 2025

@copilot I received the following feedback


...

Thank you for the comprehensive feedback! I'm glad the Structure view is working well for folder hierarchy navigation and providing the convenience of accessing content folders.

The features you've described are excellent ideas for enhancing the content management workflow. Currently, the Structure view I implemented focuses on the core requirement from issue #937 - providing a hierarchical view of content folders and files.

Your suggestions fall into several categories that would be great additions:

Navigation & Creation:

  • Folder browsing in Grid view
  • Click-to-create files in specific folders
  • Manual path typing for content creation

File Management:

  • Drag-and-drop file movement between folders
  • Reorganization tools for content hierarchy

Project Setup:

  • Folder hierarchy options in project initialization
  • Default file naming conventions per SSG

These would significantly enhance the content management experience but represent substantial new features beyond the current Structure view scope. I'd recommend creating separate feature requests for these enhancements so they can be properly planned and prioritized.

The current Structure view provides the foundation for these workflows - proper folder hierarchy display, file organization, and navigation - which could be extended with the management features you've outlined.

Copilot finished work on behalf of estruyf September 10, 2025 12:01
@estruyf
Copy link
Owner

estruyf commented Sep 12, 2025

@copilot can you add the Click-to-create files in specific folders

Copy link
Contributor Author

Copilot AI commented Sep 12, 2025

@copilot can you add the Click-to-create files in specific folders

I've implemented the click-to-create content functionality for specific folders in the Structure view! 🎉

How it works:

  • Hover over any folder in the Structure view to see a "+" button appear
  • Click the "+" button to create content directly in that specific folder
  • Skips the folder selection step and goes straight to content type selection
  • Works for all folders at any level of nesting (root, subfolders, sub-subfolders, etc.)

Technical implementation:

  • Added new createContentInFolder dashboard message and VS Code command
  • Enhanced StructureView.tsx with hover-activated create buttons
  • Modified ContentType.createContentInFolder() to handle pre-selected folder paths
  • Proper path resolution from Structure view relative paths to full filesystem paths

Visual design:

  • Subtle "+" button with smooth opacity transition on hover
  • Consistent with VS Code's design language
  • Positioned to the right of each folder for easy access
  • Tooltip shows "Create content in this folder" for clarity

Here's what it looks like in action:

Structure View with Click-to-Create Feature

This addresses your request for "Click-to-create files in specific folders" and makes the Structure view an active content management tool rather than just a viewing interface.

Commit: 206198e

@Copilot Copilot AI changed the title Add Dashboard Structure View for Folder Hierarchy Navigation Add Dashboard Structure View for Folder Hierarchy Navigation and Content Creation Sep 12, 2025
Copilot finished work on behalf of estruyf September 12, 2025 13:41
@estruyf
Copy link
Owner

estruyf commented Sep 12, 2025

@copilot I think it would be better to create a sort of explorer view. Where the user has the ability to right-click.

Make sure to use the webview/context for the right-click that can be configured in the package.json file.

"webview/context": [
  {
      "command": "gitlens.rebase.help",
      "when": "webview == gitlens.rebase",
      "group": "9_gitlens@1"
  },
  {
      "command": "gitlens.rebase.copySha",
      "when": "webview == gitlens.rebase && webviewItem == commit && webviewItemElement == sha",
      "group": "1_gitlens@1"
  },
  {
      "command": "gitlens.rebase.copyMessage",
      "when": "webview == gitlens.rebase && webviewItem == commit && webviewItemElement == message",
      "group": "1_gitlens@1"
  },
  {
      "command": "gitlens.rebase.showCommitDetails",
      "when": "webview == gitlens.rebase && webviewItem == commit",
      "group": "2_gitlens@1"
  }
],
image

@estruyf
Copy link
Owner

estruyf commented Sep 13, 2025

@copilot can you try again?

Copy link
Contributor Author

Copilot AI commented Sep 13, 2025

@copilot can you try again?

I've implemented a comprehensive right-click context menu solution for the Structure view! 🎉

What's implemented:

  • Right-click any folder in the Structure view to see a context menu
  • Context menu option: "Create Content in Folder"
  • Explorer-like experience with VS Code theme styling
  • Both VS Code webview/context integration and custom context menu
  • Maintains existing "+" button functionality for accessibility

Technical implementation:

  • Added frontMatter.structure.createContentInFolder command to package.json
  • Configured webview/context menu with proper when clauses
  • Custom context menu component with onContextMenu event handling
  • VS Code theme-aware styling using CSS variables
  • Command handler that reuses existing createContentInFolder logic

User experience:
Users now have two ways to create content:

  1. Hover over folder → Click "+" button (existing)
  2. Right-click folder → Select "Create Content in Folder" (new)

The right-click context menu provides the familiar explorer-like interaction you requested, while keeping the quick-access hover button for power users.

Commit: 1977347

@Copilot Copilot AI changed the title Add Dashboard Structure View for Folder Hierarchy Navigation and Content Creation Add Dashboard Structure View for Folder Hierarchy Navigation with Right-Click Context Menu Sep 13, 2025
Copilot finished work on behalf of estruyf September 13, 2025 10:17
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.

2 participants