Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# production
/build

/public/sitemap.xml

# misc
.DS_Store
*.pem
Expand Down
2 changes: 2 additions & 0 deletions components/common/Markdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const Markdown = ({
};

return (
<div>
<Styled.MarkdownWrap className={className} style={style}>
<ReactMarkdown
components={{ ...MarkdownComponents, ...components }}
Expand All @@ -124,6 +125,7 @@ const Markdown = ({
{children}
</ReactMarkdown>
</Styled.MarkdownWrap>
</div>
);
};

Expand Down
50 changes: 50 additions & 0 deletions components/pages/whats-new/RawRelease.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import styled from 'styled-components';
import Markdown from '@/components/common/Markdown';
import Head from 'next/head';

const StyledMarkdown = styled(Markdown)`
img:first-child {
display: none;
}
padding: 10px;
img {
width: 100%;
}
p,
ul,
ol,
li {
font-size: 14px;
}

h2 {
font-size: 24px;
}
& img,
& video,
& iframe {
margin-bottom: 10px;
}

& > * {
max-width: 100%;
}
& > *:last-child {
margin-bottom: 0;
}
`;

const RawRelease = ({ release }) => {
if (!release) return <div>No Release Found</div>;

return (
<>
<Head>
<meta name="robots" content="noindex"></meta>
</Head>
<StyledMarkdown>{release.body}</StyledMarkdown>
</>
);
};

export default RawRelease
2 changes: 2 additions & 0 deletions components/pages/whats-new/Release.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ const Release = ({ release, latest }) => {
releaseUrl = `${window.location.href.split('#')[0]}#${release.name}`;
}

console.log("release")

const versionNumber = getMinimumSystemVersion(release.body);
const versionName = versionNumber
? macOSVersions[versionNumber.split('.')[0]]
Expand Down
3 changes: 2 additions & 1 deletion data/macOS-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"11": "Big Sur",
"12": "Monterey",
"13": "Ventura",
"14": "Sonoma"
"14": "Sonoma",
"15": "Sequoia"
}
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 17 additions & 5 deletions pages/_app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '@/styles/globals.css';
import config from '@/data/config';

function App({ Component, pageProps, router }) {
const { pathname, asPath } = router?.state ?? {};
const { pathname, asPath } = router ?? {};
const defaultPageData = config.pages['/'];
const pageData = config.pages[pathname] ?? config.pages['/'];
const isDefault = defaultPageData === pageData;
Expand Down Expand Up @@ -37,13 +37,25 @@ function App({ Component, pageProps, router }) {
<meta name="twitter:site" content="@CodeEdit" />
<meta name="twitter:creator" content="@CodeEdit" />
</Head>
<Header />
<main>
<Layout pathname={pathname}>
<Component {...pageProps} />
</main>
<Footer />
</Layout>
</Site>
);
}

const Layout = ({ children, pathname }) => {
if (pathname === '/sparkle/[tag]/CodeEdit.html') {
return <main>{children}</main>;
}

return (
<>
<Header />
<main>{children}</main>
<Footer />
</>
);
}

export default App;
29 changes: 29 additions & 0 deletions pages/sparkle/[tag]/CodeEdit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export { default } from '@/components/pages/whats-new/RawRelease'
import { fetchWithCache } from '@/utils/fetchData';

export async function getStaticProps({ params }) {
const { tag } = params;
const data = await fetchWithCache(
'releases',
'https://api.github.com/repos/CodeEditApp/CodeEdit/releases'
);

return {
props: {
release: data.find((release) => release.tag_name === tag) || null,
},
};
}

export async function getStaticPaths() {
const data = await fetchWithCache(
'releases',
'https://api.github.com/repos/CodeEditApp/CodeEdit/releases'
);
const paths = data.map((release) => ({ params: { tag: release.tag_name } }));

return {
paths,
fallback: false,
};
}
5 changes: 3 additions & 2 deletions pages/whats-new.js → pages/whats-new/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export { default } from '@/components/pages/whats-new';
import { fetchWithCache } from '@/utils/fetchData';

export async function getStaticProps() {
const res = await fetch(
const data = await fetchWithCache(
'releases',
'https://api.github.com/repos/CodeEditApp/CodeEdit/releases'
);
const data = await res.json();

return {
props: {
Expand Down
1 change: 1 addition & 0 deletions scripts/generate-sitemap.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function generate() {
'!pages/_*.jsx',
'!pages/api',
'!pages/404.tsx',
'!pages/sparkle/**/*.js'
]);

const sitemap = `
Expand Down