From 1020ab0b97e98e811d5923afaec36b85fbd449f3 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 20 Aug 2024 13:31:50 +0300 Subject: [PATCH] docs: improve main docs and resources sidebar (#8664) --- www/apps/book/sidebar.mjs | 5 +++++ www/apps/book/types/index.d.ts | 1 + www/apps/book/utils/number-sidebar-items.mjs | 5 ++++- www/apps/resources/generated/sidebar.mjs | 18 ++++++++++++++++++ www/apps/resources/sidebar.mjs | 18 ++++++++++++++++++ 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/www/apps/book/sidebar.mjs b/www/apps/book/sidebar.mjs index 1411e1c4c8..672f74f4fb 100644 --- a/www/apps/book/sidebar.mjs +++ b/www/apps/book/sidebar.mjs @@ -13,11 +13,13 @@ export const sidebar = numberSidebarItems( type: "link", path: "/first-customizations", title: "Your First Customizations", + chapterTitle: "First Customization", }, { type: "link", path: "/basics", title: "The Basics", + chapterTitle: "Basics", children: [ { type: "link", @@ -85,6 +87,7 @@ export const sidebar = numberSidebarItems( type: "link", path: "/advanced-development", title: "Advanced Development", + chapterTitle: "Advanced", children: [ { type: "sub-category", @@ -340,6 +343,7 @@ export const sidebar = numberSidebarItems( type: "link", path: "/storefront-development", title: "Storefront Development", + chapterTitle: "Storefront", children: [ { type: "link", @@ -357,6 +361,7 @@ export const sidebar = numberSidebarItems( type: "link", path: "/debugging-and-testing", title: "Debugging and Testing", + chapterTitle: "Debugging & Testing", children: [ { type: "link", diff --git a/www/apps/book/types/index.d.ts b/www/apps/book/types/index.d.ts index 3934655afd..73bc06a87f 100644 --- a/www/apps/book/types/index.d.ts +++ b/www/apps/book/types/index.d.ts @@ -3,6 +3,7 @@ import { SidebarSectionItems, SidebarItem as SidebarItemType } from "types" export declare type SidebarItem = SidebarItemType & { isSoon: boolean number?: string + chapterTitle?: string } export declare type SidebarConfig = SidebarSectionItems diff --git a/www/apps/book/utils/number-sidebar-items.mjs b/www/apps/book/utils/number-sidebar-items.mjs index b1ab601748..318fd4c740 100644 --- a/www/apps/book/utils/number-sidebar-items.mjs +++ b/www/apps/book/utils/number-sidebar-items.mjs @@ -21,13 +21,16 @@ export default function numberSidebarItems(sidebarItems, numbering = [1]) { // append current number to the item's title item.number = `${numbering.join(".")}.` + item.chapterTitle = `${item.number} ${ + item.chapterTitle?.trim() || item.title?.trim() + }` item.title = `${item.number} ${item.title.trim()}` if (isTopItems) { // Add chapter category numberedItems.push({ type: "category", - title: item.title, + title: item.chapterTitle, children: [], loaded: true, initialOpen: false, diff --git a/www/apps/resources/generated/sidebar.mjs b/www/apps/resources/generated/sidebar.mjs index 0212816d2b..87fb2103ca 100644 --- a/www/apps/resources/generated/sidebar.mjs +++ b/www/apps/resources/generated/sidebar.mjs @@ -20,6 +20,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "API Key Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -198,6 +199,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Auth Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -431,6 +433,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Cart Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -1007,6 +1010,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Currency", + "initialOpen": false, "children": [ { "loaded": true, @@ -1127,6 +1131,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Customer", + "initialOpen": false, "children": [ { "loaded": true, @@ -1447,6 +1452,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Fulfillment Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -2192,6 +2198,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Inventory Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -2600,6 +2607,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Order Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -3945,6 +3953,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Payment Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -4418,6 +4427,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Pricing Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -4939,6 +4949,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Product Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -5629,6 +5640,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Promotion Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -6023,6 +6035,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Region Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -6223,6 +6236,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Sales Channel Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -6399,6 +6413,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Stock Location Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -6583,6 +6598,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Store Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -6759,6 +6775,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "Tax Module", + "initialOpen": false, "children": [ { "loaded": true, @@ -7071,6 +7088,7 @@ export const generatedSidebar = [ "isPathHref": true, "type": "category", "title": "User Module", + "initialOpen": false, "children": [ { "loaded": true, diff --git a/www/apps/resources/sidebar.mjs b/www/apps/resources/sidebar.mjs index 775af4541a..b009296b9f 100644 --- a/www/apps/resources/sidebar.mjs +++ b/www/apps/resources/sidebar.mjs @@ -16,6 +16,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "API Key Module", + initialOpen: false, children: [ { type: "link", @@ -89,6 +90,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Auth Module", + initialOpen: false, children: [ { type: "link", @@ -198,6 +200,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Cart Module", + initialOpen: false, children: [ { type: "link", @@ -279,6 +282,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Currency", + initialOpen: false, children: [ { type: "link", @@ -345,6 +349,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Customer", + initialOpen: false, children: [ { type: "link", @@ -416,6 +421,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Fulfillment Module", + initialOpen: false, children: [ { type: "link", @@ -509,6 +515,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Inventory Module", + initialOpen: false, children: [ { type: "link", @@ -586,6 +593,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Order Module", + initialOpen: false, children: [ { type: "link", @@ -688,6 +696,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Payment Module", + initialOpen: false, children: [ { type: "link", @@ -807,6 +816,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Pricing Module", + initialOpen: false, children: [ { type: "link", @@ -894,6 +904,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Product Module", + initialOpen: false, children: [ { type: "link", @@ -966,6 +977,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Promotion Module", + initialOpen: false, children: [ { type: "link", @@ -1054,6 +1066,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Region Module", + initialOpen: false, children: [ { type: "link", @@ -1120,6 +1133,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Sales Channel Module", + initialOpen: false, children: [ { type: "link", @@ -1193,6 +1207,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Stock Location Module", + initialOpen: false, children: [ { type: "link", @@ -1267,6 +1282,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Store Module", + initialOpen: false, children: [ { type: "link", @@ -1333,6 +1349,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "Tax Module", + initialOpen: false, children: [ { type: "link", @@ -1419,6 +1436,7 @@ export const sidebar = sidebarAttachHrefCommonOptions([ { type: "category", title: "User Module", + initialOpen: false, children: [ { type: "link",