Skip to content

Conversation

maoyama
Copy link
Owner

@maoyama maoyama commented Apr 30, 2025

Screenshot 2025-04-30 at 23 13 59

Ref #76

maoyama added 30 commits April 11, 2025 08:54
- Created a new SwiftUI view for displaying a commit graph.
- Added sample commit data structure to visualize commits and their relationships.
- Updated project.pbxproj to include new file.
- Increased the node size from 10 to 14 for better visibility.
- Introduced a selectedCommitID state to track the selected commit.
- Reworked the drawing logic to utilize ZStack for layering, ensuring lines and nodes are rendered correctly.
- Added clickable nodes that update the selected commit state and display the commit ID.
- Changed the representation of commits from CommitNode to Commit struct to include detailed commit information (hash, author, date, title, etc.).
- Introduced sorting and layout logic for commits within CommitsGraph for a clearer visualization of commit relationships.
- Updated CommitGraphView to reflect changes in data structure and display commit titles.
- Additionally added a new sample dataset to showcase merged commits functionality.
- Replaced `topologicallySortedCommits` with `positionedCommits` for better clarity in commit positioning.
- Modified the commit layout logic to streamline handling of commits.
- Adjusted the ZStack alignment in `CommitGraphView` for cleaner visuals.
- Updated the way commit titles are displayed, enhancing background visibility and positioning.
- Removed unnecessary column tracking logic.
- Streamlined how child commits inherit the column from their parents.
- Improved readability by consolidating commit positioning into fewer lines.
- Renamed parameter from 'commits' to 'topoOrderedCommits' for clarity.
- Updated logic to handle parent hashes for determining commit columns more accurately.
- Changed all instances of positionedCommits to use the new parameter in previews.
- Added a usingColumns array to track currently used columns.
- Simplified column assignment logic for positioned commits.
- Introduced a variable to store PositionedCommit instances before appending to results.
- Enhanced logic to manage child columns and remove unused columns in children.
- Cleaned up code for better readability and maintainability.
- Introduced `makeColumn` method to determine unused column indices.
- Updated logic in `positionedCommits` to use `makeColumn` for better column assignment.
- Fixed directory string format in CommitGraphView.
- Updated frame width calculation to accommodate maximum column values
- Enhanced ScrollView to support both horizontal and vertical scrolling
- Adjusted preview frame width for better visibility
- Increased the selected node size to improve visibility.
- Updated line width for commit paths to enhance aesthetics.
- Changed dimensions for commit title text for better layout.
- Added animation to the tap gesture for selecting commits.
- Background color changed to match system text background for better integration.
…ontentView

- Introduced CommitGraphContentView to enhance code organization
- Moved the task for refreshing commits from CommitGraphView to the new content view
- Added selectedCommitHash state for tracking selected commits
- Updated previews for CommitGraphContentView with sample commits
- Reduced the stroke opacity from 0.5 to 0.2 for a lighter graphical representation.
- Removed unnecessary animation for commit selection to streamline the user interaction.
… smoother transitions between commits."

This reverts commit 79ff809.
- Added handling of cases where a commit has no children, ensuring it is still displayed in the graph.
- Introduced a new property `childrenIsHidden` in `PositionedCommit` to manage visibility of commits without children.
- Cleaned up logic for determining the position of commits based on their parent relationships.
- Introduced `sampleCommitsInSearch` array containing various commits for testing search functionality.
- Enhanced the `position(of:)` method to adjust x-coordinate based on child visibility.
- Added preview configuration to display `CommitGraphContentView` with new sample data.
maoyama added 23 commits April 27, 2025 10:04
- Enhanced the positioning of commits in the graph to better handle scenarios involving merge commits.
- Adjusted the logic to utilize the leftmost available column for non-merge commits when a merge commit is present among children.
- Simplified the merge commit detection logic by checking the condition for a single child with two parent hashes.
- Enhanced clarity by removing redundant filtering for merge commit parent column.
- Improved the logic for inheriting columns from child commits to be more concise.
- Updated logic to derive child columns for commits by filtering parent hashes.
- Removed redundant condition checking for merge commits.
- Simplified assignment of new columns for positioned commits, enhancing code clarity.
- Reduced node size and selected node size for a more compact view.
- Decreased spacing between nodes and text width to improve overall layout efficiency.
- Increased textWidth from 140 to 160 for better alignment.
- Set textHeight to 16 for more consistent text display.
- Updated frame calculations for commit titles to accommodate new dimensions.
- Changed variable names for clarity from 'spacing' to 'xSpacing' and 'ySpacing'.
- Updated height and width calculations to use new spacing variables for better visual layout.
- Increased text height for improved readability of commit messages.
- Updated data binding in CommitGraphView and CommitGraphContentView
- Introduced GraphNode view for reusable graph node representation
- Adjusted visual logic for selected state based on selectionLogID
- Cleaned up commented code and added proper spacing for a cleaner UI
- Updated HStack spacing based on the selected log ID for better UI responsiveness.
- Enhanced padding for the not committed section to improve layout.
- Changed `nodeSize` and `selectedNodeSize` from instance properties to static properties in `GraphNode` for consistency.
- Introduced a private computed property `fillColor` in `GraphNode` to determine the fill color based on the state of `logID` and `selectionLogID`.
- Simplified the circle fill logic in the `body` property to use `fillColor`.
…tments

