Skip to content

Commit 9d97ad2

Browse files
authored
Merge pull request #15 from AnnaZiegler/fix-issue#14
Fixed download link to point to GitHub Releases page.
2 parents bf19d41 + 20be665 commit 9d97ad2

File tree

2 files changed

+23
-116
lines changed

2 files changed

+23
-116
lines changed

src/pages/download.js

Lines changed: 22 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import React, { useState, useEffect } from "react"
1+
import React from "react"
22
import { useStaticQuery, graphql } from "gatsby"
33
import styled from "styled-components"
44
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
55
import { faDownload } from "@fortawesome/free-solid-svg-icons"
66
import { faLinux, faApple, faWindows } from "@fortawesome/free-brands-svg-icons"
7-
87
import Layout from "../components/layout"
9-
import SEO from "../components/seo"
8+
import Seo from "../components/seo"
109
import Container from "../components/container"
1110
import Banner from "../components/banner"
1211
import SiteSpecificVersions from "../components/SiteSpecificVersions"
13-
1412
import { dlInfo } from "../utils/downloadinfo"
1513

1614
const Flex = styled.div`
@@ -25,43 +23,6 @@ const Flex = styled.div`
2523
}
2624
`
2725

28-
const OSButtons = styled.div`
29-
margin: 0 0 1rem;
30-
button {
31-
background-color: #ffffff;
32-
border: none;
33-
cursor: pointer;
34-
margin: 0 1rem 1rem;
35-
}
36-
37-
button:hover {
38-
color: #00293f;
39-
}
40-
41-
.osLinux {
42-
color: ${props =>
43-
props.OSName === "Linux" || props.OSName === "Other"
44-
? "#004160"
45-
: "#000000"};
46-
border-bottom: ${props =>
47-
props.OSName === "Linux" || props.OSName === "Other"
48-
? "2px solid #004160"
49-
: "none"};
50-
}
51-
52-
.osMac {
53-
color: ${props => (props.OSName === "Mac" ? "#004160" : "#000000")};
54-
border-bottom: ${props =>
55-
props.OSName === "Mac" ? "2px solid #004160" : "none"};
56-
}
57-
58-
.osWindows {
59-
color: ${props => (props.OSName === "Windows" ? "#004160" : "#000000")};
60-
border-bottom: ${props =>
61-
props.OSName === "Windows" ? "2px solid #004160" : "none"};
62-
}
63-
`
64-
6526
const StyledDownloadButton = styled.a`
6627
text-decoration: none;
6728
background-color: #004160;
@@ -84,51 +45,32 @@ const StyledDownloadButton = styled.a`
8445
}
8546
`
8647

87-
const StyledDownloadButtonDev = styled(StyledDownloadButton)`
88-
background-color: #ffffff;
89-
color: #004160;
90-
91-
&:hover {
92-
color: #ffffff;
93-
background-color: #004160;
94-
border: 2px solid #004160;
95-
}
48+
const DownloadSubtext = styled.p`
49+
text-align: center;
50+
font-size: 0.95rem;
51+
padding: 0.835rem 0.935rem;
9652
`
9753

98-
const DownloadSubtext = styled.p`
54+
const DownloadText = styled.p`
9955
text-align: center;
100-
font-size: 0.85rem;
56+
font-size: 1.1rem;
10157
padding: 0.835rem 0.935rem;
58+
margin-top: 0.5rem;
59+
margin-bottom: 2rem;
10260
`
10361

