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,28 +1,65 @@
|
||||||
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 (
|
||||||
let affiliationSlug = data.affiliation[0].split('@')[1]
|
<ol className='list-decimal pl-4 space-y-2'>
|
||||||
let affiliation = affiliations[affiliationSlug]
|
{sortAuthorsByDocumentsPublished(authors).map(({ id, author }) => {
|
||||||
return (
|
let data = author
|
||||||
<div key={author}>
|
|
||||||
<Link href={`/author/${author}`}>
|
let affiliationSlug = data.affiliation[0].split('@')[1]
|
||||||
{data.name.first}
|
let affiliation = affiliations[affiliationSlug]
|
||||||
{data.name.nickname ? ` "${data.name.nickname}" ` : ' '}
|
return (
|
||||||
{data.name.last}
|
<li key={id}>
|
||||||
</Link>{' '}
|
<Link href={`/author/${id}`}>
|
||||||
of{' '}
|
{data.name.first}
|
||||||
<Link href={`/affiliation/${affiliationSlug}`}>
|
{data.name.nickname ? ` "${data.name.nickname}" ` : ' '}
|
||||||
{affiliation.short}
|
{data.name.last}
|
||||||
</Link>
|
</Link>{' '}
|
||||||
</div>
|
of{' '}
|
||||||
)
|
<Link href={`/affiliation/${affiliationSlug}`}>
|
||||||
})
|
{affiliation.short}
|
||||||
|
</Link>
|
||||||
|
</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