From ed66cc5115394268d746ebdbfe6fc4bd9a6e0a04 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 14 Feb 2024 15:52:47 -0800 Subject: [PATCH 1/5] rank research output --- src/app/db/data.ts | 9 ++++-- src/app/page.tsx | 79 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/app/db/data.ts b/src/app/db/data.ts index a5a1c73..42163a9 100644 --- a/src/app/db/data.ts +++ b/src/app/db/data.ts @@ -441,7 +441,7 @@ export const authors: Readonly<{ [key: string]: Author }> = { 'Student@srvhs', ], image: '/img/profiles/wlin.jpg', - nationality: ['twn', 'chn', 'usa'], + nationality: ['twn', 'chn', 'jpn', 'usa'], 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.', website: 'https://kaitotlex.carrd.co/', @@ -468,7 +468,7 @@ export const authors: Readonly<{ [key: string]: Author }> = { 'Mentor@team-1280', ], formerAffiliations: ['Captain@team-1280', 'Student@srvhs'], - nationality: ['usa'], + nationality: ['irl', 'usa'], image: '/img/profiles/edanko.jpg', }, arvenkatesh: { @@ -768,6 +768,11 @@ export const nationalities: Readonly<{ [key: string]: Nationality }> = { demonym: 'Filipino', 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: { name: 'Undetermined', demonym: 'Undetermined', diff --git a/src/app/page.tsx b/src/app/page.tsx index 1132f39..480b3ad 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,28 +1,65 @@ 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 RandomDocs from './components/RandomDocs' 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() { const AuthorDisplay = () => { - return Object.entries(authors).map(([author, data], index) => { - let affiliationSlug = data.affiliation[0].split('@')[1] - let affiliation = affiliations[affiliationSlug] - return ( -
- - {data.name.first} - {data.name.nickname ? ` "${data.name.nickname}" ` : ' '} - {data.name.last} - {' '} - of{' '} - - {affiliation.short} - -
- ) - }) + return ( +
    + {sortAuthorsByDocumentsPublished(authors).map(({ id, author }) => { + let data = author + + let affiliationSlug = data.affiliation[0].split('@')[1] + let affiliation = affiliations[affiliationSlug] + return ( +
  1. + + {data.name.first} + {data.name.nickname ? ` "${data.name.nickname}" ` : ' '} + {data.name.last} + {' '} + of{' '} + + {affiliation.short} + +
  2. + ) + })} +
+ ) } return ( @@ -45,7 +82,9 @@ export default function Home() {

-
Recently released documents
+
+ Recently released documents +


@@ -56,7 +95,7 @@ export default function Home() {

- Our esteemed faculty and alumni + Our esteemed faculty and alumni (ranked by research output)
From 27358c4c8763ceada1e4ad3b5b94995d0bc6befb Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 14 Feb 2024 15:53:22 -0800 Subject: [PATCH 2/5] update package-lock --- package-lock.json | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2948213..74682d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1001,13 +1001,13 @@ "version": "15.7.11", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==", - "dev": true + "devOptional": true }, "node_modules/@types/react": { "version": "18.2.55", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.55.tgz", "integrity": "sha512-Y2Tz5P4yz23brwm2d7jNon39qoAtMMmalOQv6+fEFt1mT+FcM3D841wDpoUvFXhaYenuROCy3FZYqdTjM7qVyA==", - "dev": true, + "devOptional": true, "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -1027,7 +1027,7 @@ "version": "0.16.8", "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==", - "dev": true + "devOptional": true }, "node_modules/@typescript-eslint/parser": { "version": "6.21.0", @@ -1759,7 +1759,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true + "devOptional": true }, "node_modules/damerau-levenshtein": { "version": "1.0.8", @@ -4344,6 +4344,13 @@ "node": ">=8.10.0" } }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "dev": true, + "peer": true + }, "node_modules/reflect.getprototypeof": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.5.tgz", From d14528243ed9be131606d6ce8a4b01763270eddd Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 14 Feb 2024 16:32:36 -0800 Subject: [PATCH 3/5] fix some styling wip --- src/app/author/[author]/AuthorDisplay.tsx | 9 ++++-- src/app/components/DocumentCard.tsx | 2 +- src/app/components/mobileMenu.module.css | 1 - src/app/search/page.tsx | 2 +- src/app/styles/cardEffects.module.css | 35 ++++++++++++++++++++--- 5 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/app/author/[author]/AuthorDisplay.tsx b/src/app/author/[author]/AuthorDisplay.tsx index f1eb094..81e73c7 100644 --- a/src/app/author/[author]/AuthorDisplay.tsx +++ b/src/app/author/[author]/AuthorDisplay.tsx @@ -5,6 +5,7 @@ import { Zilla_Slab } from 'next/font/google' import { notFound } from 'next/navigation' import DocumentCard from '@/app/components/DocumentCard' import findDocumentsByAuthor from './findDocumentsByAuthor' +import cardEffects from '@/app/styles/cardEffects.module.css' const zillaSlab = Zilla_Slab({ subsets: ['latin'], weight: ['500'] }) @@ -41,11 +42,15 @@ export default function AuthorDisplay({ ) : null}
{affiliation.map((a: string) => ( - + {affiliations[a.split('@')[1]].name} ))} diff --git a/src/app/components/DocumentCard.tsx b/src/app/components/DocumentCard.tsx index 76f95dc..cd7ac15 100644 --- a/src/app/components/DocumentCard.tsx +++ b/src/app/components/DocumentCard.tsx @@ -14,7 +14,7 @@ const DocumentCard = ({ doc, href }: { doc: Document; href: string }) => { return (

{title}

diff --git a/src/app/components/mobileMenu.module.css b/src/app/components/mobileMenu.module.css index 06d7ef9..280d362 100644 --- a/src/app/components/mobileMenu.module.css +++ b/src/app/components/mobileMenu.module.css @@ -1,6 +1,5 @@ .menu { @apply overflow-hidden left-[0] top-[235px] z-10 absolute bg-slate-200; - @apply duration-300; height: fit-content; padding-bottom: 10px; transition: height 0.2s ease-in-out; diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx index a88aa7d..778f348 100644 --- a/src/app/search/page.tsx +++ b/src/app/search/page.tsx @@ -42,7 +42,7 @@ const SearchResult = ({ return (
diff --git a/src/app/styles/cardEffects.module.css b/src/app/styles/cardEffects.module.css index dba28e2..daaa064 100644 --- a/src/app/styles/cardEffects.module.css +++ b/src/app/styles/cardEffects.module.css @@ -1,12 +1,12 @@ /* creates a 3D card effect using a pseudo element for performance reasons */ -.card { +.card-large { @apply shadow-sm shadow-slate-300; /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); */ transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1); position: relative; } -.card::after { +.card-large::after { @apply shadow-lg shadow-slate-500; content: ''; z-index: -1; @@ -19,10 +19,37 @@ left: 0; } -.card:hover { +.card-large:hover { transform: scale(1.02, 1.02); } -.card:hover::after { +.card-large:hover::after { + opacity: 1; +} + +.card-small { + @apply shadow-sm shadow-slate-300; + /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); */ + transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1); + position: relative; +} +.card-small::after { + @apply shadow-md shadow-slate-500; + content: ''; + z-index: -1; + transition: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1); + position: absolute; + opacity: 0; + width: 100%; + height: 100%; + top: 0; + left: 0; +} + +.card-small:hover { + transform: scale(1.08, 1.08); +} + +.card-small:hover::after { opacity: 1; } From 62ddeaff6ab9f3f75a62842f46f644bf36eac873 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 14 Feb 2024 16:35:10 -0800 Subject: [PATCH 4/5] fix mobile menu --- src/app/components/mobileMenu.module.css | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/app/components/mobileMenu.module.css b/src/app/components/mobileMenu.module.css index 280d362..fce92ec 100644 --- a/src/app/components/mobileMenu.module.css +++ b/src/app/components/mobileMenu.module.css @@ -1,7 +1,7 @@ .menu { @apply overflow-hidden left-[0] top-[235px] z-10 absolute bg-slate-200; - height: fit-content; - padding-bottom: 10px; + @apply duration-300; + height: calc(200px); transition: height 0.2s ease-in-out; width: 100vw; right: 0; @@ -17,5 +17,4 @@ .menu-hidden { height: 0; - padding-bottom: 0; } From 12cc1ec29b58579a61f23bcc1a14539d4f085d5c Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 14 Feb 2024 16:51:00 -0800 Subject: [PATCH 5/5] finally fix mobile styling --- src/app/components/MobileMenu.tsx | 22 ++++++++++++---------- src/app/components/SearchBar.tsx | 6 +++--- src/app/components/mobileMenu.module.css | 9 ++++----- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/app/components/MobileMenu.tsx b/src/app/components/MobileMenu.tsx index 1f703b7..cce51f1 100644 --- a/src/app/components/MobileMenu.tsx +++ b/src/app/components/MobileMenu.tsx @@ -31,19 +31,21 @@ export default function MobileMenu() { } return ( -
- + <> +
+ +
- +
- +

We gratefully acknowledge support from our volunteer peer reviewers, member institutions, and all{' '} @@ -56,6 +58,6 @@ export default function MobileMenu() { .

-
+ ) } diff --git a/src/app/components/SearchBar.tsx b/src/app/components/SearchBar.tsx index 20f7eec..a1dfee0 100644 --- a/src/app/components/SearchBar.tsx +++ b/src/app/components/SearchBar.tsx @@ -25,10 +25,10 @@ export default function SearchBar({ } return ( -
+