Skip to content

Commit ded3533

Browse files
Feat/download apk (#42)
* feat: add button to download APK * fix: apk download --------- Co-authored-by: Jade <jade.musseau@epitech.eu>
1 parent d68844c commit ded3533

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

app/Components/Area_sidebar.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ export default function Sidebar({ isOpen = true, onClose }: SidebarProps) {
1616
const [userRole, setUserRole] = useState<boolean | null>(null);
1717
const [loading, setLoading] = useState(true);
1818

19+
const downloadAPK = async () => {
20+
const link = document.createElement("a");
21+
link.href = "/client.apk";
22+
link.download = "area-client.apk";
23+
document.body.appendChild(link);
24+
link.click();
25+
document.body.removeChild(link);
26+
};
27+
1928
const getUserId = async () => {
2029
try {
2130
const token = localStorage.getItem("authToken");
@@ -77,9 +86,7 @@ export default function Sidebar({ isOpen = true, onClose }: SidebarProps) {
7786
};
7887

7988
if (loading) {
80-
return (
81-
<div className="h-full w-60 bg-[#1B264F] z-15" />
82-
);
89+
return <div className="h-full w-60 bg-[#1B264F] z-15" />;
8390
}
8491

8592
return (
@@ -129,6 +136,12 @@ export default function Sidebar({ isOpen = true, onClose }: SidebarProps) {
129136
)}
130137
</ul>
131138
</nav>
139+
<button
140+
className="absolute bottom-10 left-6 right-6 flex items-center gap-2 px-6 py-2 bg-white text-[#576CA8] font-semibold rounded hover:bg-gray-200"
141+
onClick={downloadAPK}
142+
>
143+
<span>Download the app</span>
144+
</button>
132145
</div>
133146
);
134-
}
147+
}

app/Services/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ export default function ServicesPage() {
7676
throw new Error("Failed to fetch services status");
7777
}
7878
const data = await response.json();
79-
console.log("Fetched services status:", data);
8079
setServicesStatus(data || []);
8180
return data;
8281
} catch (err) {

0 commit comments

Comments
 (0)