Skip to content

Commit 917daff

Browse files
fix: Landing Page Improvements - Download/Docs Buttons, Branding & Dynamic Releases (#746)
* fix: Landing page improvements - fix Download/Docs buttons, update title, and dynamic releases Resolves #724 - Fix Download button to scroll to downloads section - Update View Docs button to link to PictoPy documentation - Change page title and favicon to PictoPy branding - Implement dynamic download links from latest GitHub release - No need to manually update download links for new releases * Fix image link and title * Refactor download links fetching and handling --------- Co-authored-by: Rahul Harpal <51887323+rahulharpal1603@users.noreply.github.com>
1 parent d07d817 commit 917daff

File tree

3 files changed

+129
-27
lines changed

3 files changed

+129
-27
lines changed

landing-page/index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
5+
<link
6+
rel="icon"
7+
type="image/png"
8+
href="https://aossie-org.github.io/PictoPy/assets/favicon.png"
9+
/>
610
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React + TS</title>
11+
<meta
12+
name="description"
13+
content="PictoPy - Advanced desktop gallery application powered by Tauri, React, and Rust"
14+
/>
15+
<title>PictoPy</title>
816
</head>
917
<body class="light">
1018
<div id="root"></div>

landing-page/src/Pages/Landing page/Home1.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import { motion } from "framer-motion";
22
import { useEffect, useRef, useState } from "react";
33

44
const ShuffleHero = () => {
5+
// Function to scroll to downloads section
6+
const scrollToDownloads = () => {
7+
const downloadsSection = document.getElementById('downloads-section');
8+
if (downloadsSection) {
9+
downloadsSection.scrollIntoView({
10+
behavior: 'smooth',
11+
block: 'start',
12+
});
13+
}
14+
};
15+
516
return (
617
<section className="w-full px-8 py-12 grid grid-cols-1 md:grid-cols-2 items-center gap-8 max-w-6xl mx-auto bg-white dark:bg-black transition-colors duration-300">
718
<div className="font-['Inter',_sans-serif]">
@@ -33,7 +44,9 @@ const ShuffleHero = () => {
3344
</motion.p>
3445

3546
<div className="flex space-x-4">
47+
{/* Download button - scrolls to downloads section */}
3648
<motion.button
49+
onClick={scrollToDownloads}
3750
initial={{ scale: 0.9, opacity: 0 }}
3851
animate={{ scale: 1, opacity: 1 }}
3952
transition={{ duration: 0.5, delay: 0.6 }}
@@ -44,9 +57,9 @@ const ShuffleHero = () => {
4457
Download
4558
</motion.button>
4659

47-
{/* Update this button to navigate to the GitHub link */}
60+
{/* View Docs button - links to documentation */}
4861
<motion.a
49-
href="https://github.com/AOSSIE-Org/PictoPy"
62+
href="https://aossie-org.github.io/PictoPy/"
5063
target="_blank"
5164
rel="noopener noreferrer"
5265
initial={{ scale: 0.9, opacity: 0 }}

landing-page/src/Pages/pictopy-landing.tsx

Lines changed: 103 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,95 @@
1-
import { FC, useState } from "react";
1+
import { FC, useState, useEffect } from "react";
22
import { Button } from "@/components/ui/button";
3-
import PictopyLogo from "@/assets/PictoPy_Logo.png"; // Adjust this import path as needed
4-
import MacLogo from "@/assets/mac-logo.png"; // Add your Mac logo
5-
import WindowsLogo from "@/assets/windows-logo.svg"; // Add your Windows logo
6-
import LinuxLogo from "@/assets/linux-logo.svg"; // Add your Linux logo
3+
import PictopyLogo from "@/assets/PictoPy_Logo.png";
4+
import MacLogo from "@/assets/mac-logo.png";
5+
import WindowsLogo from "@/assets/windows-logo.svg";
6+
import LinuxLogo from "@/assets/linux-logo.svg";
7+
8+
interface GitHubAsset {
9+
name: string;
10+
browser_download_url: string;
11+
}
12+
13+
interface GitHubRelease {
14+
tag_name: string;
15+
assets: GitHubAsset[];
16+
}
717

818
const PictopyLanding: FC = () => {
9-
// State for showing the notification
1019
const [downloadStarted, setDownloadStarted] = useState<string | null>(null);
20+
const [downloadLinks, setDownloadLinks] = useState<{
21+
mac: string | null;
22+
windows: string | null;
23+
linux: string | null;
24+
}>({ mac: null, windows: null, linux: null });
25+
const [loading, setLoading] = useState(true);
26+
27+
// Fetch latest release from GitHub API
28+
useEffect(() => {
29+
const fetchLatestRelease = async () => {
30+
try {
31+
const response = await fetch(
32+
"https://api.github.com/repos/AOSSIE-Org/PictoPy/releases/latest"
33+
);
34+
const data: GitHubRelease = await response.json();
35+
36+
// Find download links for each platform
37+
const macAsset = data.assets.find(
38+
(asset) =>
39+
asset.name.toLowerCase().includes(".dmg") ||
40+
asset.name.toLowerCase().includes(".app")
41+
);
42+
43+
const windowsAsset = data.assets.find(
44+
(asset) =>
45+
asset.name.toLowerCase().includes(".exe") ||
46+
asset.name.toLowerCase().includes(".msi")
47+
);
48+
49+
const linuxAsset = data.assets.find((asset) =>
50+
asset.name.toLowerCase().includes(".deb")
51+
);
52+
53+
setDownloadLinks({
54+
mac: macAsset?.browser_download_url || null,
55+
windows: windowsAsset?.browser_download_url || null,
56+
linux: linuxAsset?.browser_download_url || null,
57+
});
58+
setLoading(false);
59+
} catch (error) {
60+
console.error("Error fetching latest release:", error);
61+
setLoading(false);
62+
}
63+
};
64+
65+
fetchLatestRelease();
66+
}, []);
67+
68+
// Function to handle button click and show notification
69+
const handleDownloadClick = (
70+
platform: string,
71+
downloadUrl: string | null
72+
) => {
73+
if (!downloadUrl) {
74+
setDownloadStarted(`${platform} download not available yet`);
75+
setTimeout(() => setDownloadStarted(null), 3000);
76+
return;
77+
}
78+
79+
// Trigger download
80+
window.location.href = downloadUrl;
1181

12-
// Function to handle button click and show the notification
13-
const handleDownloadClick = (platform: string) => {
1482
setDownloadStarted(`Download for ${platform} started!`);
15-
// Hide the notification after 3 seconds
1683
setTimeout(() => {
1784
setDownloadStarted(null);
1885
}, 3000);
1986
};
2087

2188
return (
22-
<section className="w-full py-12 md:py-24 bg-white dark:bg-black transition-colors duration-300 relative overflow-hidden">
89+
<section
90+
id="downloads-section"
91+
className="w-full py-12 md:py-24 bg-white dark:bg-black transition-colors duration-300 relative overflow-hidden"
92+
>
2393
{/* Background Animated SVG */}
2494
<div className="absolute inset-0 z-0">
2595
<svg
@@ -47,7 +117,7 @@ const PictopyLanding: FC = () => {
47117
</div>
48118

49119
{/* Content */}
50-
<div className="px-4 md:px-6 relative z-10 ">
120+
<div className="px-4 md:px-6 relative z-10">
51121
<div className="flex flex-col items-center text-center">
52122
{/* Heading with Gradient Text and Logo */}
53123
<div className="flex items-center justify-center gap-4 mb-4">
@@ -63,50 +133,61 @@ const PictopyLanding: FC = () => {
63133

64134
{/* Subheading */}
65135
<p className="text-xl md:text-2xl text-green-700 dark:text-yellow-300 max-w-3xl mb-8 transition-colors duration-300">
66-
Organize your photos effortlessly. Available for Mac, Windows, and Linux.
136+
Organize your photos effortlessly. Available for Mac, Windows, and
137+
Linux.
67138
</p>
68139

140+
{/* Loading State */}
141+
{loading && (
142+
<div className="text-gray-600 dark:text-gray-400 mb-4">
143+
Loading latest releases...
144+
</div>
145+
)}
146+
69147
{/* Download Buttons */}
70148
<div className="flex flex-col sm:flex-row gap-4 justify-center">
71149
<Button
72150
className="bg-black text-white hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200 h-12 px-8 transition-all duration-300
73151
border-2 border-transparent hover:border-black dark:hover:border-white
74-
transform hover:-translate-y-1 hover:shadow-lg"
152+
transform hover:-translate-y-1 hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed"
75153
size="lg"
76-
onClick={() => handleDownloadClick("Mac")}
154+
onClick={() => handleDownloadClick("Mac", downloadLinks.mac)}
155+
disabled={loading || !downloadLinks.mac}
77156
>
78157
<img src={MacLogo} alt="Mac" className="h-7 w-7 mr-2" />
79158
Download for Mac
80159
</Button>
81160
<Button
82161
className="bg-black text-white hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200 h-12 px-8 transition-all duration-300
83162
border-2 border-transparent hover:border-black dark:hover:border-white
84-
transform hover:-translate-y-1 hover:shadow-lg"
163+
transform hover:-translate-y-1 hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed"
85164
size="lg"
86165
variant="outline"
87-
onClick={() => handleDownloadClick("Windows")}
166+
onClick={() =>
167+
handleDownloadClick("Windows", downloadLinks.windows)
168+
}
169+
disabled={loading || !downloadLinks.windows}
88170
>
89171
<img src={WindowsLogo} alt="Windows" className="h-7 w-7 mr-2" />
90172
Download for Windows
91173
</Button>
92174
<Button
93175
className="bg-black text-white hover:bg-gray-800 dark:bg-white dark:text-black dark:hover:bg-gray-200 h-12 px-8 transition-all duration-300
94176
border-2 border-transparent hover:border-black dark:hover:border-white
95-
transform hover:-translate-y-1 hover:shadow-lg"
177+
transform hover:-translate-y-1 hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed"
96178
size="lg"
97179
variant="outline"
98-
onClick={() => handleDownloadClick("Linux")}
180+
onClick={() => handleDownloadClick("Linux", downloadLinks.linux)}
181+
disabled={loading || !downloadLinks.linux}
99182
>
100-
<img src={LinuxLogo} alt="Linux" className="h-9 w-9 mr-2" /> {/* Larger Linux logo */}
183+
<img src={LinuxLogo} alt="Linux" className="h-9 w-9 mr-2" />
101184
Download for Linux(.deb)
102185
</Button>
103186
</div>
104187

105188
{/* Download Notification (Popup) */}
106189
{downloadStarted && (
107-
<div
108-
className="fixed top-16 right-4 md:right-8 bg-green-500 text-white py-3 px-6 rounded-lg shadow-xl text-lg z-50 opacity-0 animate-slideInRight"
109-
>
190+
<div className="fixed top-16 right-4 md:right-8 bg-green-500 text-white py-3 px-6 rounded-lg shadow-xl text-lg z-50 opacity-0 animate-slideInRight">
110191
{downloadStarted}
111192
</div>
112193
)}

0 commit comments

Comments
 (0)