From 79f74d87315a60029ccfe8fb9d30247d266dfd7f Mon Sep 17 00:00:00 2001 From: Team 1280 Programming Laptop <59985235+Team1280Programming@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:11:34 -0800 Subject: [PATCH] Add new document properties and search options --- src/app/db/data.ts | 2 ++ src/app/document/view/[slug]/DocumentViewer.tsx | 15 +++++++++------ src/app/page.tsx | 5 +---- src/app/utils/hash.ts | 10 ++++++++++ src/app/utils/search.worker.ts | 6 ++++++ 5 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 src/app/utils/hash.ts diff --git a/src/app/db/data.ts b/src/app/db/data.ts index 1f7f0e7..dc698c1 100644 --- a/src/app/db/data.ts +++ b/src/app/db/data.ts @@ -26,6 +26,7 @@ export interface Document { abstract: string file: FileType citation?: string + doi?: string } export interface DocumentManifest { title: string @@ -282,6 +283,7 @@ On Day 1 we will discuss the ins and outs of the robot. The Electrical Sub team }, abstract: `In this paper, we present eeXiv, an open-source, open-access project hosted by Team 1280 EECS ("Electrical Engineering and Computer Science"), independent of the department of the same name at UC Berkeley. We aim to rival arXiv as the single largest open-source and open-access research paper repository and as the largest research paper repository on the West Coast, transforming San Ramon Valley High School into a tier-1 research institution. Similar to arXiv, we host electronic preprints and postprints (known as e-prints) approved for posting after a rigorous peer review process. Our repository consists of scientific papers in the fields of mathematics, physics, astronomy, electrical engineering, computer science, quantitative biology, statistics, mathematical finance, and economics, with a focus on papers specific to the FIRST Robotics Competition. eeXiv bypasses the traditional bureaucracy of research publication, which involves lengthy peer review proesses and journal approval, by enabling "libre" and "open" publication, dissemination, and consumption of research artifacts. `, file: 'pdf', + doi: '10.5281/zenodo.10668656', }, } diff --git a/src/app/document/view/[slug]/DocumentViewer.tsx b/src/app/document/view/[slug]/DocumentViewer.tsx index b36c2ec..be9dd41 100644 --- a/src/app/document/view/[slug]/DocumentViewer.tsx +++ b/src/app/document/view/[slug]/DocumentViewer.tsx @@ -11,6 +11,7 @@ import { import { ItemBadge, Status } from '@/app/components/Badges' import VersionChooser from './VersionChooser' import crypto from 'crypto' +import generateHash from '@/app/utils/hash' import { Suspense } from 'react' import { loadDocument } from '@/app/db/loaders' import { useSuspenseQuery } from '@tanstack/react-query' @@ -28,7 +29,7 @@ const DocumentViewer = ({ slug }: Readonly<{ slug: string }>) => { if (error) throw error let doc = data - const { manifest, abstract, citation } = doc + const { manifest, abstract, citation, doi } = doc const { title, @@ -44,11 +45,7 @@ const DocumentViewer = ({ slug }: Readonly<{ slug: string }>) => { } = manifest // git style hash - const hash = crypto - .createHash('sha256') - .update(slug) - .digest('hex') - .substring(0, 7) + const hash = generateHash(slug) return (
+ DOI: + {doi} +
+)}