Skip to content

Commit

Permalink
refactoring: mainpage
Browse files Browse the repository at this point in the history
  • Loading branch information
highjun committed Oct 1, 2024
1 parent 9f00353 commit f284447
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 198 deletions.
17 changes: 17 additions & 0 deletions data/announcements.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export interface AnnouncementInfo {
pinned: boolean,
path: string,
title: string,
created: string,
}

const announcements: AnnouncementInfo[] = [
{
title: '석박사&인턴모집: Prospective Students',
created: '2023-11-13',
pinned: true,
path: "https://brunch.co.kr/@kaisticlab/3"
}
]

export default announcements;
30 changes: 0 additions & 30 deletions data/main.tsx

This file was deleted.

92 changes: 13 additions & 79 deletions data/publications.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from "fs";
import Cite from 'citation-js';
import supplementaries from "@data/pulbicationSupplementary";

export interface PublicationSupplementaryInfo {
paper: string;
Expand All @@ -17,93 +18,27 @@ export interface PublicationInfo {
supplementary: PublicationSupplementaryInfo;
}

const supplementaries: {
[key: string]: {
video?: string;
code?: string;
}
} = {
park2023charlie: {
video: 'https://youtu.be/sNRkhhgoEHI',
},
park2023quickref: {
video: 'https://youtu.be/SH8Ac7DGWRU',
},
han2022stressbal: {
video: 'https://docs.google.com/presentation/d/1vNkznJx4q5KoOaxMKlzQI5P4IN_leSYscdkZ2WX-KN8/edit?usp=sharing',
},
choi2022you: {
video: 'https://youtu.be/u_lSLpPVbFg',
},
kim2022social: {
video: 'https://youtu.be/Ohd-YyQ8tl4',
},
jung2022caremouse: {
video: 'https://www.youtube.com/watch?v=lUj4s3ITmxs',
},
kang2022understanding: {
video: 'https://youtu.be/CCw1uEOuhZM',
},
jung2021good: {
video: 'https://www.youtube.com/watch?v=mxMoqi58A4I&feature=youtu.be',
},
lee2021sticky: {
video: 'https://www.youtube.com/watch?v=mSCXgOceCpA&ab_channel=ACMSIGCHI',
},
park2021goldentime: {
video: 'https://www.youtube.com/watch?v=oVSeVFfBhQE',
},
cha2020hello: {
video: 'https://www.youtube.com/watch?v=AA8CTi2hEf0',
},
shin2019slow: {

video: 'https://www.youtube.com/watch?v=0iQ6hzU_ct0',
},
kang2019fire: {
video: 'https://youtu.be/yLNF0-S5aLE',
},
park2018interaction: {
video: 'https://drive.google.com/file/d/1S4_C4uozwrfX9yvtBXcCj7u0y33LHzHU/view?usp=sharing',
},

kim2017let: {
video: 'https://www.youtube.com/watch?v=orm1dFj3RY0',
},

choi2016swimtrain: {
video: "https://youtu.be/AmVvpktm0QY",
},

ko2016makes: {
code: 'https://zenodo.org/record/34939#.Vnt0dRWLTcu',
},
ko2016understanding: {
code: 'https://zenodo.org/record/34939#.Vnt0dRWLTcu',
},
}


const bib = fs.readFileSync('data/publication.bib', 'utf8');
const cites = new Cite(bib);

const parseAuthors = (authors: any): string => {
let author = authors.map((a: any) => (a.given?? "") + " " + (a.family?? ""));
if(author.length > 2) {
let author = authors.map((a: any) => (a.given ?? "") + " " + (a.family ?? ""));
if (author.length > 2) {
author[author.length - 1] = "and " + author[author.length - 1]
} else if(authors.length === 2) {
} else if (authors.length === 2) {
author = [author[0] + " and " + author[1]]
}
author = author.join(", ");
return author;
}
}

const parseVenue = (entry: any): string => {
if(entry["type"] === "article-journal") {
if (entry["type"] === "article-journal") {
return `${entry['container-title']} Volume ${entry.volume}, Issue ${entry.issue}`;
}
else if(entry["type"] === "paper-conference") {
return `${entry["container-title"]}` + (entry["collection-title"]? ` (${entry["collection-title"]})`: "");
else if (entry["type"] === "paper-conference") {
return `${entry["container-title"]}` + (entry["collection-title"] ? ` (${entry["collection-title"]})` : "");
}
return entry["container-title"];
}
Expand All @@ -119,8 +54,7 @@ const data = cites.get().map((entry: any) => {
const venue = parseVenue(entry)
const date = parseDate(entry);


const ret = [key, {
const ret = [key, {
title: entry.title,
authors,
venue,
Expand All @@ -132,21 +66,21 @@ const data = cites.get().map((entry: any) => {

const publications: {
[key: string]: PublicationInfo;
} = Object.fromEntries(data.map(([key, { title, authors, venue, date}]: [string, { title: string, authors: string, venue: string, date: string }]) => {
} = Object.fromEntries(data.map(([key, { title, authors, venue, date }]: [string, { title: string, authors: string, venue: string, date: string }]) => {
return [key, {
title,
venue,
authors,
date,
published: true,
supplementary: {
paper: fs.existsSync(`public/publications/papers/${key}.pdf`)? `${key}.pdf`: undefined,
slide: fs.existsSync(`public/publications/slides/${key}.pdf`)? `${key}.pdf`: undefined,
paper: fs.existsSync(`public/publications/papers/${key}.pdf`) ? `${key}.pdf` : undefined,
slide: fs.existsSync(`public/publications/slides/${key}.pdf`) ? `${key}.pdf` : undefined,
video: supplementaries[key]?.video,
code: supplementaries[key]?.code,
}
}]
}).sort((a:any, b:any) => Number(b[1].date.split("-")[0]) - Number(a[1].date.split("-")[0])))
}).sort((a: any, b: any) => Number(b[1].date.split("-")[0]) - Number(a[1].date.split("-")[0])))

// For debugging
// fs.writeFileSync('raw.json', JSON.stringify(cites.get(), null, 2));
Expand Down
67 changes: 67 additions & 0 deletions data/pulbicationSupplementary.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const supplementaries: {
[key: string]: {
video?: string;
code?: string;
}
} = {
park2023charlie: {
video: 'https://youtu.be/sNRkhhgoEHI',
},
park2023quickref: {
video: 'https://youtu.be/SH8Ac7DGWRU',
},
han2022stressbal: {
video: 'https://docs.google.com/presentation/d/1vNkznJx4q5KoOaxMKlzQI5P4IN_leSYscdkZ2WX-KN8/edit?usp=sharing',
},
choi2022you: {
video: 'https://youtu.be/u_lSLpPVbFg',
},
kim2022social: {
video: 'https://youtu.be/Ohd-YyQ8tl4',
},
jung2022caremouse: {
video: 'https://www.youtube.com/watch?v=lUj4s3ITmxs',
},
kang2022understanding: {
video: 'https://youtu.be/CCw1uEOuhZM',
},
jung2021good: {
video: 'https://www.youtube.com/watch?v=mxMoqi58A4I&feature=youtu.be',
},
lee2021sticky: {
video: 'https://www.youtube.com/watch?v=mSCXgOceCpA&ab_channel=ACMSIGCHI',
},
park2021goldentime: {
video: 'https://www.youtube.com/watch?v=oVSeVFfBhQE',
},
cha2020hello: {
video: 'https://www.youtube.com/watch?v=AA8CTi2hEf0',
},
shin2019slow: {

video: 'https://www.youtube.com/watch?v=0iQ6hzU_ct0',
},
kang2019fire: {
video: 'https://youtu.be/yLNF0-S5aLE',
},
park2018interaction: {
video: 'https://drive.google.com/file/d/1S4_C4uozwrfX9yvtBXcCj7u0y33LHzHU/view?usp=sharing',
},

kim2017let: {
video: 'https://www.youtube.com/watch?v=orm1dFj3RY0',
},

choi2016swimtrain: {
video: "https://youtu.be/AmVvpktm0QY",
},

ko2016makes: {
code: 'https://zenodo.org/record/34939#.Vnt0dRWLTcu',
},
ko2016understanding: {
code: 'https://zenodo.org/record/34939#.Vnt0dRWLTcu',
},
}

export default supplementaries;
Loading

0 comments on commit f284447

Please sign in to comment.