From 1375784a249760b0fc01682a3ce4ac01a1d92315 Mon Sep 17 00:00:00 2001 From: Daniel Brito Date: Tue, 27 Aug 2024 22:42:18 +0000 Subject: [PATCH] refactor: improve zines route definition --- docs/NewPublications.md | 8 +++++--- src/routes/Routes.js | 45 +++++++---------------------------------- 2 files changed, 12 insertions(+), 41 deletions(-) diff --git a/docs/NewPublications.md b/docs/NewPublications.md index c880ad1..8e813d5 100644 --- a/docs/NewPublications.md +++ b/docs/NewPublications.md @@ -3,11 +3,13 @@ - Add image file to `src/assets/zines` or `src/assets/books`: - Dimensions (WxH): `339x480` - Format: `WEBP` -- Import thumb image into `src/data/Thumbs.js` and set the `altText` + +- Import thumb image into `src/data/Thumbs.js` and set a descriptive `altText` - Add PDF file source URL from GoogleDrive into `src/data/FilesSource.js` - Add route to `src/routes/Routes.js` + - Increment `NUMBER_OF_PUBLISHED_ZINES` for zines - Add publication info to `src/data/Books.js` or `src/data/Zines.js`: @@ -15,9 +17,9 @@ ... { name: 'New Publication', - releasedAt: '05/02/2015', + releasedAt: 'DD/MM/YYYY', thumb: thumbs.NEW_PUBLICATION.image, path: `${prefix}${routes.NEW_PUBLICATION_PATH}`, altText: thumbs.NEW_PUBLICATION.altText, } -``` \ No newline at end of file +``` diff --git a/src/routes/Routes.js b/src/routes/Routes.js index dce0136..8ee46bf 100644 --- a/src/routes/Routes.js +++ b/src/routes/Routes.js @@ -1,48 +1,17 @@ +const NUMBER_OF_PUBLISHED_ZINES = 37 + const routes = { APP_BASE_URL: '/poemix', ZINES_PATH: '/zines', BOOKS_PATH: '/livros', PROTESTIZANDO_PATH: '/protestizando', - A_LER_VAZIOS_PATH: '/a_ler_vazios', - PROTESTIZANDO_1_PATH: '/protestizando_1', - PROTESTIZANDO_2_PATH: '/protestizando_2', - PROTESTIZANDO_3_PATH: '/protestizando_3', - PROTESTIZANDO_4_PATH: '/protestizando_4', - PROTESTIZANDO_5_PATH: '/protestizando_5', - PROTESTIZANDO_6_PATH: '/protestizando_6', - PROTESTIZANDO_7_PATH: '/protestizando_7', - PROTESTIZANDO_8_PATH: '/protestizando_8', - PROTESTIZANDO_9_PATH: '/protestizando_9', - PROTESTIZANDO_10_PATH: '/protestizando_10', - PROTESTIZANDO_11_PATH: '/protestizando_11', - PROTESTIZANDO_12_PATH: '/protestizando_12', - PROTESTIZANDO_13_PATH: '/protestizando_13', - PROTESTIZANDO_14_PATH: '/protestizando_14', - PROTESTIZANDO_15_PATH: '/protestizando_15', - PROTESTIZANDO_16_PATH: '/protestizando_16', - PROTESTIZANDO_17_PATH: '/protestizando_17', - PROTESTIZANDO_18_PATH: '/protestizando_18', - PROTESTIZANDO_19_PATH: '/protestizando_19', - PROTESTIZANDO_20_PATH: '/protestizando_20', - PROTESTIZANDO_21_PATH: '/protestizando_21', - PROTESTIZANDO_22_PATH: '/protestizando_22', - PROTESTIZANDO_23_PATH: '/protestizando_23', - PROTESTIZANDO_24_PATH: '/protestizando_24', - PROTESTIZANDO_25_PATH: '/protestizando_25', - PROTESTIZANDO_26_PATH: '/protestizando_26', - PROTESTIZANDO_27_PATH: '/protestizando_27', - PROTESTIZANDO_28_PATH: '/protestizando_28', - PROTESTIZANDO_29_PATH: '/protestizando_29', - PROTESTIZANDO_30_PATH: '/protestizando_30', - PROTESTIZANDO_31_PATH: '/protestizando_31', - PROTESTIZANDO_32_PATH: '/protestizando_32', - PROTESTIZANDO_33_PATH: '/protestizando_33', - PROTESTIZANDO_34_PATH: '/protestizando_34', - PROTESTIZANDO_35_PATH: '/protestizando_35', - PROTESTIZANDO_36_PATH: '/protestizando_36', - PROTESTIZANDO_37_PATH: '/protestizando_37', + A_LER_VAZIOS_PATH: '/a_ler_vazios' }; +for (let i = 1; i <= NUMBER_OF_PUBLISHED_ZINES; i++) { + routes[`PROTESTIZANDO_${i}_PATH`] = `/protestizando_${i}`; +} + export const getRoutes = () => { return routes; };