diff --git a/components/buttons/Tiles.js b/components/buttons/Tiles.js index 8ae5f6a0..5b7c2c8b 100644 --- a/components/buttons/Tiles.js +++ b/components/buttons/Tiles.js @@ -5,9 +5,20 @@ import { CardActionArea } from '@mui/material'; export function Tile({ name, url, image, description='', isHero=false }) { return ( - - - + + {/* sx={{ mb: '20px', display: 'flex', flex: 1 }}> */} + + { image &&
{title} - + {tiles ? ( tiles.map((c, i) => ( ))) : ( diff --git a/lib/content/menuContent.js b/lib/content/menuContent.js index 410849c1..f1844b6a 100644 --- a/lib/content/menuContent.js +++ b/lib/content/menuContent.js @@ -41,7 +41,7 @@ export async function getFrontMatter(config) { true, ".md*" ); - + console.log('[Menu][getFrontMatter]files : ', files) const filesPromises = files.map((file) => { return getFileContent(config.owner, config.repo, config.branch, file.path, file.sha) diff --git a/lib/github/index.js b/lib/github/index.js index 535467aa..7920b58a 100644 --- a/lib/github/index.js +++ b/lib/github/index.js @@ -95,7 +95,25 @@ export async function getFileContent(owner, repo, branch, path, sha = null) { if (sha) { // if the SHA is passed, this is a specific revision of a file. if (cachedContent) { console.info('[Github][Read][HIT/Sha]:', cacheKey, ' sha:', sha) - return cachedContent; + if (cachedContent && cachedContent.encoding) { + console.info('[Github][Cached/Sha][HIT/cachedRefContent]:', cachedContent) + // console.info('[Github][Cached/Sha][HIT/Sha]:', cacheKey, ' ref:', ref.ref) + if (!cachedContent.encoding === 'none') { + return cachedContent.content.data.toString(cachedContent.encoding); + } else { + if (cachedContent.content.type === 'Buffer') { + return Buffer.from(cachedContent.content.data, 'binary'); + } + } + } else if (cachedContent ) { + + } else { + console.info("[Github][Cached/Sha][MISS]:", cacheKey); + } + + + + return cachedContent.content.data; } else { console.info("[Github][Read][MISS/Sha]:", cacheKey, " sha:", sha); } @@ -123,7 +141,6 @@ export async function getFileContent(owner, repo, branch, path, sha = null) { if (cachedRefContent.content.type === 'Buffer') { return Buffer.from(cachedRefContent.content.data, 'binary'); } - } } else if (cachedRefContent ) { @@ -132,7 +149,7 @@ export async function getFileContent(owner, repo, branch, path, sha = null) { } } else { // console.info('[Github][Read][HIT/Branch]:', cacheKey) - return cachedContent; + return cachedContent.content.data; } } catch (error) { diff --git a/package-lock.json b/package-lock.json index 1ebe2efd..778dded0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@mdx-js/react": "^2.3.0", "@mdxeditor/editor": "^1.14.3", "@mui/icons-material": "^5.11.11", - "@mui/material": "^5.11.7", + "@mui/material": "^5.15.3", "@mui/utils": "^5.13.1", "@mui/x-data-grid": "^6.5.0", "@mui/x-date-pickers": "^6.5.0", @@ -3265,9 +3265,9 @@ } }, "node_modules/@floating-ui/react-dom": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz", - "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.4.tgz", + "integrity": "sha512-CF8k2rgKeh/49UrnIBs4BdxPUV6vize/Db1d/YbCLyp9GiVZ0BEwf5AiDSxJRCr6yOkGqTFHtmrULxkEfYZ7dQ==", "dependencies": { "@floating-ui/dom": "^1.5.1" }, @@ -4315,25 +4315,24 @@ "integrity": "sha512-ZEVraeRK3qmAs0sVenlEsoMKbNO4T960atGtZNYNWBd8MZ9KMeOF/+6HRVAYiGTRUo+WLlweMKXlDm+TDKGleQ==" }, "node_modules/@mui/base": { - "version": "5.0.0-beta.1", - "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.1.tgz", - "integrity": "sha512-xrkDCeu3JQE+JjJUnJnOrdQJMXwKhbV4AW+FRjMIj5i9cHK3BAuatG/iqbf1M+jklVWLk0KdbgioKwK+03aYbA==", - "dependencies": { - "@babel/runtime": "^7.21.0", - "@emotion/is-prop-valid": "^1.2.0", - "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.1", - "@popperjs/core": "^2.11.7", - "clsx": "^1.2.1", - "prop-types": "^15.8.1", - "react-is": "^18.2.0" + "version": "5.0.0-beta.30", + "resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.30.tgz", + "integrity": "sha512-dc38W4W3K42atE9nSaOeoJ7/x9wGIfawdwC/UmMxMLlZ1iSsITQ8dQJaTATCbn98YvYPINK/EH541YA5enQIPQ==", + "dependencies": { + "@babel/runtime": "^7.23.6", + "@floating-ui/react-dom": "^2.0.4", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", + "@popperjs/core": "^2.11.8", + "clsx": "^2.0.0", + "prop-types": "^15.8.1" }, "engines": { "node": ">=12.0.0" }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0", @@ -4346,13 +4345,21 @@ } } }, + "node_modules/@mui/base/node_modules/clsx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", + "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", + "engines": { + "node": ">=6" + } + }, "node_modules/@mui/core-downloads-tracker": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.13.1.tgz", - "integrity": "sha512-qDHtNDO72NcBQMhaWBt9EZMvNiO+OXjPg5Sdk/6LgRDw6Zr3HdEZ5n2FJ/qtYsaT/okGyCuQavQkcZCOCEVf/g==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.15.3.tgz", + "integrity": "sha512-sWeihiVyxdJjpLkp8SHkTy9kt2M/o11M60G1MzwljGL2BXdM3Ktzqv5QaQHdi00y7Y1ulvtI3GOSxP2xU8mQJw==", "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" } }, "node_modules/@mui/icons-material": { @@ -4381,18 +4388,18 @@ } }, "node_modules/@mui/material": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.13.1.tgz", - "integrity": "sha512-qSnbJZer8lIuDYFDv19/t3s0AXYY9SxcOdhCnGvetRSfOG4gy3TkiFXNCdW5OLNveTieiMpOuv46eXUmE3ZA6A==", - "dependencies": { - "@babel/runtime": "^7.21.0", - "@mui/base": "5.0.0-beta.1", - "@mui/core-downloads-tracker": "^5.13.1", - "@mui/system": "^5.13.1", - "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.1", - "@types/react-transition-group": "^4.4.6", - "clsx": "^1.2.1", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/material/-/material-5.15.3.tgz", + "integrity": "sha512-DODBBMouyq1B5f3YkEWL9vO8pGCxuEGqtfpltF6peMJzz/78tJFyLQsDas9MNLC/8AdFu2BQdkK7wox5UBPTAA==", + "dependencies": { + "@babel/runtime": "^7.23.6", + "@mui/base": "5.0.0-beta.30", + "@mui/core-downloads-tracker": "^5.15.3", + "@mui/system": "^5.15.3", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", + "@types/react-transition-group": "^4.4.10", + "clsx": "^2.0.0", "csstype": "^3.1.2", "prop-types": "^15.8.1", "react-is": "^18.2.0", @@ -4403,7 +4410,7 @@ }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { "@emotion/react": "^11.5.0", @@ -4424,13 +4431,21 @@ } } }, + "node_modules/@mui/material/node_modules/clsx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", + "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", + "engines": { + "node": ">=6" + } + }, "node_modules/@mui/private-theming": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.13.1.tgz", - "integrity": "sha512-HW4npLUD9BAkVppOUZHeO1FOKUJWAwbpy0VQoGe3McUYTlck1HezGHQCfBQ5S/Nszi7EViqiimECVl9xi+/WjQ==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.15.3.tgz", + "integrity": "sha512-Q79MhVMmywC1l5bMsMZq5PsIudr1MNPJnx9/EqdMP0vpz5iNvFpnLmxsD7d8/hqTWgFAljI+LH3jX8MxlZH9Gw==", "dependencies": { - "@babel/runtime": "^7.21.0", - "@mui/utils": "^5.13.1", + "@babel/runtime": "^7.23.6", + "@mui/utils": "^5.15.3", "prop-types": "^15.8.1" }, "engines": { @@ -4438,7 +4453,7 @@ }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { "@types/react": "^17.0.0 || ^18.0.0", @@ -4451,12 +4466,12 @@ } }, "node_modules/@mui/styled-engine": { - "version": "5.12.3", - "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.12.3.tgz", - "integrity": "sha512-AhZtiRyT8Bjr7fufxE/mLS+QJ3LxwX1kghIcM2B2dvJzSSg9rnIuXDXM959QfUVIM3C8U4x3mgVoPFMQJvc4/g==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/styled-engine/-/styled-engine-5.15.3.tgz", + "integrity": "sha512-+d5XZCTeemOO/vBfWGEeHgTm8fjU1Psdgm+xAw+uegycO2EnoA/EfGSaG5UwZ6g3b66y48Mkxi35AggShMr88w==", "dependencies": { - "@babel/runtime": "^7.21.0", - "@emotion/cache": "^11.10.8", + "@babel/runtime": "^7.23.6", + "@emotion/cache": "^11.11.0", "csstype": "^3.1.2", "prop-types": "^15.8.1" }, @@ -4465,7 +4480,7 @@ }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { "@emotion/react": "^11.4.1", @@ -4482,16 +4497,16 @@ } }, "node_modules/@mui/system": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.13.1.tgz", - "integrity": "sha512-BsDUjhiO6ZVAvzKhnWBHLZ5AtPJcdT+62VjnRLyA4isboqDKLg4fmYIZXq51yndg/soDK9RkY5lYZwEDku13Ow==", - "dependencies": { - "@babel/runtime": "^7.21.0", - "@mui/private-theming": "^5.13.1", - "@mui/styled-engine": "^5.12.3", - "@mui/types": "^7.2.4", - "@mui/utils": "^5.13.1", - "clsx": "^1.2.1", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/system/-/system-5.15.3.tgz", + "integrity": "sha512-ewVU4eRgo4VfNMGpO61cKlfWmH7l9s6rA8EknRzuMX3DbSLfmtW2WJJg6qPwragvpPIir0Pp/AdWVSDhyNy5Tw==", + "dependencies": { + "@babel/runtime": "^7.23.6", + "@mui/private-theming": "^5.15.3", + "@mui/styled-engine": "^5.15.3", + "@mui/types": "^7.2.12", + "@mui/utils": "^5.15.3", + "clsx": "^2.0.0", "csstype": "^3.1.2", "prop-types": "^15.8.1" }, @@ -4500,7 +4515,7 @@ }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { "@emotion/react": "^11.5.0", @@ -4520,12 +4535,20 @@ } } }, + "node_modules/@mui/system/node_modules/clsx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz", + "integrity": "sha512-m3iNNWpd9rl3jvvcBnu70ylMdrXt8Vlq4HYadnU5fwcOtvkSQWPmj7amUcDT2qYI7risszBjI5AUIUox9D16pg==", + "engines": { + "node": ">=6" + } + }, "node_modules/@mui/types": { - "version": "7.2.4", - "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.4.tgz", - "integrity": "sha512-LBcwa8rN84bKF+f5sDyku42w1NTxaPgPyYKODsh01U1fVstTClbUoSA96oyRBnSNyEiAVjKm6Gwx9vjR+xyqHA==", + "version": "7.2.12", + "resolved": "https://registry.npmjs.org/@mui/types/-/types-7.2.12.tgz", + "integrity": "sha512-3kaHiNm9khCAo0pVe0RenketDSFoZGAlVZ4zDjB/QNZV0XiCj+sh1zkX0VVhQPgYJDlBEzAag+MHJ1tU3vf0Zw==", "peerDependencies": { - "@types/react": "*" + "@types/react": "^17.0.0 || ^18.0.0" }, "peerDependenciesMeta": { "@types/react": { @@ -4534,13 +4557,12 @@ } }, "node_modules/@mui/utils": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.13.1.tgz", - "integrity": "sha512-6lXdWwmlUbEU2jUI8blw38Kt+3ly7xkmV9ljzY4Q20WhsJMWiNry9CX8M+TaP/HbtuyR8XKsdMgQW7h7MM3n3A==", + "version": "5.15.3", + "resolved": "https://registry.npmjs.org/@mui/utils/-/utils-5.15.3.tgz", + "integrity": "sha512-mT3LiSt9tZWCdx1pl7q4Q5tNo6gdZbvJel286ZHGuj6LQQXjWNAh8qiF9d+LogvNUI+D7eLkTnj605d1zoazfg==", "dependencies": { - "@babel/runtime": "^7.21.0", - "@types/prop-types": "^15.7.5", - "@types/react-is": "^18.2.0", + "@babel/runtime": "^7.23.6", + "@types/prop-types": "^15.7.11", "prop-types": "^15.8.1", "react-is": "^18.2.0" }, @@ -4549,10 +4571,16 @@ }, "funding": { "type": "opencollective", - "url": "https://opencollective.com/mui" + "url": "https://opencollective.com/mui-org" }, "peerDependencies": { + "@types/react": "^17.0.0 || ^18.0.0", "react": "^17.0.0 || ^18.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } } }, "node_modules/@mui/x-data-grid": { @@ -5516,9 +5544,9 @@ } }, "node_modules/@popperjs/core": { - "version": "2.11.7", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.7.tgz", - "integrity": "sha512-Cr4OjIkipTtcXKjAsm8agyleBuDHvxzeBoa1v543lbv1YaIwQjESsVcmjiWiPEbC1FIeHOG/Op9kdCmAmiS3Kw==", + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" @@ -9523,9 +9551,9 @@ "dev": true }, "node_modules/@types/prop-types": { - "version": "15.7.5", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", - "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" + "version": "15.7.11", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" }, "node_modules/@types/qs": { "version": "6.9.10", @@ -9557,18 +9585,10 @@ "@types/react": "*" } }, - "node_modules/@types/react-is": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/@types/react-is/-/react-is-18.2.0.tgz", - "integrity": "sha512-1vz2yObaQkLL7YFe/pme2cpvDsCwI1WXIfL+5eLz0MI9gFG24Re16RzUsI8t9XZn9ZWvgLNDrJBmrqXJO7GNQQ==", - "dependencies": { - "@types/react": "*" - } - }, "node_modules/@types/react-transition-group": { - "version": "4.4.6", - "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.6.tgz", - "integrity": "sha512-VnCdSxfcm08KjsJVQcfBmhEQAPnLB8G08hAxn39azX1qYBQ/5RVQuoHuKIcfKOdncuaUvEpFKFzEvbtIMsfVew==", + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.10.tgz", + "integrity": "sha512-hT/+s0VQs2ojCX823m60m5f0sL5idt9SO6Tj6Dg+rdphGPIeJbJ6CxvBYkgkGKrYeDjvIpKTR38UzmtHJOGW3Q==", "dependencies": { "@types/react": "*" } diff --git a/package.json b/package.json index e97b0bce..6a847459 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@mdx-js/react": "^2.3.0", "@mdxeditor/editor": "^1.14.3", "@mui/icons-material": "^5.11.11", - "@mui/material": "^5.11.7", + "@mui/material": "^5.15.3", "@mui/utils": "^5.13.1", "@mui/x-data-grid": "^6.5.0", "@mui/x-date-pickers": "^6.5.0", diff --git a/pages/[[...path]]/index.jsx b/pages/[[...path]]/index.jsx index a8410312..b8331c07 100644 --- a/pages/[[...path]]/index.jsx +++ b/pages/[[...path]]/index.jsx @@ -101,7 +101,7 @@ export async function getServerSideProps(context) { const allTiles = await getFrontMatter( siteConfig.content[context.params.path[0]] ); - + console.log("allTiles: ", allTiles); tiles = allTiles.filter((tile) => { const parts = tile.file.split("/"); // Split the file path by '/' const fileName = parts[parts.length - 1]; // Get the last part (file name) diff --git a/pages/services/index.jsx b/pages/services/index.jsx index 454500f5..75cc1946 100644 --- a/pages/services/index.jsx +++ b/pages/services/index.jsx @@ -6,17 +6,17 @@ import { HeaderMinimalMenu } from '@/components/menus' import { usePageMenu } from "@/lib/hooks"; -export default function Page({ tiles, menuStructure: initialMenuStructure, collection, loading }) { +export default function Page({ tiles, menuStructure: initialMenuStructure, collection, context, loading }) { if (loading) { return ( - + ) } const { menuStructure } = usePageMenu(collection); return ( - + ); } @@ -35,6 +35,7 @@ export async function getServerSideProps(context) { menuStructure: menuStructure, tiles: tiles, collection: siteConfig.content.providers, + context: siteConfig.content.services }, }; } diff --git a/public/generic-solution.png b/public/generic-solution.png new file mode 100644 index 00000000..58d4cfbd Binary files /dev/null and b/public/generic-solution.png differ diff --git a/stories/Tile.stories.tsx b/stories/Tile.stories.tsx index b3228068..be571d1c 100644 --- a/stories/Tile.stories.tsx +++ b/stories/Tile.stories.tsx @@ -84,12 +84,13 @@ export const MultiLineTitle: Story = { }; const dummyTiles = Array.from({ length: 10 }, (_, i) => ({ - frontmatter: { - title: `Tile ${i + 1}`, - hero: i === 0, // Set the first tile as hero - image: `image${i + 1}.jpg`, - }, - file: `file${i + 1}.md`, + frontmatter: { + title: `Tile ${i + 1}`, + hero: i < 3, // Set the first 3 tiles as hero + image: i < 1 ? null : (i < 4 ? 'hero/hero1.png' : null), + description: [0, 2, 5].includes(i) ? `Lorum ipsum Random description ${Math.random()}` : null, + }, + file: `file${i + 1}.md`, })); @@ -266,7 +267,8 @@ const dummyTiles3 = [ const Template = (args, context) => { return ( - + + {args.tiles ? ( args.tiles.map((c, i) => ( @@ -276,16 +278,20 @@ const Template = (args, context) => { url={c?.file} isHero={c?.frontmatter?.hero} image={ - c?.frontmatter?.image + c?.frontmatter?.hero && c?.frontmatter?.image != null ? `/${c.frontmatter.image}` + : c?.frontmatter?.hero + ? '/generic-solution.png' : null } + description={c?.frontmatter?.description} + /> ))) : (
...loading
)}
- +
); };