rank research output
This commit is contained in:
parent
7478a17822
commit
ed66cc5115
2 changed files with 66 additions and 22 deletions
|
@ -441,7 +441,7 @@ export const authors: Readonly<{ [key: string]: Author }> = {
|
||||||
'Student@srvhs',
|
'Student@srvhs',
|
||||||
],
|
],
|
||||||
image: '/img/profiles/wlin.jpg',
|
image: '/img/profiles/wlin.jpg',
|
||||||
nationality: ['twn', 'chn', 'usa'],
|
nationality: ['twn', 'chn', 'jpn', 'usa'],
|
||||||
formerAffiliations: ['Intern@raid-zero'],
|
formerAffiliations: ['Intern@raid-zero'],
|
||||||
bio: 'Hi, I am Kaito or Warren. I am a Self-taught programmer and engineer. I go around doing dumb things such as my projects. I have a dream of building a community. I am currently part of many projects.',
|
bio: 'Hi, I am Kaito or Warren. I am a Self-taught programmer and engineer. I go around doing dumb things such as my projects. I have a dream of building a community. I am currently part of many projects.',
|
||||||
website: 'https://kaitotlex.carrd.co/',
|
website: 'https://kaitotlex.carrd.co/',
|
||||||
|
@ -468,7 +468,7 @@ export const authors: Readonly<{ [key: string]: Author }> = {
|
||||||
'Mentor@team-1280',
|
'Mentor@team-1280',
|
||||||
],
|
],
|
||||||
formerAffiliations: ['Captain@team-1280', 'Student@srvhs'],
|
formerAffiliations: ['Captain@team-1280', 'Student@srvhs'],
|
||||||
nationality: ['usa'],
|
nationality: ['irl', 'usa'],
|
||||||
image: '/img/profiles/edanko.jpg',
|
image: '/img/profiles/edanko.jpg',
|
||||||
},
|
},
|
||||||
arvenkatesh: {
|
arvenkatesh: {
|
||||||
|
@ -768,6 +768,11 @@ export const nationalities: Readonly<{ [key: string]: Nationality }> = {
|
||||||
demonym: 'Filipino',
|
demonym: 'Filipino',
|
||||||
flag: 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Flag_of_the_Philippines.svg/2880px-Flag_of_the_Philippines.svg.png',
|
flag: 'https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Flag_of_the_Philippines.svg/2880px-Flag_of_the_Philippines.svg.png',
|
||||||
},
|
},
|
||||||
|
irl: {
|
||||||
|
name: 'Republic of Ireland',
|
||||||
|
demonym: 'Irish',
|
||||||
|
flag: 'https://upload.wikimedia.org/wikipedia/commons/4/45/Flag_of_Ireland.svg',
|
||||||
|
},
|
||||||
unknown: {
|
unknown: {
|
||||||
name: 'Undetermined',
|
name: 'Undetermined',
|
||||||
demonym: 'Undetermined',
|
demonym: 'Undetermined',
|
||||||
|
|
|
@ -1,17 +1,52 @@
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { documents, authors, affiliations } from './db/data'
|
import { documents, authors, affiliations, Author } from './db/data'
|
||||||
import News from './components/News'
|
import News from './components/News'
|
||||||
import RandomDocs from './components/RandomDocs'
|
import RandomDocs from './components/RandomDocs'
|
||||||
import RecentDocuments from './components/RecentDocuments'
|
import RecentDocuments from './components/RecentDocuments'
|
||||||
|
|
||||||
|
function sortAuthorsByDocumentsPublished(authors: {
|
||||||
|
[key: string]: Author
|
||||||
|
}): { id: string; author: Author }[] {
|
||||||
|
// Initialize a map to count documents for each author
|
||||||
|
const authorDocumentCount: { [key: string]: number } = {}
|
||||||
|
|
||||||
|
// Iterate over documents to count the number for each author
|
||||||
|
Object.values(documents).forEach((document) => {
|
||||||
|
document.manifest.authors.forEach((authorId) => {
|
||||||
|
if (authorDocumentCount[authorId]) {
|
||||||
|
authorDocumentCount[authorId] += 1
|
||||||
|
} else {
|
||||||
|
authorDocumentCount[authorId] = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// Convert the authors object into an array of objects including the author ID
|
||||||
|
const authorsWithId = Object.keys(authors).map((id) => ({
|
||||||
|
id,
|
||||||
|
author: authors[id],
|
||||||
|
count: authorDocumentCount[id] || 0, // Include the count for sorting
|
||||||
|
}))
|
||||||
|
|
||||||
|
// Sort authors by their document count in descending order
|
||||||
|
authorsWithId.sort((a, b) => b.count - a.count)
|
||||||
|
|
||||||
|
// Return the sorted array, excluding the count property
|
||||||
|
return authorsWithId.map(({ id, author }) => ({ id, author }))
|
||||||
|
}
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const AuthorDisplay = () => {
|
const AuthorDisplay = () => {
|
||||||
return Object.entries(authors).map(([author, data], index) => {
|
return (
|
||||||
|
<ol className='list-decimal pl-4 space-y-2'>
|
||||||
|
{sortAuthorsByDocumentsPublished(authors).map(({ id, author }) => {
|
||||||
|
let data = author
|
||||||
|
|
||||||
let affiliationSlug = data.affiliation[0].split('@')[1]
|
let affiliationSlug = data.affiliation[0].split('@')[1]
|
||||||
let affiliation = affiliations[affiliationSlug]
|
let affiliation = affiliations[affiliationSlug]
|
||||||
return (
|
return (
|
||||||
<div key={author}>
|
<li key={id}>
|
||||||
<Link href={`/author/${author}`}>
|
<Link href={`/author/${id}`}>
|
||||||
{data.name.first}
|
{data.name.first}
|
||||||
{data.name.nickname ? ` "${data.name.nickname}" ` : ' '}
|
{data.name.nickname ? ` "${data.name.nickname}" ` : ' '}
|
||||||
{data.name.last}
|
{data.name.last}
|
||||||
|
@ -20,9 +55,11 @@ export default function Home() {
|
||||||
<Link href={`/affiliation/${affiliationSlug}`}>
|
<Link href={`/affiliation/${affiliationSlug}`}>
|
||||||
{affiliation.short}
|
{affiliation.short}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ol>
|
||||||
)
|
)
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -45,7 +82,9 @@ export default function Home() {
|
||||||
<News />
|
<News />
|
||||||
<div className='grid grid-cols-1 space-y-2 mt-4 basis-full'>
|
<div className='grid grid-cols-1 space-y-2 mt-4 basis-full'>
|
||||||
<br />
|
<br />
|
||||||
<div className='font-serif text-xl my-2'>Recently released documents</div>
|
<div className='font-serif text-xl my-2'>
|
||||||
|
Recently released documents
|
||||||
|
</div>
|
||||||
<RecentDocuments />
|
<RecentDocuments />
|
||||||
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
|
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
|
||||||
<br />
|
<br />
|
||||||
|
@ -56,7 +95,7 @@ export default function Home() {
|
||||||
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
|
<hr className='mx-auto w-full h-1 border-0 bg-slate-200 my-2 rounded-md' />
|
||||||
<br />
|
<br />
|
||||||
<div className='font-serif text-xl'>
|
<div className='font-serif text-xl'>
|
||||||
Our esteemed faculty and alumni
|
Our esteemed faculty and alumni (ranked by research output)
|
||||||
</div>
|
</div>
|
||||||
<AuthorDisplay />
|
<AuthorDisplay />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue