From 62bfb94cd43601a56f05e659ade05ebec37f2fa4 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Sat, 10 Feb 2024 21:22:17 -0800 Subject: [PATCH] fix stuff --- src/app/db/data.ts | 10 +++++-- src/app/document/view/[slug]/page.tsx | 43 ++++++++++++++++----------- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/app/db/data.ts b/src/app/db/data.ts index def7a1c..989dc19 100644 --- a/src/app/db/data.ts +++ b/src/app/db/data.ts @@ -21,7 +21,13 @@ documents { } */ export type FileType = 'pdf' | 'docx' | 'pptx' | 'tar.gz' | 'other' -export type DocumentType = 'presentation' | 'report' | 'white paper' | 'other' +export type DocumentType = + | 'presentation' + | 'report' + | 'white paper' + | 'dwm' + | 'datasheet' + | 'other' export interface DocumentDB { [key: string]: { manifest: { @@ -66,7 +72,7 @@ export const documents: DocumentDB = { authors: ['mbohsali', 'avenkatesh', 'ywu'], topics: ['frc', 'eecs'], dates: [1706080618], - type: 'report', + type: 'dwm', latest: 1, keywords: [ 'team 1280/identity and branding', diff --git a/src/app/document/view/[slug]/page.tsx b/src/app/document/view/[slug]/page.tsx index e9adddc..f25bbbd 100644 --- a/src/app/document/view/[slug]/page.tsx +++ b/src/app/document/view/[slug]/page.tsx @@ -41,12 +41,12 @@ export default function Page({ <> Topics: {topics.map((t: string, i) => ( - <> + {topicList[t].name} {i !== topics.length - 1 ? ', ' : null} - + ))} ) @@ -74,40 +74,49 @@ export default function Page({ return ( <> {authors.map((a: string, i) => ( - <> + {authorList[a].name.first} {authorList[a].name.last} {i !== authors.length - 1 && authors.length > 2 ? ', ' : null} {i === authors.length - 2 ? ' and ' : null} - + ))} ) } const generateItemBadge = (itemName: DocumentType) => { - let itemStyle: string = 'px-3 py-1.5 rounded inline-block w-fit mr-2 mt-4 ' + let text = '' + let itemStyle: string = + 'px-3 py-1.5 rounded inline-block w-fit mr-2 mt-4 text-slate-50 border-2 ' switch (itemName) { case 'report': - itemStyle += 'bg-green-400 text-slate-50' + itemStyle += 'bg-green-500 border-green-500' + text = 'Report' break case 'presentation': - itemStyle += `bg-blue-400 text-slate-50` + text = 'Presentation' + itemStyle += `bg-blue-500 border-blue-500` break case 'white paper': - itemStyle += `bg-fuchsia-700 text-slate-50` + text = 'White Paper' + itemStyle += `bg-fuchsia-700 border-fuchsia-700` + break + case 'datasheet': + text = 'Datasheet' + itemStyle += 'bg-amber-600 border-amber-600' + break + case 'dwm': + text = 'DWM' + itemStyle += 'bg-rose-950 border-rose-950' break case 'other': - itemStyle += `bg-gray-400 text-slate-50` + text = 'Other' + itemStyle += `bg-gray-400 border-gray-400` break } - return ( -

- {itemName.charAt(0).toUpperCase()} - {itemName.slice(1)} -

- ) + return {text} } return ( @@ -115,7 +124,7 @@ export default function Page({

@@ -129,7 +138,7 @@ export default function Page({

{generateItemBadge(type)} -

+

Revision {latest}