From b43f562e2e5b8476c6480f62ed8fbf6ccfe67520 Mon Sep 17 00:00:00 2001 From: Daniele Sabre Date: Fri, 10 Nov 2023 10:42:09 +0100 Subject: [PATCH] simplified function list --- src/components/Sidebar.vue | 32 ++++++++++---------------------- src/router/index.js | 18 ++++++++++++++---- src/utils/functionsList.js | 15 --------------- 3 files changed, 24 insertions(+), 41 deletions(-) delete mode 100644 src/utils/functionsList.js diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index 90035d7..ec24b7e 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -1,23 +1,21 @@ @@ -115,9 +113,7 @@ watch(search, () => { -
+
{ > Show GitHub profile
- Bonnie avatar + Bonnie avatar
-
- Daniele Sabre -
+
Daniele Sabre
diff --git a/src/router/index.js b/src/router/index.js index 345c5a4..d59f190 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,5 +1,4 @@ import {createRouter, createWebHistory} from 'vue-router'; -import functionsList from '@/utils/functionsList'; export const routes = [ // { @@ -8,10 +7,21 @@ export const routes = [ // component: () => import('../views/HomeView.vue') // } ]; +const addRoute = (fName) => + routes.push({path: `/f/${fName}`, name: fName, component: () => import(`../views/functions/${fName}.vue`)}); -functionsList.forEach((fName) => - routes.push({path: `/f/${fName}`, name: fName, component: () => import(`../views/functions/${fName}.vue`)}) -); +addRoute('ucfirst'); +addRoute('ifNaN'); +addRoute('getElementHeight'); +addRoute('getFormData'); +addRoute('padLeft'); +addRoute('downloadFile'); +addRoute('makeId'); +addRoute('getClonedObject'); +addRoute('stripTags'); + +// sort routes alphabetically +routes.sort((a, b) => a.name.localeCompare(b.name)); // set first function as homepage routes.push({path: '/', name: 'home', component: routes[0].component}); diff --git a/src/utils/functionsList.js b/src/utils/functionsList.js deleted file mode 100644 index 6e6ddbb..0000000 --- a/src/utils/functionsList.js +++ /dev/null @@ -1,15 +0,0 @@ -const functionsList = [ - 'ucfirst', - 'ifNaN', - 'getElementHeight', - 'getFormData', - 'padLeft', - 'downloadFile', - 'makeId', - 'getClonedObject', - 'stripTags' -]; - -functionsList.sort(); - -export default functionsList; \ No newline at end of file