Skip to content

Commit 18a93e4

Browse files
authored
Staging (#60)
* Feature/article content creator (#40) (#42) * Created new post src/lib/articles/content/articles/2020-7-1-An-Introduction-to-Value-Innovation}.json with TinaCMS * Fix bad name * Remove example post * Created new post src/lib/articles/content/articles/2020-08-31-test.json with TinaCMS * Created new post src/lib/articles/content/articles/2020-08-31-test-2.json with TinaCMS * Upload * Update from TinaCMS * Upload * Update from TinaCMS * Refactor to support content creation * Fix article slugs on archive * Make left aligned hero prettier * Fix vertical alignment * Update timestamp format * Update timestamp format * Add proper reading time and post date * Created new post src/lib/articles/content/articles/2020-08-31-test-3.json with TinaCMS * Fix on 0 length content: * Properly working reading time and english post time * Remove test files * Refactor data fetching to be more terse in controllers, and fix article creation oddities * Fix post time in kitchen sink * Created new post src/lib/articles/content/articles/2020-09-01-test.json with TinaCMS * Fix branching * Remove test doc * Set preview branch on creation of new file * Remove annoying mac file * Fix kitchen sink * Remove console.log * Fetch articles from remote in editing mode * Fix path * Enable incremental SSG for articles * Fix fallback behaviour * Enable dynamic paging * Enable dynamic paging * Try fixing 500? * Refactor to a packages setup * Fix SSR * Fix syntax error * Fix build * Fix build * Fix build * Fix build * Fix styling and editing * Fix build * Fix build * Fix cms display * Fix article creation * Fix conflict * Fix typing
1 parent 3e81672 commit 18a93e4

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

packages/cdm-ui/cms/content-creators/article.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createHash } from "crypto";
22
import { ContentCreatorPlugin, TinaCMS } from "tinacms";
33
import { GithubClient } from "react-tinacms-github";
44
import slugify from "slugify";
5-
import { Article } from "../../articles";
5+
import { Article, articlesRelDir } from "../../articles";
66

77
export const ArticleContentCreator: ContentCreatorPlugin<Article> = {
88
__type: "content-creator",
@@ -18,7 +18,7 @@ export const ArticleContentCreator: ContentCreatorPlugin<Article> = {
1818
const now = new Date();
1919
const dateString = now.toISOString().slice(0,10);
2020
const slug = `${dateString}-${slugify(values.title)}`.toLowerCase();
21-
const filePath = `src/lib/articles/content/articles/${slug}.json`;
21+
const filePath = `${articlesRelDir}/${slug}.json`;
2222
const SHA = createHash("sha256");
2323
const sha = SHA.update(filePath).digest().toString();
2424
const branch = `article/${slug}`;

packages/cdm-ui/cms/providers/cms.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import { GithubToolbarProvider } from "./github";
77

88
export interface CmsProviderProps {
99
isEditing: boolean;
10+
sidebar?: boolean;
11+
toolbar?: boolean
1012
error: Error,
1113
children: React.ReactElement;
1214
}
1315

14-
export function CmsProvider({ isEditing, error, children }: CmsProviderProps) {
16+
export function CmsProvider({ isEditing, sidebar = true, toolbar = true, error, children }: CmsProviderProps) {
1517
const cms = useMemo(() => {
1618
const github = new GithubClient({
1719
proxy: '/api/proxy-github',
@@ -23,8 +25,8 @@ export function CmsProvider({ isEditing, error, children }: CmsProviderProps) {
2325
const githubMediaStore = new GithubMediaStore(github);
2426
const cms = new TinaCMS({
2527
enabled: isEditing,
26-
sidebar: !isEditing,
27-
toolbar: !isEditing,
28+
sidebar,
29+
toolbar,
2830
media: githubMediaStore
2931
});
3032

src/lib/articles/content/articles/2020-12-14-test-2005.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)