Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_TRACKER_URL: ${{ vars.NEXT_PUBLIC_TRACKER_URL }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
26 changes: 21 additions & 5 deletions components/download-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next"

const downloads = [
{
id: "mac_intel",
icon: Package,
key: "macIntel",
defaultPlatform: "macOS Intel processors",
Expand All @@ -16,6 +17,7 @@ const downloads = [
link: "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-x86_64",
},
{
id: "mac_arm",
icon: Package,
key: "macArm",
defaultPlatform: "macOS ARM processors",
Expand All @@ -25,6 +27,7 @@ const downloads = [
link: "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-arm64",
},
{
id: "windows",
icon: Package,
key: "windows",
defaultPlatform: "Windows",
Expand All @@ -35,6 +38,19 @@ const downloads = [
},
]

const TRACKER_URL = process.env.NEXT_PUBLIC_TRACKER_URL

async function trackClick(buttonId: string) {
if (!TRACKER_URL) return
try {
await fetch(`${TRACKER_URL}/click/${buttonId}`, {
method: "POST",
})
} catch {
// non-blocking — don't let tracking errors affect the download
}
}

export function DownloadSection() {
const { t } = useTranslation()
return (
Expand All @@ -57,7 +73,7 @@ export function DownloadSection() {

<div className="max-w-5xl mx-auto">
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
{downloads.map((download, index) => {
{downloads.map((download) => {
const Icon = download.icon
const platform = t(`download:cards.${download.key}.platform`, {
defaultValue: download.defaultPlatform,
Expand All @@ -81,12 +97,12 @@ export function DownloadSection() {
</p>
<p className="text-xs text-muted-foreground font-mono">{format}</p>
</div>
<Button
className="w-full bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer"
<Button
className="w-full bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer"
size="sm"
asChild
>
<a href={download.link} download>
<a href={download.link} download onClick={() => trackClick(download.id)}>
<Download className="mr-2 h-4 w-4" />
{t("download:button", { defaultValue: "Download" })}
</a>
Expand Down Expand Up @@ -124,4 +140,4 @@ export function DownloadSection() {
</div>
</section>
)
}
}
Loading