Skip to content

Add GitHub Contributors List in About Dialog #319

@udlose

Description

@udlose

I think its important to recognize those that contribute to OpenSource projects like MermaidPad. So, I'd like to use the GitHub API to populate a section in the About Dialog with a list of Contributors. I see 2 possible designs.

Note

If anyone wants to pick this up, please provide your thoughts on the designs before beginning.


Possible Designs

Design A - static .json file

This design would create a contributors.json file created during Build/Release Workflow. This design allows for listing the contributor info if the user is offline.

  1. Create a GitHub Action that creates a contributors.json file during the .github/workflows/build-and-release.yml Workflow
  2. File would be an Embedded Resource and be copied into the Assets folder.
  3. Modify MermaidPad.Build.targets to include hash calculation for contributors.json. There is already logic for doing this so just follow the existing pattern.
    4a. (Preferred 🚀) The contributors.json file would be lazy-loaded at runtime by the AboutDialogViewModel. Before loading the file, it would need to be verified by the MermaidPad.Services.Platforms.AssetIntegrityService by comparing its pre-calculated SHA listed in MermaidPad.Generated.AssetHashes. If the user is ofline, we can come up with a pre-defined static list of all contributors that have worked on MermaidPad.
    OR
    4b. The file would be added to the list of assets loaded by the MermaidPad.Services.Platforms.AssetService. The flow would be very similar to what is being done for the .js files. This design isn't ideal since it would load the file at app startup and the About Dialog most likely won't ever be opened - so it's kinda wasteful.

Design B - real-time call to GitHub API

This design would make a realtime HTTP REST call to the GitHub API when the AboutDialog is loaded.

  1. Extend the AboutDialogViewModel to include an injected HttpClient. I already setup DI for HttpClients in the Service Registration.
  2. I don't think we need a GitHubApiService - unless the logic for the GitHub API call becomes a bit complicated or long.
  3. Use the REST endpoints for the GitHub API from here: List repository contributors

Requirements

  1. Use async calls when possible.
  2. Ensure that any updates made to the ViewModel use Dispatcher.UIThread to acess ViewModel properties
  3. Contributor list should be ordered in decreasing order by the number of commits.
  4. The list should be populated into a scrollable read-only ListBox. The number of contributors is (unfortunately) still quite low so I don't think we need to worry about paging yet- but if you want to add that, please feel free to do so!
  5. At a minimum, the list should include their GitHub profile name/id.
  6. Nice to haves include:
    a. Make their name a clickable link to their GitHub profile page
    b. Include their GitHub avatar
  7. Can you think of anything else?

Metadata

Metadata

Assignees

Labels

backendCovers changes, bug fixes, and improvements to the backend implementation.enhancementNew feature or requestgood first issueGood for newcomersuser interfaceCovers changes, bug fixes and improvements to the UI

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions