AOSSIE-Org / AOSSIE-Org/PictoPy-Website

[FEATURE]: Intelligent OS-Aware Dynamic Download Component Integrations (GitHub Releases API)

未關閉
#12 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
enhancement
主要語言
TypeScript
星號
12
分支
16
PR 合併指標
30 天內沒有已合併 PR

描述

### Feature and its Use Cases

### 🚀 Feature Request: Intelligent OS-Aware Dynamic Download Component

**Is your feature request related to a problem? Please describe.**
Currently, as the landing page for a desktop application (PictoPy), directing users to the main repository's "Releases" page introduces significant friction. Users have to manually navigate the GitHub UI, understand their OS architecture, and find the correct `.exe`, `.dmg`, or `.AppImage` file. This drops conversion rates and creates a poor UX for non-technical users looking for a simple, one-click "Download" button.

**Describe the solution you'd like**
I propose building a smart `` component that dynamically detects the visitor's Operating System and fetches the latest corresponding installer directly from the main `AOSSIE-Org/PictoPy` repository using the GitHub REST API.

**Technical Execution Plan:**
1. **OS Detection Hook (`useOS`):** Create a robust React hook using `navigator.userAgentData` (with a fallback to `navigator.userAgent`) to seamlessly determine if the user is on Windows, macOS, or Linux.
2. **GitHub API Integration:** Fetch the latest release payload asynchronously from `https://api.github.com/repos/AOSSIE-Org/PictoPy/releases/latest`.
3. **Asset Matching Logic:**
- If **Windows**: Map `href` to `.exe` or `.msi` assets.
- If **macOS**: Map `href` to `.dmg` or `.app.tar.gz` assets.
- If **Linux**: Map `href` to `.AppImage` or `.deb` assets.
4. **Dynamic UI Rendering:** The button should read "Download for Windows" (with a Windows logo icon), "Download for macOS", etc., injecting the direct download URL.
5. **Fallback Dropdown:** Include a smaller "Download for other platforms" dropdown for edge cases or users downloading on behalf of another machine.

**Describe alternatives you've considered**
Hardcoding the download links directly into the codebase. However, this is unscalable as maintainers would have to manually submit a PR to update the website code every single time a new version of the PictoPy desktop app is released.

**🎯 Impact / Why this matters**
- **Zero-Maintenance:** The landing page will always serve the absolute latest version of PictoPy automatically.
- **Conversion Rate:** One-click downloads directly on the landing page are the gold standard for modern desktop apps.
- **Modern UX:** Demonstrates a high level of frontend polish for end-users.

**Code of Conduct**
- [x] I have joined the Discord server and will post updates there.
- [x] I have searched existing issues to avoid duplicates.

*If the maintainers agree with this architectural improvement, I would love to be assigned to this issue and start working on the PR immediately!*

### Additional Context

_No response_

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。