Skip to content

Commit 60b3652

Browse files
Merge pull request #32 from lukepistrol/feat/31-dynamic-version-number
[feat]: Dynamic Version Number
2 parents b9adf60 + fe3aa59 commit 60b3652

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

components/pages/home/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import CtaSection from './sections/CtaSection';
1212
import SampleStorySection from './sections/SampleStorySection';
1313
import links from '@/data/links';
1414

15-
export default function HomePage() {
15+
export default function HomePage({ versionNumber }) {
1616
return (
1717
<div>
1818
<Ribbon onClick={() => window.open(links.githubProject)}>
1919
CodeEdit is currently in development. Check out the roadmap.
2020
</Ribbon>
21-
<HeroSection />
21+
<HeroSection versionNumber={versionNumber}/>
2222
<IntroFeaturesSection />
2323
{/* <SampleStorySection /> */}
2424
{/* <SampleStorySection /> */}

components/pages/home/sections/HeroSection.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const ProductIconWrap = styled.div`
1313
margin-right: auto;
1414
`;
1515

16-
const HeroSection = () => {
16+
const HeroSection = ({versionNumber}) => {
17+
1718
return (
1819
<Parallax
1920
style={{ overflow: 'visible' }}
@@ -42,7 +43,7 @@ const HeroSection = () => {
4243
CodeEdit is an exciting new code editor written entirely and unapologetically for macOS. Develop any project using any language at speeds like never before with increased efficiency and reliability in an editor that feels right at home on your Mac.
4344
</Typography>
4445
<Button href="https://github.com/CodeEditApp/CodeEdit/releases/latest" target="_blank">Download Alpha</Button>
45-
<Typography variant="body-reduced" color="tertiary">0.0.1-alpha | macOS 12+</Typography>
46+
<Typography variant="body-reduced" color="tertiary">{ versionNumber } | macOS 13+</Typography>
4647
</Stack>
4748
</Column>
4849
</Row>

pages/index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
export { default } from '@/components/pages/home';
1+
import HomePage from '@/components/pages/home';
2+
3+
export default function Home(props) {
4+
return (
5+
<HomePage versionNumber={props.versionNumber} />
6+
);
7+
}
8+
9+
export async function getStaticProps() {
10+
const res = await fetch('https://api.github.com/repos/CodeEditApp/CodeEdit/releases/latest');
11+
const data = await res.json();
12+
13+
return {
14+
props: {
15+
versionNumber: data.tag_name,
16+
},
17+
revalidate: 60 * 60 * 24, // 24 hours
18+
};
19+
}

0 commit comments

Comments
 (0)