Skip to content

Commit

Permalink
refactor: rename project files
Browse files Browse the repository at this point in the history
  • Loading branch information
hendraaagil committed Dec 16, 2023
1 parent b57351a commit 74546c2
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 21 deletions.
37 changes: 30 additions & 7 deletions contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@ import {
import { generateBase64Image } from './src/lib/server/utils'
import { Hardware, Skill, Social, Software } from './src/types/content'

// Computed fields
// Common computed fields
const computedFields: ComputedFields = {
slug: {
type: 'string',
resolve: (doc) => doc._raw.sourceFileName.replace(/\.mdx/, ''),
},
thumbnailPlaceholder: {
type: 'string',
resolve: async (doc) => await generateBase64Image(doc.thumbnail),
Expand Down Expand Up @@ -70,6 +66,10 @@ const Post = defineDocumentType(() => ({
},
computedFields: {
...computedFields,
slug: {
type: 'string',
resolve: (doc) => doc._raw.sourceFileName.replace(/\.mdx/, ''),
},
readTime: {
type: 'number',
resolve: (doc) => Math.ceil(doc.body.raw.split(' ').length / 200),
Expand All @@ -84,14 +84,37 @@ const Project = defineDocumentType(() => ({
filePathPattern: `project/**/*.mdx`,
contentType: 'mdx',
fields: {
position: { type: 'number', required: true },
title: { type: 'string', required: true },
thumbnail: { type: 'string', required: true },
description: { type: 'string', required: true },
github: { type: 'string' },
demo: { type: 'string' },
},
computedFields,
computedFields: {
...computedFields,
// 01-foo-bar.mdx -> 1
position: {
type: 'number',
resolve: (doc) =>
Number(
doc._raw.sourceFileName
.replace(/\.mdx/, '')
.split('-')
.slice(0, 1)
.toString(),
),
},
// 01-foo-bar.mdx -> foo-bar
slug: {
type: 'string',
resolve: (doc) =>
doc._raw.sourceFileName
.replace(/\.mdx/, '')
.split('-')
.slice(1)
.join('-'),
},
},
}))

export default makeSource({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 1
title: Image Gallery
description: Image gallery app to search your favorite image.
thumbnail: /assets/project/image-gallery.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 2
title: Todo List
description: Todo list app to manage your activities.
thumbnail: /assets/project/todo-list.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 3
title: E-Voting
description: E-Voting app to choose your choice.
thumbnail: /assets/project/e-voting.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 4
title: Gift Store Landing Page
description: Simple landing page sliced from figma design.
thumbnail: /assets/project/gift-store-landing-page.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 5
title: Pengaduan Sekolah
description: Pengaduan sekolah is an app for sent complaint to your school.
thumbnail: /assets/project/pengaduan-sekolah.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 6
title: Next.js Chakra Starter
description: An opinionated simple starter / template project with Next.js and Chakra UI.
thumbnail: /assets/project/next-chakra-starter.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 7
title: Bed Covid RS Indonesia
description: A website that provides information regarding the availability of hospitals and hospital beds for covid-19 or non-covid patients in Indonesia.
thumbnail: /assets/project/bed-covid-rs-indonesia.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 8
title: RPL Skandakra Dev Website
description: An official website for RPL Skandakra Dev Community.
thumbnail: /assets/project/rpl-skandakra-dev-website.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 9
title: RPL Skandakra Bot
description: A bot for help moderation in RPL Skandakra Discord Server.
thumbnail: /assets/project/rpl-skandakra-bot.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 10
title: Vlr API
description: Unofficial Valorant match API from https://vlr.gg site.
thumbnail: /assets/project/vlr-api.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 12
title: Fit.Cells
description: An app for booking gym, class, and trainer.
thumbnail: /assets/project/fitcells.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 13
title: Tuut
description: An app for booking class and tutor.
thumbnail: /assets/project/tuut.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 14
title: Gelora
description: An app for booking field and activity.
thumbnail: /assets/project/gelora.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
position: 11
title: GilBot
description: WhatsApp bot for any needs.
thumbnail: /assets/project/gilbot.png
Expand Down

1 comment on commit 74546c2

@vercel
Copy link

@vercel vercel bot commented on 74546c2 Dec 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.