From 4c4be43cb0e56457deea348821ed41277fe159cc Mon Sep 17 00:00:00 2001 From: Araozu Date: Fri, 22 Nov 2024 06:50:37 -0500 Subject: [PATCH] feat: sort folders on sidebar based on name --- package.json | 4 +- pnpm-lock.yaml | 14 +- src/components/Sidebar.astro | 10 +- src/components/utils.ts | 4 +- src/layouts/DocsLayout.astro | 19 --- src/layouts/NewDocsLayout.astro | 43 +++--- src/layouts/PagesLayout.astro | 126 ------------------ src/layouts/SpecLayout.astro | 18 --- .../learn/{basics => 01_basics}/comments.mdx | 0 .../learn/{basics => 01_basics}/datatypes.mdx | 0 .../{basics => 01_basics}/hello-world.mdx | 0 .../learn/{basics => 01_basics}/operators.mdx | 0 .../learn/{basics => 01_basics}/variables.mdx | 0 .../arrays.mdx | 0 .../enums.mdx | 0 .../maps.mdx | 0 .../tuples.mdx | 0 .../unions.mdx | 0 .../blocks.mdx | 0 .../conditionals.mdx | 0 .../loops.mdx | 0 .../match.mdx | 0 .../declaration.mdx | 0 .../higher-order.mdx | 0 .../{functions => 04_functions}/lambdas.mdx | 0 .../parameters.mdx | 0 .../null.mdx | 0 .../try.mdx | 0 .../{classes => 06_classes}/abstract.mdx | 0 .../{classes => 06_classes}/anonymous.mdx | 0 .../{classes => 06_classes}/constructor.mdx | 0 .../{classes => 06_classes}/definition.mdx | 0 .../{classes => 06_classes}/inheritance.mdx | 0 .../{classes => 06_classes}/interfaces.mdx | 0 .../learn/{classes => 06_classes}/magic.mdx | 0 .../{classes => 06_classes}/readonly.mdx | 0 .../learn/{classes => 06_classes}/static.mdx | 0 .../{classes => 06_classes}/visibility.mdx | 0 .../components.mdx | 0 .../control-flow.mdx | 0 .../{templating => 07_templating}/intro.mdx | 0 .../{templating => 07_templating}/props.mdx | 0 42 files changed, 42 insertions(+), 196 deletions(-) delete mode 100644 src/layouts/DocsLayout.astro delete mode 100644 src/layouts/PagesLayout.astro delete mode 100644 src/layouts/SpecLayout.astro rename src/pages/en/latest/learn/{basics => 01_basics}/comments.mdx (100%) rename src/pages/en/latest/learn/{basics => 01_basics}/datatypes.mdx (100%) rename src/pages/en/latest/learn/{basics => 01_basics}/hello-world.mdx (100%) rename src/pages/en/latest/learn/{basics => 01_basics}/operators.mdx (100%) rename src/pages/en/latest/learn/{basics => 01_basics}/variables.mdx (100%) rename src/pages/en/latest/learn/{data-structures => 02_data-structures}/arrays.mdx (100%) rename src/pages/en/latest/learn/{data-structures => 02_data-structures}/enums.mdx (100%) rename src/pages/en/latest/learn/{data-structures => 02_data-structures}/maps.mdx (100%) rename src/pages/en/latest/learn/{data-structures => 02_data-structures}/tuples.mdx (100%) rename src/pages/en/latest/learn/{data-structures => 02_data-structures}/unions.mdx (100%) rename src/pages/en/latest/learn/{flow-control => 03_flow-control}/blocks.mdx (100%) rename src/pages/en/latest/learn/{flow-control => 03_flow-control}/conditionals.mdx (100%) rename src/pages/en/latest/learn/{flow-control => 03_flow-control}/loops.mdx (100%) rename src/pages/en/latest/learn/{flow-control => 03_flow-control}/match.mdx (100%) rename src/pages/en/latest/learn/{functions => 04_functions}/declaration.mdx (100%) rename src/pages/en/latest/learn/{functions => 04_functions}/higher-order.mdx (100%) rename src/pages/en/latest/learn/{functions => 04_functions}/lambdas.mdx (100%) rename src/pages/en/latest/learn/{functions => 04_functions}/parameters.mdx (100%) rename src/pages/en/latest/learn/{error-handling => 05_error-handling}/null.mdx (100%) rename src/pages/en/latest/learn/{error-handling => 05_error-handling}/try.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/abstract.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/anonymous.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/constructor.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/definition.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/inheritance.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/interfaces.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/magic.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/readonly.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/static.mdx (100%) rename src/pages/en/latest/learn/{classes => 06_classes}/visibility.mdx (100%) rename src/pages/en/latest/learn/{templating => 07_templating}/components.mdx (100%) rename src/pages/en/latest/learn/{templating => 07_templating}/control-flow.mdx (100%) rename src/pages/en/latest/learn/{templating => 07_templating}/intro.mdx (100%) rename src/pages/en/latest/learn/{templating => 07_templating}/props.mdx (100%) diff --git a/package.json b/package.json index ed9c9b3..0f9f2d6 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ }, "dependencies": { "@astrojs/check": "^0.5.10", - "@astrojs/mdx": "^2.3.0", + "@astrojs/mdx": "^2.3.1", "@astrojs/tailwind": "^5.1.0", - "astro": "^4.6.1", + "astro": "^4.6.3", "codejar": "^4.2.0", "tailwindcss": "^3.4.3", "typescript": "^5.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c540a39..8dfce84 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,13 +12,13 @@ importers: specifier: ^0.5.10 version: 0.5.10(typescript@5.4.5) '@astrojs/mdx': - specifier: ^2.3.0 + specifier: ^2.3.1 version: 2.3.1(astro@4.6.3(@types/node@20.11.30)(typescript@5.4.5)) '@astrojs/tailwind': specifier: ^5.1.0 version: 5.1.0(astro@4.6.3(@types/node@20.11.30)(typescript@5.4.5))(tailwindcss@3.4.3) astro: - specifier: ^4.6.1 + specifier: ^4.6.3 version: 4.6.3(@types/node@20.11.30)(typescript@5.4.5) codejar: specifier: ^4.2.0 @@ -870,8 +870,8 @@ packages: resolution: {integrity: sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==} engines: {node: '>=14.16'} - caniuse-lite@1.0.30001612: - resolution: {integrity: sha512-lFgnZ07UhaCcsSZgWW0K5j4e69dK1u/ltrL9lTUiFOwNHs12S3UMIEYgBV0Z6C6hRDev7iRnMzzYmKabYdXF9g==} + caniuse-lite@1.0.30001683: + resolution: {integrity: sha512-iqmNnThZ0n70mNwvxpEC2nBJ037ZHZUoBI5Gorh1Mw6IlEAZujEoU1tXA628iZfzm7R9FvFzxbfdgml82a3k8Q==} ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -3394,7 +3394,7 @@ snapshots: autoprefixer@10.4.19(postcss@8.4.38): dependencies: browserslist: 4.23.0 - caniuse-lite: 1.0.30001612 + caniuse-lite: 1.0.30001683 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.0 @@ -3470,7 +3470,7 @@ snapshots: browserslist@4.23.0: dependencies: - caniuse-lite: 1.0.30001612 + caniuse-lite: 1.0.30001683 electron-to-chromium: 1.4.746 node-releases: 2.0.14 update-browserslist-db: 1.0.13(browserslist@4.23.0) @@ -3492,7 +3492,7 @@ snapshots: camelcase@7.0.1: {} - caniuse-lite@1.0.30001612: {} + caniuse-lite@1.0.30001683: {} ccount@2.0.1: {} diff --git a/src/components/Sidebar.astro b/src/components/Sidebar.astro index 830150c..9ea75b0 100644 --- a/src/components/Sidebar.astro +++ b/src/components/Sidebar.astro @@ -3,6 +3,14 @@ import type { PageEntry } from "../layouts/PagesLayout.astro"; const entry: PageEntry = Astro.props.entry; const post_url = entry.url + (entry.url.endsWith("/") ? "" : "/"); + +// this may deal with folders. +// if so, it will turn any `-` into whitespace, +// and remove any leading number +const entry_title = entry.title + .replaceAll("-", " ") + .replaceAll(/\d+_/g, ""); + --- { @@ -21,7 +29,7 @@ const post_url = entry.url + (entry.url.endsWith("/") ? "" : "/"); entry.children && ( <>
- {entry.title.replaceAll("-", " ")} + {entry_title}