diff --git a/packages/docs/content/releases.json b/packages/docs/content/releases.json index 72a58aa0..520737eb 100644 --- a/packages/docs/content/releases.json +++ b/packages/docs/content/releases.json @@ -1,43 +1,166 @@ { "releases": [ + { + "date": "2023-05-25T10:00:00.000Z", + "version": "v2.4.2", + "type": "patch" + }, + { + "date": "2023-05-25T10:00:00.000Z", + "version": "v2.4.1", + "type": "patch" + }, { "date": "2023-05-24T11:00:00.000Z", "version": "v2.4.0", + "type": "minor", "description": "Delimiter separated lists and expanded folder filter support" }, + { + "date": "2023-05-18T10:00:00.000Z", + "version": "v2.3.4", + "type": "patch" + }, + { + "date": "2023-05-16T10:00:00.000Z", + "version": "v2.3.3", + "type": "patch" + }, + { + "date": "2023-05-15T10:00:00.000Z", + "version": "v2.3.2", + "type": "patch" + }, + { + "date": "2023-05-12T10:00:00.000Z", + "version": "v2.3.1", + "type": "patch" + }, { "date": "2023-05-12T10:53:00.000Z", "version": "v2.3.0", + "type": "minor", "description": "File drag and drop support for File and Image widgets" }, { "date": "2023-05-05T23:00:00.000Z", "version": "v2.2.0", + "type": "minor", "description": "Multi image support and markdown toolbar customization" }, { "date": "2023-04-25T14:28:00.000Z", "version": "v2.1.0", + "type": "minor", "description": "Prefix option for UUID widget." }, + { + "date": "2023-04-21T10:00:00.000Z", + "version": "v2.0.1", + "type": "patch" + }, { "date": "2023-04-21T15:00:00.000Z", "version": "v2.0.0", + "type": "major", "description": "New UI and Media Library enchancements." }, + { + "date": "2023-03-31T10:00:00.000Z", + "version": "v1.2.14", + "type": "patch" + }, + { + "date": "2023-03-30T10:00:00.000Z", + "version": "v1.2.13", + "type": "patch" + }, + { + "date": "2023-02-27T10:00:00.000Z", + "version": "v1.2.11", + "type": "patch" + }, + { + "date": "2023-02-24T10:00:00.000Z", + "version": "v1.2.10", + "type": "patch" + }, + { + "date": "2023-02-24T10:00:00.000Z", + "version": "v1.2.9", + "type": "patch" + }, + { + "date": "2023-02-08T10:00:00.000Z", + "version": "v1.2.8", + "type": "patch" + }, + { + "date": "2023-02-06T10:00:00.000Z", + "version": "v1.2.7", + "type": "patch" + }, + { + "date": "2023-01-29T10:00:00.000Z", + "version": "v1.2.6", + "type": "patch" + }, + { + "date": "2023-01-28T10:00:00.000Z", + "version": "v1.2.5", + "type": "patch" + }, + { + "date": "2023-01-27T10:00:00.000Z", + "version": "v1.2.4", + "type": "patch" + }, + { + "date": "2023-01-26T10:00:00.000Z", + "version": "v1.2.3", + "type": "patch" + }, + { + "date": "2023-01-25T10:00:00.000Z", + "version": "v1.2.2", + "type": "patch" + }, + { + "date": "2023-01-25T10:00:00.000Z", + "version": "v1.2.1", + "type": "patch" + }, { "date": "2023-01-25T15:26:00.000Z", "version": "v1.2.0", + "type": "minor", "description": "Custom collection card templates." }, + { + "date": "2023-01-24T10:00:00.000Z", + "version": "v1.1.3", + "type": "patch" + }, + { + "date": "2023-01-23T10:00:00.000Z", + "version": "v1.1.2", + "type": "patch" + }, + { + "date": "2023-01-22T10:00:00.000Z", + "version": "v1.1.1", + "type": "patch" + }, { "date": "2023-01-18T15:44:00.000Z", "version": "v1.1.0", + "type": "minor", "description": "Gitea backend beta support. Side by side i18n editing." }, { "date": "2023-01-17T10:02:00.000Z", "version": "v1.0.0", + "type": "major", "description": "The first major release of Static CMS with an all-new UI, revamped documentation and much more." } ] diff --git a/packages/docs/src/interface.ts b/packages/docs/src/interface.ts index a00f5b1e..d2b14785 100644 --- a/packages/docs/src/interface.ts +++ b/packages/docs/src/interface.ts @@ -66,7 +66,8 @@ export interface HomepageData { export interface Release { readonly date: string; readonly version: string; - readonly description: string; + readonly type: 'major' | 'minor' | 'patch'; + readonly description?: string; } export interface DocsData { diff --git a/packages/docs/src/pages/index.tsx b/packages/docs/src/pages/index.tsx index 93fc67cf..c9ef2206 100644 --- a/packages/docs/src/pages/index.tsx +++ b/packages/docs/src/pages/index.tsx @@ -3,10 +3,11 @@ import Card from '@mui/material/Card'; import CardActionArea from '@mui/material/CardActionArea'; import CardContent from '@mui/material/CardContent'; import Chip from '@mui/material/Chip'; -import { styled, useTheme } from '@mui/material/styles'; import Typography from '@mui/material/Typography'; +import { styled, useTheme } from '@mui/material/styles'; import Image from 'next/image'; import Link from 'next/link'; +import { useMemo } from 'react'; import DateDisplay from '../components/DateDisplay'; import Container from '../components/layout/Container'; @@ -250,6 +251,8 @@ const StyledFeatureText = styled('div')` const Home = ({ docsGroups, searchablePages }: DocsMenuProps) => { const theme = useTheme(); + const majorMinorThemes = useMemo(() => releases.filter(r => r.type !== 'patch'), []); + return ( <Page url="/" docsGroups={docsGroups} searchablePages={searchablePages} fullWidth> <StyledHomagePageContent> @@ -325,11 +328,11 @@ const Home = ({ docsGroups, searchablePages }: DocsMenuProps) => { <Container> <StyledReleasesSectionContent> {[...Array(3)].map((_, index) => { - if (index >= releases.length) { + if (index >= majorMinorThemes.length) { return null; } - const release = releases[index]; + const release = majorMinorThemes[index]; return ( <CardActionArea key={release.version} diff --git a/packages/docs/src/pages/releases.tsx b/packages/docs/src/pages/releases.tsx index 5d8460fc..85a35d66 100644 --- a/packages/docs/src/pages/releases.tsx +++ b/packages/docs/src/pages/releases.tsx @@ -3,6 +3,8 @@ import AlertTitle from '@mui/material/AlertTitle'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import { styled } from '@mui/material/styles'; +import format from 'date-fns/format'; +import parseISO from 'date-fns/parseISO'; import Link from 'next/link'; import Container from '../components/layout/Container'; @@ -10,6 +12,7 @@ import Page from '../components/layout/Page'; import config from '../lib/config'; import { getDocsMenuStaticProps } from '../lib/docs'; import releaseData from '../lib/releases'; +import { isNotEmpty } from '../util/string.util'; import type { DocsMenuProps } from '../lib/docs'; @@ -105,7 +108,7 @@ const Releases = ({ docsGroups, searchablePages }: DocsMenuProps) => { A complete release history for Static CMS is available on GitHub. <br /> <br /> - Changelogs for recent major releases can also be found below. + Changelogs for all releases can also be found below. </Typography> </StyledTitle> </Container> @@ -126,25 +129,25 @@ const Releases = ({ docsGroups, searchablePages }: DocsMenuProps) => { <StyledReleaseSection key={release.version}> <Typography variant="h3" color="primary.main"> <strong>{release.version}</strong> - </Typography> - <Typography variant="body1" component="div" color="inherit"> - <Box - component="ul" - sx={{ - paddingLeft: '16px', - margin: '4px 0', - }} - > - <li> - <StyledLink - href={`${config.repo_url}/releases/tag/${release.version}`} - target="_blank" - > - Changelog - </StyledLink> - </li> + + <Box component="small" sx={{ fontSize: '16px', opacity: 0.75 }}> + {format(parseISO(release.date), 'MMM dd, yyyy')} </Box> </Typography> + <Typography + variant="body1" + component="div" + color="inherit" + sx={{ display: 'flex', flexDirection: 'column' }} + > + {isNotEmpty(release.description) ? release.description : null} + <StyledLink + href={`${config.repo_url}/releases/tag/${release.version}`} + target="_blank" + > + Changelog + </StyledLink> + </Typography> </StyledReleaseSection> ))} </StyledReleaseLinksContent>