From 58f5d6c62e4d0a41ac789c77bce490080afaddc8 Mon Sep 17 00:00:00 2001 From: Noelia Donato Date: Wed, 31 Jan 2024 19:53:48 +0100 Subject: [PATCH] fix: delete unused data --- docs/ciberseguridad/streamers.mdx | 2 -- docs/frontend/colors_palette.mdx | 2 -- docs/frontend/components_library.mdx | 4 +--- docs/frontend/icons.mdx | 12 ------------ docs/frontend/images.mdx | 24 ++++++++---------------- docs/frontend/streamers.mdx | 2 -- docs/vscode/extensions.mdx | 4 ++-- lib/date-utils.test.ts | 16 +--------------- lib/date-utils.ts | 10 ---------- lib/file-utils.ts | 12 ------------ lib/mdx/get-menu.tsx | 17 +---------------- 11 files changed, 13 insertions(+), 92 deletions(-) diff --git a/docs/ciberseguridad/streamers.mdx b/docs/ciberseguridad/streamers.mdx index 08f6c18..c5fa8ec 100644 --- a/docs/ciberseguridad/streamers.mdx +++ b/docs/ciberseguridad/streamers.mdx @@ -21,7 +21,5 @@ submenu: src: '/streamers/hack4u.jpg' height: 80 width: 90 - createdAt: '2024-01-29T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' videos: [] --- diff --git a/docs/frontend/colors_palette.mdx b/docs/frontend/colors_palette.mdx index 0e35573..32b992b 100644 --- a/docs/frontend/colors_palette.mdx +++ b/docs/frontend/colors_palette.mdx @@ -40,8 +40,6 @@ submenu: src: '/frontend/uicolors.svg' height: 80 width: 190 - createdAt: '2024-01-25T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' videos: [] - imgPlaceholder: 'Cool Contrast' diff --git a/docs/frontend/components_library.mdx b/docs/frontend/components_library.mdx index 3441b15..54e933a 100644 --- a/docs/frontend/components_library.mdx +++ b/docs/frontend/components_library.mdx @@ -184,7 +184,7 @@ submenu: height: 80 width: 190 videos: [] - + - imgPlaceholder: 'Buttons ibelick' titleCard: 'Buttons ibelick' links: @@ -194,7 +194,5 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-30T00:00:00Z' - updatedAt: '2024-01-30T00:00:00Z' videos: [] --- diff --git a/docs/frontend/icons.mdx b/docs/frontend/icons.mdx index b83b2ec..198a953 100644 --- a/docs/frontend/icons.mdx +++ b/docs/frontend/icons.mdx @@ -104,8 +104,6 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] - imgPlaceholder: svgl @@ -117,8 +115,6 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] - imgPlaceholder: yesicon @@ -130,8 +126,6 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] - imgPlaceholder: Remix Icon @@ -143,8 +137,6 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] - imgPlaceholder: MingCute Icon @@ -156,8 +148,6 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] - imgPlaceholder: Animated Icons @@ -169,7 +159,5 @@ submenu: src: '' height: 80 width: 190 - createdAt: '2024-01-27T00:00:00Z' - updatedAt: '2024-01-27T00:00:00Z' videos: [] --- diff --git a/docs/frontend/images.mdx b/docs/frontend/images.mdx index 82eb1a6..9a27c4e 100644 --- a/docs/frontend/images.mdx +++ b/docs/frontend/images.mdx @@ -14,10 +14,8 @@ submenu: url: 'https://www.pexels.com/es-es/' cover: src: '' - height: 80 - width: 190 - createdAt: '2024-01-29T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' + height: 80 + width: 190 videos: [] - imgPlaceholder: 'Animated Backgrounds' @@ -27,10 +25,8 @@ submenu: url: 'https://animatedbackgrounds.me' cover: src: '' - height: 80 - width: 190 - createdAt: '2024-01-29T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' + height: 80 + width: 190 videos: [] - imgPlaceholder: 'Undraw' @@ -40,10 +36,8 @@ submenu: url: 'https://undraw.co' cover: src: '' - height: 80 - width: 190 - createdAt: '2024-01-29T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' + height: 80 + width: 190 videos: [] - imgPlaceholder: 'Humaaans' @@ -53,9 +47,7 @@ submenu: url: 'https://www.humaaans.com' cover: src: '' - height: 80 - width: 190 - createdAt: '2024-01-29T00:00:00Z' - updatedAt: '2024-01-29T00:00:00Z' + height: 80 + width: 190 videos: [] --- diff --git a/docs/frontend/streamers.mdx b/docs/frontend/streamers.mdx index 454b94d..ce56010 100644 --- a/docs/frontend/streamers.mdx +++ b/docs/frontend/streamers.mdx @@ -113,8 +113,6 @@ submenu: src: '/streamers/carlosazaustre.png' height: 80 width: 90 - createdAt: '2024-01-30T00:00:00Z' - updatedAt: '2024-01-30T00:00:00Z' videos: [] --- diff --git a/docs/vscode/extensions.mdx b/docs/vscode/extensions.mdx index c51724f..fb511ec 100644 --- a/docs/vscode/extensions.mdx +++ b/docs/vscode/extensions.mdx @@ -15,12 +15,11 @@ submenu: src: '' height: 40 width: 40 - createdAt: '2024-01-14T00:00:00Z' - updatedAt: '2024-01-26T00:00:00Z' links: - type: 'Market' url: 'https://marketplace.visualstudio.com/items?itemName=inu1255.easy-snippet' videos: [] + - imgPlaceholder: 'Prettier - Code formatter' titleCard: '' cover: @@ -35,6 +34,7 @@ submenu: videos: - tooltip: 'Como configurar ESLint y Prettier en VSCode' url: 'https://youtu.be/WjkolcG8oVk' + - imgPlaceholder: 'ESLint' titleCard: '' cover: diff --git a/lib/date-utils.test.ts b/lib/date-utils.test.ts index feafe13..acf953b 100644 --- a/lib/date-utils.test.ts +++ b/lib/date-utils.test.ts @@ -1,4 +1,4 @@ -import { isToday, isUpdated } from './date-utils' +import { isToday } from './date-utils' describe('date-utils', () => { const today = new Date() @@ -18,18 +18,4 @@ describe('date-utils', () => { expect(isToday(yesterday)).toBe(false) }) }) - - describe('isUpdated', () => { - test('returns true if updatedDate is today', () => { - expect(isUpdated(today)).toBe(true) - }) - - test('returns true if updatedDate is this week', () => { - expect(isUpdated(yesterday)).toBe(true) - }) - - test('returns false if date is not this week', () => { - expect(isUpdated(lastWeek)).toBe(false) - }) - }) }) diff --git a/lib/date-utils.ts b/lib/date-utils.ts index b769aac..3d86983 100644 --- a/lib/date-utils.ts +++ b/lib/date-utils.ts @@ -7,13 +7,3 @@ export const isToday = (date: Date) => { today.getDate() === date.getDate() ) } - -// Show updated badge if updatedAt is within the last 2 days -export const isUpdated = (updatedAt: Date) => { - const today = new Date() - - const limitDate = new Date(today) - limitDate.setDate(today.getDate() - 2) - - return updatedAt >= limitDate && updatedAt <= today -} diff --git a/lib/file-utils.ts b/lib/file-utils.ts index 491ad26..eee7a00 100644 --- a/lib/file-utils.ts +++ b/lib/file-utils.ts @@ -1,18 +1,6 @@ import fs from 'fs/promises' import path from 'path' -import { isToday, isUpdated } from './date-utils' - export const readFile = (localPath: string) => { return fs.readFile(path.join(process.cwd(), localPath), 'utf8') } - -export const getCreationDate = async (localPath: string) => { - const stats = await fs.stat(path.join(process.cwd(), localPath + '.mdx')) - return isToday(stats.birthtime) -} - -export const getUpdatedDate = async (localPath: string) => { - const stats = await fs.stat(path.join(process.cwd(), localPath + '.mdx')) - return isUpdated(stats.mtime) -} diff --git a/lib/mdx/get-menu.tsx b/lib/mdx/get-menu.tsx index 8639afa..51d05d1 100644 --- a/lib/mdx/get-menu.tsx +++ b/lib/mdx/get-menu.tsx @@ -10,8 +10,6 @@ export const schema = z.array( z.object({ name: z.string(), url: z.string(), - isCreated: z.optional(z.boolean()), - isUpdated: z.optional(z.boolean()), }) ), }) @@ -22,21 +20,8 @@ export async function getMenu() { const parsedData = schema.parse(mdxData.data) - const final = parsedData.map(menuItem => { - return { - name: menuItem.name, - items: menuItem.items.map(at => { - return { - ...at, - isCreated: getCreationDate(at.url), - isUpdated: getUpdatedDate(at.url), - } - }), - } - }) - return { ...mdxData, - data: final, + data: parsedData, } }