Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete unused data #52

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions docs/ciberseguridad/streamers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: []
---
2 changes: 0 additions & 2 deletions docs/frontend/colors_palette.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 1 addition & 3 deletions docs/frontend/components_library.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ submenu:
height: 80
width: 190
videos: []

- imgPlaceholder: 'Buttons ibelick'
titleCard: 'Buttons ibelick'
links:
Expand All @@ -194,7 +194,5 @@ submenu:
src: ''
height: 80
width: 190
createdAt: '2024-01-30T00:00:00Z'
updatedAt: '2024-01-30T00:00:00Z'
videos: []
---
12 changes: 0 additions & 12 deletions docs/frontend/icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -169,7 +159,5 @@ submenu:
src: ''
height: 80
width: 190
createdAt: '2024-01-27T00:00:00Z'
updatedAt: '2024-01-27T00:00:00Z'
videos: []
---
24 changes: 8 additions & 16 deletions docs/frontend/images.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand All @@ -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: []
---
2 changes: 0 additions & 2 deletions docs/frontend/streamers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: []

---
4 changes: 2 additions & 2 deletions docs/vscode/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -35,6 +34,7 @@ submenu:
videos:
- tooltip: 'Como configurar ESLint y Prettier en VSCode'
url: 'https://youtu.be/WjkolcG8oVk'

- imgPlaceholder: 'ESLint'
titleCard: ''
cover:
Expand Down
16 changes: 1 addition & 15 deletions lib/date-utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isToday, isUpdated } from './date-utils'
import { isToday } from './date-utils'

describe('date-utils', () => {
const today = new Date()
Expand All @@ -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)
})
})
})
10 changes: 0 additions & 10 deletions lib/date-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
12 changes: 0 additions & 12 deletions lib/file-utils.ts
Original file line number Diff line number Diff line change
@@ -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)
}
17 changes: 1 addition & 16 deletions lib/mdx/get-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
})
),
})
Expand All @@ -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,
}
}
Loading