Skip to content

Commit 80adba4

Browse files
committed
Upgrade web download
1 parent f0cf35b commit 80adba4

File tree

1 file changed

+7
-71
lines changed

1 file changed

+7
-71
lines changed

website/src/pages/DownloadsPage.tsx

Lines changed: 7 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { useTranslation } from 'react-i18next';
2-
import { useState, useEffect } from 'react';
3-
import axios from 'axios';
42
import {
53
Download,
64
Monitor,
@@ -13,50 +11,8 @@ import {
1311
} from 'lucide-react';
1412
import './DownloadsPage.css';
1513

16-
interface ReleaseAsset {
17-
name: string;
18-
browser_download_url: string;
19-
size: number;
20-
}
21-
22-
interface Release {
23-
tag_name: string;
24-
name: string;
25-
html_url: string;
26-
assets: ReleaseAsset[];
27-
}
28-
2914
export default function DownloadsPage() {
3015
const { t } = useTranslation();
31-
const [latestRelease, setLatestRelease] = useState<Release | null>(null);
32-
const [loading, setLoading] = useState(true);
33-
const [error, setError] = useState(false);
34-
35-
useEffect(() => {
36-
const fetchRelease = async () => {
37-
try {
38-
const response = await axios.get(
39-
'https://api.github.com/repos/Dev2Forge/bridgex/releases/latest'
40-
);
41-
setLatestRelease(response.data);
42-
setError(false);
43-
} catch {
44-
console.error('Failed to fetch release');
45-
setError(true);
46-
} finally {
47-
setLoading(false);
48-
}
49-
};
50-
51-
fetchRelease();
52-
}, []);
53-
54-
const formatSize = (bytes: number) => {
55-
const mb = bytes / (1024 * 1024);
56-
return `${mb.toFixed(1)} MB`;
57-
};
58-
59-
const windowsAsset = latestRelease?.assets.find(a => a.name.endsWith('.exe'));
6016

6117
return (
6218
<div className="downloads-page">
@@ -82,33 +38,13 @@ export default function DownloadsPage() {
8238
{t('downloads.windows.description')}
8339
</p>
8440

85-
{loading ? (
86-
<div className="loading-btn">Loading...</div>
87-
) : error || !windowsAsset ? (
88-
<a
89-
href="https://github.com/Dev2Forge/bridgex/releases"
90-
target="_blank"
91-
rel="noopener noreferrer"
92-
className="btn btn-primary download-btn"
93-
>
94-
<Download size={20} />
95-
{t('downloads.windows.button')}
96-
</a>
97-
) : (
98-
<a
99-
href={windowsAsset.browser_download_url}
100-
className="btn btn-primary download-btn"
101-
>
102-
<Download size={20} />
103-
{t('downloads.windows.button')}
104-
</a>
105-
)}
106-
107-
{windowsAsset && !error && (
108-
<span className="download-size">
109-
{formatSize(windowsAsset.size)}
110-
</span>
111-
)}
41+
<a
42+
href="https://sourceforge.net/projects/bridgex/files/latest/download"
43+
className="btn btn-primary download-btn"
44+
>
45+
<Download size={20} />
46+
{t('downloads.windows.button')}
47+
</a>
11248

11349
<p className="download-note">{t('downloads.windows.note')}</p>
11450
</div>

0 commit comments

Comments
 (0)