104-
const DownloadButton = ({ link, os }) => (
62+
const DownloadButtonPhoebus = () => (
10563
<div>
106-
<StyledDownloadButton href={link}>
107-
<FontAwesomeIcon icon={faDownload} /> Download Control System Studio
64+
<StyledDownloadButton href={dlInfo.downloadGitRelease} target={"_blank"}>
65+
<FontAwesomeIcon icon={faDownload} /> Download Phoebus Control System Studio
10866
</StyledDownloadButton>
10967
<DownloadSubtext>
110-
Version {dlInfo.downloadVersion} for {os} |{" "}
111-
<a href={dlInfo.allDownloads}>Other Versions</a>
68+
Releases available for <FontAwesomeIcon icon={faLinux} /> Linux, <FontAwesomeIcon icon={faApple} /> Mac and <FontAwesomeIcon icon={faWindows} /> Windows.
11269
</DownloadSubtext>
11370
</div>
11471
)
11572

116-
const DevDownloadButton = () => (
117-
<div>
118-
<StyledDownloadButtonDev href={dlInfo.downloadDev}>
119-
<FontAwesomeIcon icon={faDownload} /> Download Development Build
120-
</StyledDownloadButtonDev>
121-
<DownloadSubtext>Version {dlInfo.downloadDevVersion}</DownloadSubtext>
122-
</div>
123-
)
124-
12573
const Download = () => {
126-
const [OSName, setOSName] = useState("Other")
127-
128-
useEffect(() => {
129-
setOSName(detectOS())
130-
}, [])
131-
13274
const images = useStaticQuery(graphql`{
13375
banner: file(
13476
relativePath: {eq: "banners/CS-Studio-Keyvisual_banner_3_darker.png"}
@@ -141,42 +83,22 @@ const Download = () => {
14183

14284
return (
14385
<Layout>
144-
<SEO title="Download" />
86+
<Seo title="Download" />
14587
<Banner
14688
imageFluid={images.banner.childImageSharp.gatsbyImageData}
14789
text="Download"
14890
/>
14991
<Container>
92+
<DownloadText>
93+
<p>
94+
Get the latest Releases on GitHub
95+
</p>
96+
</DownloadText>
97+
15098
<Flex>
151-
<OSButtons OSName={OSName}>
152-
<button onClick={() => setOSName("Linux")} className="osLinux">
153-
<FontAwesomeIcon icon={faLinux} /> Linux
154-
</button>
155-
<button onClick={() => setOSName("Mac")} className="osMac">
156-
<FontAwesomeIcon icon={faApple} /> Mac
157-
</button>
158-
<button onClick={() => setOSName("Windows")} className="osWindows">
159-
<FontAwesomeIcon icon={faWindows} /> Windows
160-
</button>
161-
</OSButtons>
99+
<DownloadButtonPhoebus />
162100
</Flex>
163-
<Flex>
164-
{(OSName === "Linux" || OSName === "Other") && (
165-
<DownloadButton link={dlInfo.downloadStableLinux} os={"Linux"} />
166-
)}
167-
168-
{OSName === "Mac" && (
169-
<DownloadButton link={dlInfo.downloadStableMac} os={"Mac"} />
170-
)}
171101

172-
{OSName === "Windows" && (
173-
<DownloadButton
174-
link={dlInfo.downloadStableWindows}
175-
os={"Windows"}
176-
/>
177-
)}
178-
<DevDownloadButton />
179-
</Flex>
180102
<h2>Site Specific Versions</h2>
181103
<SiteSpecificVersions />
182104
<div style={{ marginBottom: `1rem` }}></div>
@@ -185,13 +107,4 @@ const Download = () => {
185107
);
186108
}
187109

188-
const detectOS = () => {
189-
let OSName = "Other"
190-
if (window.navigator.userAgent.indexOf("Windows") !== -1) OSName = "Windows"
191-
if (window.navigator.userAgent.indexOf("Mac") !== -1) OSName = "Mac"
192-
if (window.navigator.userAgent.indexOf("Linux") !== -1) OSName = "Linux"
193-
194-
return OSName
195-
}
196-
197110
export default Download

src/utils/downloadinfo.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
export const dlInfo = {
2-
downloadVersion: "4.5.9",
3-
downloadStableLinux: "http://download.controlsystemstudio.org/release/4.5/cs-studio-4.5.9-linux.gtk.x86_64.tar.gz",
4-
downloadStableWindows: "http://download.controlsystemstudio.org/release/4.5/cs-studio-4.5.9-win32.win32.x86_64.zip",
5-
downloadStableMac: "http://download.controlsystemstudio.org/release/4.5/cs-studio-4.5.9-macosx.cocoa.x86_64.zip",
6-
allDownloads: "http://download.controlsystemstudio.org/release/4.5/",
7-
downloadDevVersion: "4.6.0",
8-
downloadDev: "https://openepics.ci.cloudbees.com/view/CS-Studio%204.6/",
2+
downloadGitRelease: "https://github.com/ControlSystemStudio/phoebus/releases/",
93
}

0 commit comments

Comments
 (0)