From 7b10d2e61db960885d19ac7d223216eb4f50f126 Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 12:28:54 +0700 Subject: [PATCH 1/9] refactor(homepage): pass assets to admin page --- homepage/src/pages/admin/index.jsx | 119 ++++++--- homepage/src/pages/admin/mock_cards.json | 321 ----------------------- 2 files changed, 86 insertions(+), 354 deletions(-) delete mode 100644 homepage/src/pages/admin/mock_cards.json diff --git a/homepage/src/pages/admin/index.jsx b/homepage/src/pages/admin/index.jsx index f954acc3..771f76d9 100644 --- a/homepage/src/pages/admin/index.jsx +++ b/homepage/src/pages/admin/index.jsx @@ -7,14 +7,15 @@ import FooterLinks from '../../layouts/footer/footerLinks'; import { componentMapper } from '../../lib/componentMapper'; import contentMapper from '../../layouts/contentMapper'; import Card from '../../components/cards/card'; +import { fetchCards } from '../../lib/fetchCards'; import { processCard } from '../../lib/processCard'; -import mockCards from './mock_cards.json'; +const PagePreview = ({ entry, assetsByLocale }) => { + const cards = assetsByLocale['en'].cards; -const PagePreview = ({ entry }) => { const layoutList = entry.getIn(['data', 'layout_list']); const sections = layoutList?.map((layout) => { - const component = componentMapper(layout.toJS(), mockCards); + const component = componentMapper(layout.toJS(), cards); return contentMapper(component); }); return
{sections}
; @@ -34,44 +35,96 @@ const FooterPreview = ({ entry }) => { return ; }; -const CardPreview = ({ entry, getAsset }) => { +const CardPreview = ({ entry, getAsset, assetsByLocale }) => { + const cards = assetsByLocale['en'].cards; + const data = entry.getIn(['data']).toJS(); const content = data.body; - // TODO: Cards could not be retrieved from the CMS. Set it as empty for now. - const card = processCard({ data, content }, []); + const card = processCard({ data, content }, cards); card.data.image = getAsset(card.data.image).toString(); return ; }; -const CMS = dynamic( - () => - import('decap-cms-app').then((cms) => { - cms.init({ config }); - cms.registerPreviewStyle( - 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css', - ); - cms.registerPreviewStyle( - 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css', - ); - cms.registerPreviewStyle( - 'https://fonts.googleapis.com/css?family=Montserrat:400,700', - ); - cms.registerPreviewStyle( - 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700', - ); - cms.registerPreviewStyle('/css/style.css'); - - cms.registerPreviewTemplate('pages', PagePreview); - cms.registerPreviewTemplate('footer', FooterPreview); - cms.registerPreviewTemplate('cards', CardPreview); - }), - { ssr: false, loading: () =>

Loading...

}, -); - -const Admin = () => { +const withAssetsByLocale = (Component, assetsByLocale) => { + const WrappedComponent = (props) => ( + + ); + WrappedComponent.displayName = `withAssetsByLocale(${Component.displayName})`; + return WrappedComponent; +}; + +const DecapCms = (assetsByLocale) => + dynamic( + () => + import('decap-cms-app').then((cms) => { + cms.init({ config }); + cms.registerPreviewStyle( + 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css', + ); + cms.registerPreviewStyle( + 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css', + ); + cms.registerPreviewStyle( + 'https://fonts.googleapis.com/css?family=Montserrat:400,700', + ); + cms.registerPreviewStyle( + 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700', + ); + cms.registerPreviewStyle('/css/style.css'); + + console.log('assetsByLocale', assetsByLocale); + cms.registerPreviewTemplate( + 'pages', + withAssetsByLocale(PagePreview, assetsByLocale), + ); + cms.registerPreviewTemplate( + 'footer', + withAssetsByLocale(FooterPreview, assetsByLocale), + ); + cms.registerPreviewTemplate( + 'cards', + withAssetsByLocale(CardPreview, assetsByLocale), + ); + }), + { ssr: false, loading: () =>

Loading...

}, + ); + +/** + * + * @type {import('next').GetStaticProps} + */ +export const getStaticProps = async ({ locales }) => { + const assetsTasks = locales.map(async (locale) => { + const rawCards = fetchCards(locale); + const cardTasks = rawCards.map(async (card) => { + return processCard(card, rawCards); + }); + const cards = await Promise.all(cardTasks); + + return { + locale, + cards, + }; + }); + + const assets = await Promise.all(assetsTasks); + const assetsByLocale = assets.reduce((assets, asset) => { + assets[asset.locale] = asset; + return assets; + }, {}); + + return { + props: { + assetsByLocale, + }, + }; +}; + +const Admin = ({ assetsByLocale }) => { + const Cms = DecapCms(assetsByLocale); return ( <> @@ -81,7 +134,7 @@ const Admin = () => { id="netlify-identity-widget" src="https://identity.netlify.com/v1/netlify-identity-widget.js" /> - + ); }; diff --git a/homepage/src/pages/admin/mock_cards.json b/homepage/src/pages/admin/mock_cards.json deleted file mode 100644 index 32704338..00000000 --- a/homepage/src/pages/admin/mock_cards.json +++ /dev/null @@ -1,321 +0,0 @@ -[ - { - "data": { - "image": "/images/uploads/開放資料-common-voice.jpg", - "title": "(MOCK) Common Voice (MOCK)", - "description": "(MOCK) 蒐集各語言真人發音資料庫,讓電腦學會最真實的說話方式 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open data", "designer", "writer", "engineer", "basic"], - "id": "common-voice" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open data\n- designer\n- writer\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放政府-專案卡-39.jpg", - "title": "(MOCK) Democracy OS (MOCK)", - "description": "(MOCK) 民主參與系統,可討論政策、模擬投票、進行參與式預算等 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open gov", "civil servants", "advocator", "engineer", "basic"], - "id": "democracy-os" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- civil servants\n- advocator\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放原始碼-firefox.jpg", - "title": "(MOCK) Firefox (MOCK)", - "description": "(MOCK) 自由及開放原始碼的網頁瀏覽器 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open source", "marketing", "designer", "engineer", "advance"], - "id": "firefox" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- marketing\n- designer\n- engineer\n- advance" - }, - { - "data": { - "image": "/images/uploads/事件卡-github-當機了.jpg", - "title": "(MOCK) GitHub 當機了 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "event", - "id": "github-當機了" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: event. \n\nTags: No tags" - }, - { - "data": { - "image": "/images/uploads/專案卡-12.jpg", - "title": "(MOCK) Inkscape (MOCK)", - "description": "(MOCK) 一款通用公眾授權條款釋出的開源向量圖形編輯器 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open source", "designer", "writer", "engineer", "basic"], - "id": "inkscape" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- designer\n- writer\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/專案卡-10.jpg", - "title": "(MOCK) LibreOffice (MOCK)", - "description": "(MOCK) 一套自由及開放原始碼的辦公軟體。 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open source", "designer", "writer", "engineer", "advance"], - "id": "libreoffice" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- designer\n- writer\n- engineer\n- advance" - }, - { - "data": { - "image": "/images/uploads/專案卡-07.jpg", - "title": "(MOCK) OCF Lab (MOCK)", - "description": "(MOCK) 由開放文化基金會創立,關注開放的新聞平台。 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open source", "designer", "writer", "advocator", "basic"], - "id": "ocf-lab" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- designer\n- writer\n- advocator\n- basic" - }, - { - "data": { - "image": "/images/uploads/專案卡-03.jpg", - "title": "(MOCK) Open Hack Farm (MOCK)", - "description": "(MOCK) 「開放農業實驗基地」致力開源及開放資料的農業應用 (MOCK)", - "draft": false, - "type": "project", - "tags": [ - "open source", - "civil servants", - "advocator", - "engineer", - "basic" - ], - "id": "open-hack-farm" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- civil servants\n- advocator\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放政府-vtaiwan.jpg", - "title": "(MOCK) vTaiwan (MOCK)", - "description": "(MOCK) 供民眾針對台灣法規表達意見、納入政策討論過程的平台 (MOCK)", - "draft": false, - "type": "project", - "tags": [ - "open gov", - "legal", - "civil servants", - "writer", - "advocator", - "advance" - ], - "id": "vtaiwan" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- legal\n- civil servants\n- writer\n- advocator\n- advance" - }, - { - "data": { - "image": "/images/uploads/專案卡-04.jpg", - "title": "(MOCK) 了解開源授權 (MOCK)", - "description": "(MOCK) 授權條款是開源不可缺少的要件,與自由程度直接相關 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open source", "writer", "advocator", "engineer", "basic"], - "id": "了解開源授權" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open source\n- writer\n- advocator\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放資料-全民追公車.jpg", - "title": "(MOCK) 全民追公車 (MOCK)", - "description": "(MOCK) 利用交通局開放資料,做大眾運輸路線、位置追蹤 App (MOCK)", - "draft": false, - "type": "project", - "tags": ["open data", "designer", "engineer", "civil servants", "basic"], - "id": "全民追公車" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open data\n- designer\n- engineer\n- civil servants\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放政府-台灣成功加入「開放政府夥伴聯盟」.jpg", - "title": "(MOCK) 台灣成功加入「開放政府夥伴聯盟」 (MOCK)", - "description": "(MOCK) 這是一套訴求「透明、參與、課責、涵容」的國際標準 (MOCK)", - "draft": false, - "type": "project", - "tags": [ - "open gov", - "marketing", - "legal", - "writer", - "advocator", - "advance" - ], - "id": "台灣成功加入「開放政府夥伴聯盟」" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- marketing\n- legal\n- writer\n- advocator\n- advance" - }, - { - "data": { - "image": "/images/uploads/開放資料-國家寶藏.jpg", - "title": "(MOCK) 國家寶藏 (MOCK)", - "description": "(MOCK) 讓志工到美國翻拍流落的臺灣史料,公開給大眾免費使用 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open data", "basic", "writer", "advocator", "engineer"], - "id": "國家寶藏" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open data\n- basic\n- writer\n- advocator\n- engineer" - }, - { - "data": { - "image": "/images/uploads/開放資料-在專制國家推動開放資料專法.jpg", - "title": "(MOCK) 在專制國家推動開放資料專法 (MOCK)", - "description": "(MOCK) 把政府長年蒐集的各種資料,攤在陽光下給民眾檢視使用 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open data", "legal", "civil servants", "advocator", "advance"], - "id": "在專制國家推動開放資料專法" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open data\n- legal\n- civil servants\n- advocator\n- advance" - }, - { - "data": { - "image": "/images/uploads/開放政府-實價登錄到門牌.jpg", - "title": "(MOCK) 實價登錄到門牌 (MOCK)", - "description": "(MOCK) 揭露每戶房屋的成交價格,以推動房價交易透明化 (MOCK)", - "draft": false, - "type": "project", - "tags": [ - "open gov", - "designer", - "writer", - "advocator", - "engineer", - "basic" - ], - "id": "實價登錄到門牌" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- designer\n- writer\n- advocator\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放資料-掃了再買.jpg", - "title": "(MOCK) 掃了再買 (MOCK)", - "description": "(MOCK) 一掃就讓你看光商品企業違規裁罰紀錄的良心購物 App (MOCK)", - "draft": false, - "type": "project", - "tags": ["marketing", "advocator", "engineer", "advance", "open data"], - "id": "掃了再買" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - marketing\n- advocator\n- engineer\n- advance\n- open data" - }, - { - "data": { - "image": "/images/uploads/人力卡-文字工作者.jpg", - "title": "(MOCK) 文字工作者 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "job", - "tags": ["writer"], - "id": "文字工作者" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: job. \n\nTags: - writer" - }, - { - "data": { - "image": "/images/uploads/專案卡-33.jpg", - "title": "(MOCK) 民意代表投票指南 (MOCK)", - "description": "(MOCK) 彙整候選人資料,幫助選民好好做功課、投下神聖的一票 (MOCK)", - "draft": false, - "type": "project", - "tags": [ - "open gov", - "designer", - "civil servants", - "writer", - "advocator", - "basic" - ], - "id": "民意代表投票指南" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- designer\n- civil servants\n- writer\n- advocator\n- basic" - }, - { - "data": { - "image": "/images/uploads/事件卡-猛漢肺炎來襲.jpg", - "title": "(MOCK) 猛漢肺炎來襲 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "event", - "id": "猛漢肺炎來襲" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: event. \n\nTags: No tags" - }, - { - "data": { - "image": "/images/uploads/人力-行銷公關.jpg", - "title": "(MOCK) 行銷公關 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "job", - "tags": ["marketing"], - "id": "行銷公關" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: job. \n\nTags: - marketing" - }, - { - "data": { - "image": "/images/uploads/人力卡-議題工作者.jpg", - "title": "(MOCK) 議題工作者 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "job", - "tags": ["advocator"], - "id": "議題工作者" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: job. \n\nTags: - advocator" - }, - { - "data": { - "image": "/images/uploads/開放政府-資料申請小幫手.jpg", - "title": "(MOCK) 資料申請小幫手 (MOCK)", - "description": "(MOCK) 一套協助民眾索取政府資料更簡便、更視覺化的機制 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open gov", "designer", "civil servants", "engineer", "basic"], - "id": "資料申請小幫手" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open gov\n- designer\n- civil servants\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/開放資料-開放館藏.jpg", - "title": "(MOCK) 開放館藏 (MOCK)", - "description": "(MOCK) 開放博物館的文物資料並數位化,讓愛好者拿來合法使用 (MOCK)", - "draft": false, - "type": "project", - "tags": ["open data", "designer", "civil servants", "engineer", "basic"], - "id": "開放館藏" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: project. \n\nTags: - open data\n- designer\n- civil servants\n- engineer\n- basic" - }, - { - "data": { - "image": "/images/uploads/事件卡-鯊魚咬斷海底電纜.jpg", - "title": "(MOCK) 鯊魚咬斷海底電纜 (MOCK)", - "description": "(MOCK) (MOCK)", - "draft": false, - "type": "event", - "id": "鯊魚咬斷海底電纜" - }, - "content": "This is mock content. Please visit Cards collection to update cards \n\nType: event. \n\nTags: No tags" - } -] From 74454274870ad9d44ab4d7c420ce4ef9ec78c4fe Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 12:36:48 +0700 Subject: [PATCH 2/9] refactor(homepage): move DecapCms components off from admin/index --- homepage/src/pages/admin/DecapCms.jsx | 49 ++++++++++ homepage/src/pages/admin/config.json | 6 +- homepage/src/pages/admin/index.jsx | 89 +------------------ .../src/pages/admin/preview/CardPreview.jsx | 16 ++++ .../src/pages/admin/preview/FooterPreview.jsx | 15 ++++ .../src/pages/admin/preview/PagePreview.jsx | 14 +++ 6 files changed, 100 insertions(+), 89 deletions(-) create mode 100644 homepage/src/pages/admin/DecapCms.jsx create mode 100644 homepage/src/pages/admin/preview/CardPreview.jsx create mode 100644 homepage/src/pages/admin/preview/FooterPreview.jsx create mode 100644 homepage/src/pages/admin/preview/PagePreview.jsx diff --git a/homepage/src/pages/admin/DecapCms.jsx b/homepage/src/pages/admin/DecapCms.jsx new file mode 100644 index 00000000..30b0116c --- /dev/null +++ b/homepage/src/pages/admin/DecapCms.jsx @@ -0,0 +1,49 @@ +import dynamic from 'next/dynamic'; +import { PagePreview } from './preview/PagePreview'; +import { FooterPreview } from './preview/FooterPreview'; +import { CardPreview } from './preview/CardPreview'; + +import config from './config.json'; + +const withAssetsByLocale = (Component, assetsByLocale) => { + const WrappedComponent = (props) => ( + + ); + WrappedComponent.displayName = `withAssetsByLocale(${Component.displayName})`; + return WrappedComponent; +}; + +export const DecapCms = (assetsByLocale) => + dynamic( + () => + import('decap-cms-app').then((cms) => { + cms.init({ config }); + cms.registerPreviewStyle( + 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css', + ); + cms.registerPreviewStyle( + 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css', + ); + cms.registerPreviewStyle( + 'https://fonts.googleapis.com/css?family=Montserrat:400,700', + ); + cms.registerPreviewStyle( + 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700', + ); + cms.registerPreviewStyle('/css/style.css'); + + cms.registerPreviewTemplate( + 'pages', + withAssetsByLocale(PagePreview, assetsByLocale), + ); + cms.registerPreviewTemplate( + 'footer', + withAssetsByLocale(FooterPreview, assetsByLocale), + ); + cms.registerPreviewTemplate( + 'cards', + withAssetsByLocale(CardPreview, assetsByLocale), + ); + }), + { ssr: false, loading: () =>

Loading...

}, + ); diff --git a/homepage/src/pages/admin/config.json b/homepage/src/pages/admin/config.json index 575bbfd5..77a7170e 100644 --- a/homepage/src/pages/admin/config.json +++ b/homepage/src/pages/admin/config.json @@ -36,7 +36,11 @@ }, { "label": "Name", "name": "name", "widget": "string", "i18n": true }, { - "label": "Page order", "name": "page_order", "widget": "number", "value_type": "int", "i18n": "duplicate" + "label": "Page order", + "name": "page_order", + "widget": "number", + "value_type": "int", + "i18n": "duplicate" }, { "label": "Layout & Content", diff --git a/homepage/src/pages/admin/index.jsx b/homepage/src/pages/admin/index.jsx index 771f76d9..a55cdb22 100644 --- a/homepage/src/pages/admin/index.jsx +++ b/homepage/src/pages/admin/index.jsx @@ -1,96 +1,9 @@ -import dynamic from 'next/dynamic'; import Head from 'next/head'; import Script from 'next/script'; -import config from './config.json'; -import FooterLinks from '../../layouts/footer/footerLinks'; -import { componentMapper } from '../../lib/componentMapper'; -import contentMapper from '../../layouts/contentMapper'; -import Card from '../../components/cards/card'; import { fetchCards } from '../../lib/fetchCards'; import { processCard } from '../../lib/processCard'; - -const PagePreview = ({ entry, assetsByLocale }) => { - const cards = assetsByLocale['en'].cards; - - const layoutList = entry.getIn(['data', 'layout_list']); - const sections = layoutList?.map((layout) => { - const component = componentMapper(layout.toJS(), cards); - return contentMapper(component); - }); - return
{sections}
; -}; - -const FooterPreview = ({ entry }) => { - const footer = entry.getIn(['data', 'footer']); - const links = footer - ?.get('links') - .map((link) => { - return { - displayText: link.get('display_text')?.toString(), - url: link.get('url')?.toString(), - }; - }) - .toArray(); - return ; -}; - -const CardPreview = ({ entry, getAsset, assetsByLocale }) => { - const cards = assetsByLocale['en'].cards; - - const data = entry.getIn(['data']).toJS(); - const content = data.body; - - const card = processCard({ data, content }, cards); - - card.data.image = getAsset(card.data.image).toString(); - - return ; -}; - -const withAssetsByLocale = (Component, assetsByLocale) => { - const WrappedComponent = (props) => ( - - ); - WrappedComponent.displayName = `withAssetsByLocale(${Component.displayName})`; - return WrappedComponent; -}; - -const DecapCms = (assetsByLocale) => - dynamic( - () => - import('decap-cms-app').then((cms) => { - cms.init({ config }); - cms.registerPreviewStyle( - 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css', - ); - cms.registerPreviewStyle( - 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css', - ); - cms.registerPreviewStyle( - 'https://fonts.googleapis.com/css?family=Montserrat:400,700', - ); - cms.registerPreviewStyle( - 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700', - ); - cms.registerPreviewStyle('/css/style.css'); - - console.log('assetsByLocale', assetsByLocale); - cms.registerPreviewTemplate( - 'pages', - withAssetsByLocale(PagePreview, assetsByLocale), - ); - cms.registerPreviewTemplate( - 'footer', - withAssetsByLocale(FooterPreview, assetsByLocale), - ); - cms.registerPreviewTemplate( - 'cards', - withAssetsByLocale(CardPreview, assetsByLocale), - ); - }), - { ssr: false, loading: () =>

Loading...

}, - ); +import { DecapCms } from './DecapCms'; /** * diff --git a/homepage/src/pages/admin/preview/CardPreview.jsx b/homepage/src/pages/admin/preview/CardPreview.jsx new file mode 100644 index 00000000..9bf2be6d --- /dev/null +++ b/homepage/src/pages/admin/preview/CardPreview.jsx @@ -0,0 +1,16 @@ +import Card from '../../../components/cards/card'; +import { processCard } from '../../../lib/processCard'; + +export const CardPreview = ({ entry, getAsset, assetsByLocale }) => { + const locale = 'en'; + const assets = assetsByLocale['en']; + + const data = entry.getIn(['data']).toJS(); + const content = data.body; + + const card = processCard({ data, content }, assets.cards); + + card.data.image = getAsset(card.data.image).toString(); + + return ; +}; diff --git a/homepage/src/pages/admin/preview/FooterPreview.jsx b/homepage/src/pages/admin/preview/FooterPreview.jsx new file mode 100644 index 00000000..42013d30 --- /dev/null +++ b/homepage/src/pages/admin/preview/FooterPreview.jsx @@ -0,0 +1,15 @@ +import FooterLinks from '../../../layouts/footer/footerLinks'; + +export const FooterPreview = ({ entry }) => { + const footer = entry.getIn(['data', 'footer']); + const links = footer + ?.get('links') + .map((link) => { + return { + displayText: link.get('display_text')?.toString(), + url: link.get('url')?.toString(), + }; + }) + .toArray(); + return ; +}; diff --git a/homepage/src/pages/admin/preview/PagePreview.jsx b/homepage/src/pages/admin/preview/PagePreview.jsx new file mode 100644 index 00000000..2326cf67 --- /dev/null +++ b/homepage/src/pages/admin/preview/PagePreview.jsx @@ -0,0 +1,14 @@ +import { componentMapper } from '../../../lib/componentMapper'; +import contentMapper from '../../../layouts/contentMapper'; + +export const PagePreview = ({ entry, assetsByLocale }) => { + const locale = 'en'; + const assets = assetsByLocale[locale]; + + const layoutList = entry.getIn(['data', 'layout_list']); + const sections = layoutList?.map((layout) => { + const component = componentMapper(layout.toJS(), assets.cards); + return contentMapper(component); + }); + return
{sections}
; +}; From 2805feb1269174984421a53719d46efa6648c11d Mon Sep 17 00:00:00 2001 From: ljc1991 Date: Thu, 2 Nov 2023 16:59:43 +0800 Subject: [PATCH 3/9] fix: fix avatar layout in md screen --- homepage/public/css/style.css | 3 --- homepage/src/components/cards/defaultCard.jsx | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/homepage/public/css/style.css b/homepage/public/css/style.css index d40b4842..fd61cadf 100644 --- a/homepage/public/css/style.css +++ b/homepage/public/css/style.css @@ -963,9 +963,6 @@ code { } } @media only screen and (min-width: 768px) and (max-width: 991px) { - .avatar-tablet { - transform: translate(-13%); - } } @media only screen and (max-width: 767px) { .container { diff --git a/homepage/src/components/cards/defaultCard.jsx b/homepage/src/components/cards/defaultCard.jsx index f31cd041..3c0c357b 100644 --- a/homepage/src/components/cards/defaultCard.jsx +++ b/homepage/src/components/cards/defaultCard.jsx @@ -15,7 +15,7 @@ const DefaultCard = ({ card }) => (

{card.data.title}

From a873480c618d8e544cbe306371c7575baecd7b19 Mon Sep 17 00:00:00 2001 From: ljc1991 Date: Thu, 2 Nov 2023 17:29:43 +0800 Subject: [PATCH 4/9] fix: fix locale variable --- homepage/src/pages/admin/preview/CardPreview.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homepage/src/pages/admin/preview/CardPreview.jsx b/homepage/src/pages/admin/preview/CardPreview.jsx index 9bf2be6d..0b6821d8 100644 --- a/homepage/src/pages/admin/preview/CardPreview.jsx +++ b/homepage/src/pages/admin/preview/CardPreview.jsx @@ -3,7 +3,7 @@ import { processCard } from '../../../lib/processCard'; export const CardPreview = ({ entry, getAsset, assetsByLocale }) => { const locale = 'en'; - const assets = assetsByLocale['en']; + const assets = assetsByLocale[locale]; const data = entry.getIn(['data']).toJS(); const content = data.body; From 6924fdf7eedff4e57fde46218062d23957f07e7d Mon Sep 17 00:00:00 2001 From: ljc1991 Date: Thu, 2 Nov 2023 17:43:32 +0800 Subject: [PATCH 5/9] fix: change export to default export --- homepage/src/pages/admin/DecapCms.jsx | 10 ++++++---- homepage/src/pages/admin/index.jsx | 2 +- homepage/src/pages/admin/preview/CardPreview.jsx | 4 +++- homepage/src/pages/admin/preview/FooterPreview.jsx | 4 +++- homepage/src/pages/admin/preview/PagePreview.jsx | 4 +++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/homepage/src/pages/admin/DecapCms.jsx b/homepage/src/pages/admin/DecapCms.jsx index 30b0116c..cd723b61 100644 --- a/homepage/src/pages/admin/DecapCms.jsx +++ b/homepage/src/pages/admin/DecapCms.jsx @@ -1,7 +1,7 @@ import dynamic from 'next/dynamic'; -import { PagePreview } from './preview/PagePreview'; -import { FooterPreview } from './preview/FooterPreview'; -import { CardPreview } from './preview/CardPreview'; +import PagePreview from './preview/PagePreview'; +import FooterPreview from './preview/FooterPreview'; +import CardPreview from './preview/CardPreview'; import config from './config.json'; @@ -13,7 +13,7 @@ const withAssetsByLocale = (Component, assetsByLocale) => { return WrappedComponent; }; -export const DecapCms = (assetsByLocale) => +const DecapCms = (assetsByLocale) => dynamic( () => import('decap-cms-app').then((cms) => { @@ -47,3 +47,5 @@ export const DecapCms = (assetsByLocale) => }), { ssr: false, loading: () =>

Loading...

}, ); + +export default DecapCms; diff --git a/homepage/src/pages/admin/index.jsx b/homepage/src/pages/admin/index.jsx index a55cdb22..6dcd2d62 100644 --- a/homepage/src/pages/admin/index.jsx +++ b/homepage/src/pages/admin/index.jsx @@ -3,7 +3,7 @@ import Script from 'next/script'; import { fetchCards } from '../../lib/fetchCards'; import { processCard } from '../../lib/processCard'; -import { DecapCms } from './DecapCms'; +import DecapCms from './DecapCms'; /** * diff --git a/homepage/src/pages/admin/preview/CardPreview.jsx b/homepage/src/pages/admin/preview/CardPreview.jsx index 0b6821d8..593dde80 100644 --- a/homepage/src/pages/admin/preview/CardPreview.jsx +++ b/homepage/src/pages/admin/preview/CardPreview.jsx @@ -1,7 +1,7 @@ import Card from '../../../components/cards/card'; import { processCard } from '../../../lib/processCard'; -export const CardPreview = ({ entry, getAsset, assetsByLocale }) => { +const CardPreview = ({ entry, getAsset, assetsByLocale }) => { const locale = 'en'; const assets = assetsByLocale[locale]; @@ -14,3 +14,5 @@ export const CardPreview = ({ entry, getAsset, assetsByLocale }) => { return ; }; + +export default CardPreview; diff --git a/homepage/src/pages/admin/preview/FooterPreview.jsx b/homepage/src/pages/admin/preview/FooterPreview.jsx index 42013d30..c88a81a3 100644 --- a/homepage/src/pages/admin/preview/FooterPreview.jsx +++ b/homepage/src/pages/admin/preview/FooterPreview.jsx @@ -1,6 +1,6 @@ import FooterLinks from '../../../layouts/footer/footerLinks'; -export const FooterPreview = ({ entry }) => { +const FooterPreview = ({ entry }) => { const footer = entry.getIn(['data', 'footer']); const links = footer ?.get('links') @@ -13,3 +13,5 @@ export const FooterPreview = ({ entry }) => { .toArray(); return ; }; + +export default FooterPreview; diff --git a/homepage/src/pages/admin/preview/PagePreview.jsx b/homepage/src/pages/admin/preview/PagePreview.jsx index 2326cf67..3cc57d89 100644 --- a/homepage/src/pages/admin/preview/PagePreview.jsx +++ b/homepage/src/pages/admin/preview/PagePreview.jsx @@ -1,7 +1,7 @@ import { componentMapper } from '../../../lib/componentMapper'; import contentMapper from '../../../layouts/contentMapper'; -export const PagePreview = ({ entry, assetsByLocale }) => { +const PagePreview = ({ entry, assetsByLocale }) => { const locale = 'en'; const assets = assetsByLocale[locale]; @@ -12,3 +12,5 @@ export const PagePreview = ({ entry, assetsByLocale }) => { }); return
{sections}
; }; + +export default PagePreview; From fd13d59451ae016f75a5ea5cb798563882a08eb1 Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 17:57:30 +0700 Subject: [PATCH 6/9] fix(homepage): component files should not be in page folder --- homepage/src/{pages/admin => CMS}/DecapCms.jsx | 0 homepage/src/{pages/admin => CMS}/config.json | 0 homepage/src/{pages/admin => CMS}/preview/CardPreview.jsx | 4 ++-- homepage/src/{pages/admin => CMS}/preview/FooterPreview.jsx | 2 +- homepage/src/{pages/admin => CMS}/preview/PagePreview.jsx | 4 ++-- homepage/src/pages/admin/index.jsx | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename homepage/src/{pages/admin => CMS}/DecapCms.jsx (100%) rename homepage/src/{pages/admin => CMS}/config.json (100%) rename homepage/src/{pages/admin => CMS}/preview/CardPreview.jsx (78%) rename homepage/src/{pages/admin => CMS}/preview/FooterPreview.jsx (85%) rename homepage/src/{pages/admin => CMS}/preview/PagePreview.jsx (76%) diff --git a/homepage/src/pages/admin/DecapCms.jsx b/homepage/src/CMS/DecapCms.jsx similarity index 100% rename from homepage/src/pages/admin/DecapCms.jsx rename to homepage/src/CMS/DecapCms.jsx diff --git a/homepage/src/pages/admin/config.json b/homepage/src/CMS/config.json similarity index 100% rename from homepage/src/pages/admin/config.json rename to homepage/src/CMS/config.json diff --git a/homepage/src/pages/admin/preview/CardPreview.jsx b/homepage/src/CMS/preview/CardPreview.jsx similarity index 78% rename from homepage/src/pages/admin/preview/CardPreview.jsx rename to homepage/src/CMS/preview/CardPreview.jsx index 593dde80..2c3f418f 100644 --- a/homepage/src/pages/admin/preview/CardPreview.jsx +++ b/homepage/src/CMS/preview/CardPreview.jsx @@ -1,5 +1,5 @@ -import Card from '../../../components/cards/card'; -import { processCard } from '../../../lib/processCard'; +import Card from '../../components/cards/card'; +import { processCard } from '../../lib/processCard'; const CardPreview = ({ entry, getAsset, assetsByLocale }) => { const locale = 'en'; diff --git a/homepage/src/pages/admin/preview/FooterPreview.jsx b/homepage/src/CMS/preview/FooterPreview.jsx similarity index 85% rename from homepage/src/pages/admin/preview/FooterPreview.jsx rename to homepage/src/CMS/preview/FooterPreview.jsx index c88a81a3..b798d968 100644 --- a/homepage/src/pages/admin/preview/FooterPreview.jsx +++ b/homepage/src/CMS/preview/FooterPreview.jsx @@ -1,4 +1,4 @@ -import FooterLinks from '../../../layouts/footer/footerLinks'; +import FooterLinks from '../../layouts/footer/footerLinks'; const FooterPreview = ({ entry }) => { const footer = entry.getIn(['data', 'footer']); diff --git a/homepage/src/pages/admin/preview/PagePreview.jsx b/homepage/src/CMS/preview/PagePreview.jsx similarity index 76% rename from homepage/src/pages/admin/preview/PagePreview.jsx rename to homepage/src/CMS/preview/PagePreview.jsx index 3cc57d89..45d3c313 100644 --- a/homepage/src/pages/admin/preview/PagePreview.jsx +++ b/homepage/src/CMS/preview/PagePreview.jsx @@ -1,5 +1,5 @@ -import { componentMapper } from '../../../lib/componentMapper'; -import contentMapper from '../../../layouts/contentMapper'; +import { componentMapper } from '../../lib/componentMapper'; +import contentMapper from '../../layouts/contentMapper'; const PagePreview = ({ entry, assetsByLocale }) => { const locale = 'en'; diff --git a/homepage/src/pages/admin/index.jsx b/homepage/src/pages/admin/index.jsx index 6dcd2d62..44d8b1e1 100644 --- a/homepage/src/pages/admin/index.jsx +++ b/homepage/src/pages/admin/index.jsx @@ -3,7 +3,7 @@ import Script from 'next/script'; import { fetchCards } from '../../lib/fetchCards'; import { processCard } from '../../lib/processCard'; -import DecapCms from './DecapCms'; +import DecapCms from '../../CMS/DecapCms'; /** * From e634217aa0c3d2afc921b20557aac4ff27c8d6cf Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 18:05:26 +0700 Subject: [PATCH 7/9] refactor(homepage): renmae admin/index.jsx to be admin.jsx --- homepage/src/pages/{admin/index.jsx => admin.jsx} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename homepage/src/pages/{admin/index.jsx => admin.jsx} (88%) diff --git a/homepage/src/pages/admin/index.jsx b/homepage/src/pages/admin.jsx similarity index 88% rename from homepage/src/pages/admin/index.jsx rename to homepage/src/pages/admin.jsx index 44d8b1e1..87f19150 100644 --- a/homepage/src/pages/admin/index.jsx +++ b/homepage/src/pages/admin.jsx @@ -1,9 +1,9 @@ import Head from 'next/head'; import Script from 'next/script'; -import { fetchCards } from '../../lib/fetchCards'; -import { processCard } from '../../lib/processCard'; -import DecapCms from '../../CMS/DecapCms'; +import { fetchCards } from '../lib/fetchCards'; +import { processCard } from '../lib/processCard'; +import DecapCms from '../CMS/DecapCms'; /** * From c5ae7bd20e001756ab61c20aa05bd2b3b73d8bbf Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 22:12:48 +0700 Subject: [PATCH 8/9] fix(homepage): cms cards collection - card content should be optional --- "homepage/_cards/en/\345\205\254\345\213\231\345\223\241.md" | 1 - "homepage/_cards/en/\345\267\245\347\250\213\345\270\253.md" | 1 - ...6\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" | 1 - .../en/\346\263\225\345\213\231\344\272\272\345\223\241.md" | 1 - .../en/\347\276\216\350\241\223\350\250\255\350\250\210.md" | 1 - .../en/\350\241\214\351\212\267\345\205\254\351\227\234.md" | 1 - ...0\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" | 1 - "homepage/_cards/zh-tw/\345\205\254\345\213\231\345\223\241.md" | 1 - "homepage/_cards/zh-tw/\345\267\245\347\250\213\345\270\253.md" | 1 - ...6\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" | 1 - .../zh-tw/\346\263\225\345\213\231\344\272\272\345\223\241.md" | 1 - .../zh-tw/\347\276\216\350\241\223\350\250\255\350\250\210.md" | 1 - .../zh-tw/\350\241\214\351\212\267\345\205\254\351\227\234.md" | 1 - ...0\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" | 1 - homepage/src/CMS/config.json | 1 + 15 files changed, 1 insertion(+), 14 deletions(-) diff --git "a/homepage/_cards/en/\345\205\254\345\213\231\345\223\241.md" "b/homepage/_cards/en/\345\205\254\345\213\231\345\223\241.md" index c431f386..4e72958b 100644 --- "a/homepage/_cards/en/\345\205\254\345\213\231\345\223\241.md" +++ "b/homepage/_cards/en/\345\205\254\345\213\231\345\223\241.md" @@ -7,4 +7,3 @@ type: job tags: - civil servants --- -Public Servant \ No newline at end of file diff --git "a/homepage/_cards/en/\345\267\245\347\250\213\345\270\253.md" "b/homepage/_cards/en/\345\267\245\347\250\213\345\270\253.md" index b634c857..b980f82b 100644 --- "a/homepage/_cards/en/\345\267\245\347\250\213\345\270\253.md" +++ "b/homepage/_cards/en/\345\267\245\347\250\213\345\270\253.md" @@ -7,4 +7,3 @@ type: job tags: - engineer --- -Engineer \ No newline at end of file diff --git "a/homepage/_cards/en/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" "b/homepage/_cards/en/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" index 37b98826..eb377857 100644 --- "a/homepage/_cards/en/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" +++ "b/homepage/_cards/en/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" @@ -7,4 +7,3 @@ type: job tags: - writer --- -Copywriter \ No newline at end of file diff --git "a/homepage/_cards/en/\346\263\225\345\213\231\344\272\272\345\223\241.md" "b/homepage/_cards/en/\346\263\225\345\213\231\344\272\272\345\223\241.md" index 4124167c..abaeed6c 100644 --- "a/homepage/_cards/en/\346\263\225\345\213\231\344\272\272\345\223\241.md" +++ "b/homepage/_cards/en/\346\263\225\345\213\231\344\272\272\345\223\241.md" @@ -7,4 +7,3 @@ type: job tags: - legal --- -Legal Personnel \ No newline at end of file diff --git "a/homepage/_cards/en/\347\276\216\350\241\223\350\250\255\350\250\210.md" "b/homepage/_cards/en/\347\276\216\350\241\223\350\250\255\350\250\210.md" index 66b1ce24..9ed7c30f 100644 --- "a/homepage/_cards/en/\347\276\216\350\241\223\350\250\255\350\250\210.md" +++ "b/homepage/_cards/en/\347\276\216\350\241\223\350\250\255\350\250\210.md" @@ -7,4 +7,3 @@ type: job tags: - designer --- -AD \ No newline at end of file diff --git "a/homepage/_cards/en/\350\241\214\351\212\267\345\205\254\351\227\234.md" "b/homepage/_cards/en/\350\241\214\351\212\267\345\205\254\351\227\234.md" index ba572d73..963d2eb7 100644 --- "a/homepage/_cards/en/\350\241\214\351\212\267\345\205\254\351\227\234.md" +++ "b/homepage/_cards/en/\350\241\214\351\212\267\345\205\254\351\227\234.md" @@ -7,4 +7,3 @@ type: job tags: - marketing --- -Marketing PR \ No newline at end of file diff --git "a/homepage/_cards/en/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" "b/homepage/_cards/en/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" index 00e8c227..46427405 100644 --- "a/homepage/_cards/en/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" +++ "b/homepage/_cards/en/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" @@ -7,4 +7,3 @@ type: job tags: - advocator --- -Advocator \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\345\205\254\345\213\231\345\223\241.md" "b/homepage/_cards/zh-tw/\345\205\254\345\213\231\345\223\241.md" index 9e280276..78206083 100644 --- "a/homepage/_cards/zh-tw/\345\205\254\345\213\231\345\223\241.md" +++ "b/homepage/_cards/zh-tw/\345\205\254\345\213\231\345\223\241.md" @@ -7,4 +7,3 @@ type: job tags: - civil servants --- -公務 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\345\267\245\347\250\213\345\270\253.md" "b/homepage/_cards/zh-tw/\345\267\245\347\250\213\345\270\253.md" index 74f9a4d4..3e8bf916 100644 --- "a/homepage/_cards/zh-tw/\345\267\245\347\250\213\345\270\253.md" +++ "b/homepage/_cards/zh-tw/\345\267\245\347\250\213\345\270\253.md" @@ -7,4 +7,3 @@ type: job tags: - engineer --- -工程 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" "b/homepage/_cards/zh-tw/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" index 5ce291d9..d23011db 100644 --- "a/homepage/_cards/zh-tw/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" +++ "b/homepage/_cards/zh-tw/\346\226\207\345\255\227\345\267\245\344\275\234\350\200\205.md" @@ -7,4 +7,3 @@ type: job tags: - writer --- -文字 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\346\263\225\345\213\231\344\272\272\345\223\241.md" "b/homepage/_cards/zh-tw/\346\263\225\345\213\231\344\272\272\345\223\241.md" index a7ab69ba..55068933 100644 --- "a/homepage/_cards/zh-tw/\346\263\225\345\213\231\344\272\272\345\223\241.md" +++ "b/homepage/_cards/zh-tw/\346\263\225\345\213\231\344\272\272\345\223\241.md" @@ -7,4 +7,3 @@ type: job tags: - legal --- -法務 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\347\276\216\350\241\223\350\250\255\350\250\210.md" "b/homepage/_cards/zh-tw/\347\276\216\350\241\223\350\250\255\350\250\210.md" index d6b2d24c..5752dc14 100644 --- "a/homepage/_cards/zh-tw/\347\276\216\350\241\223\350\250\255\350\250\210.md" +++ "b/homepage/_cards/zh-tw/\347\276\216\350\241\223\350\250\255\350\250\210.md" @@ -7,4 +7,3 @@ type: job tags: - designer --- -美術 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\350\241\214\351\212\267\345\205\254\351\227\234.md" "b/homepage/_cards/zh-tw/\350\241\214\351\212\267\345\205\254\351\227\234.md" index ca5184b4..2fe202f1 100644 --- "a/homepage/_cards/zh-tw/\350\241\214\351\212\267\345\205\254\351\227\234.md" +++ "b/homepage/_cards/zh-tw/\350\241\214\351\212\267\345\205\254\351\227\234.md" @@ -7,4 +7,3 @@ type: job tags: - marketing --- -行銷 \ No newline at end of file diff --git "a/homepage/_cards/zh-tw/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" "b/homepage/_cards/zh-tw/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" index d07f994a..bf5105d7 100644 --- "a/homepage/_cards/zh-tw/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" +++ "b/homepage/_cards/zh-tw/\350\255\260\351\241\214\345\267\245\344\275\234\350\200\205.md" @@ -7,4 +7,3 @@ type: job tags: - advocator --- -議題 \ No newline at end of file diff --git a/homepage/src/CMS/config.json b/homepage/src/CMS/config.json index 77a7170e..3be18bf3 100644 --- a/homepage/src/CMS/config.json +++ b/homepage/src/CMS/config.json @@ -298,6 +298,7 @@ "label": "Content", "name": "body", "widget": "markdown", + "required": false, "i18n": true } ] From 26ca46159a4642b613849d1a121ed78207c2c626 Mon Sep 17 00:00:00 2001 From: Ben Liu Date: Thu, 2 Nov 2023 22:13:35 +0700 Subject: [PATCH 9/9] fix(homepage): remove empty title in index.md --- homepage/_pages/zh-tw/index.md | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/homepage/_pages/zh-tw/index.md b/homepage/_pages/zh-tw/index.md index 06f011d4..37b85c93 100644 --- a/homepage/_pages/zh-tw/index.md +++ b/homepage/_pages/zh-tw/index.md @@ -44,22 +44,13 @@ layout_list: title: 桌遊用途 columns: - title: 教學教材 - text: |- - ### - - 無論大學、高中課程,教學簡報配合桌遊,輕鬆認識開源觀念,提升公民行動力! + text: 無論大學、高中課程,教學簡報配合桌遊,輕鬆認識開源觀念,提升公民行動力! image: /images/uploads/pxl_20230508_052023298.jpg - title: 社群推坑 - text: |- - ### - - 已是開源老手、社群活躍成員的你,想要不費吹灰之力吸收新血?揪團玩就對了! + text: 已是開源老手、社群活躍成員的你,想要不費吹灰之力吸收新血?揪團玩就對了! image: /images/uploads/pxl_20230730_051310179.jpeg - title: 破冰團康 - text: |- - ### - - 社團活動怎麼帶?利用星手村桌遊,輕鬆達到破冰與理念推廣。學弟學妹揪起來! + text: 社團活動怎麼帶?利用星手村桌遊,輕鬆達到破冰與理念推廣。學弟學妹揪起來! image: /images/uploads/img_3763.jpeg - type: layout_section title: 桌遊背後的故事