- Added horizontal and vertical padding to CommitGraphContentView for better spacing.
- Adjusted spacing in HStack within CommitGraphContentView.
- Improved layout of GraphNodeText with additional padding.
…tView

- Updated notCommitted parameter in CommitGraphContentView to be a @binding.
- Adjusted instances of CommitGraphContentView to pass $logStore.notCommitted instead of logStore.notCommitted.
- Refactored sample data usage in GraphNodeText for better handling of notCommitted state.
- Increased vertical padding from 12 to 14 in CommitGraphView
- Added top padding of -4 and bottom padding of 24 in CommitGraphContentView
- Adjusted height calculation for the frame in CommitGraphContentView to accommodate new layout
- Updated position calculation for commits to correctly use GraphNode.nodeSize
- Removed unnecessary padding in GraphNodeText view.
Modified the vertical padding to separate top and bottom,
ensuring consistent spacing regardless of the commit status.
@maoyama maoyama requested a review from Copilot April 30, 2025 14:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new commits graph view to enhance the visualization of commit history. Key changes include the introduction of a showGraph state with corresponding UI updates in FolderView, the removal of redundant safe area insets in CommitLogView, and a new CommitGraphView along with the addition of a topo-order flag in GitLog.

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

File Description
GitClient/Views/Folder/FolderView.swift Adds a showGraph state and related UI elements to toggle between commit log and commit graph view.
GitClient/Views/Folder/CommitLogView.swift Introduces a showGraph binding and removes previously duplicated count text and safe area inset logic.
GitClient/Views/Folder/CommitGraph.swift New file implementing the commit graph view and its related UI components.
GitClient/Models/Commands/GitLog.swift Adds the '--topo-order' argument with a TODO comment indicating further clarification may be needed.
Files not reviewed (1)
  • GitClient.xcodeproj/project.pbxproj: Language not supported

@@ -54,6 +54,8 @@ struct GitLog: Git {
if !author.isEmpty {
args.append("--author=\(author)")
}
args.append("--topo-order") // TODO:
Copy link
Preview

Copilot AI Apr 30, 2025

Choose a reason for hiding this comment

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

Clarify the purpose and intended behavior of the '--topo-order' flag by updating or removing the TODO comment.

Suggested change
args.append("--topo-order") // TODO:
args.append("--topo-order") // Ensures commits are displayed in topological order, with parent commits shown before their children.

Copilot uses AI. Check for mistakes.

maoyama added 3 commits May 1, 2025 07:57
- Enabled conditional argument appending for `--topo-order` in `GitLog` based on `topoOrder` property.
- Introduced `showGraph` property in `LogStore` to control graph display logic.
- Updated relevant calls to `GitLog` within `LogStore` methods to include `topoOrder` parameter.
- Modified `FolderView` to toggle graph display and refresh models accordingly.
Always use --topo-order. Because it is easy to see in the List display and the switch to the graph is smooth.
@maoyama maoyama merged commit 9bf402c into main Apr 30, 2025
4 checks passed
@maoyama maoyama deleted the commits-graph-view branch April 30, 2025 23:46
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.

1 participant