Skip to content

Commit

Permalink
fix: 🐛 links
Browse files Browse the repository at this point in the history
  • Loading branch information
gouz committed Sep 22, 2024
1 parent efc3ce8 commit f73d5fa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,15 @@ Arguments:
json the json export file from Conference Hall

Options:
-v, --version output the version number
-c, --with-categories view categories (default: false)
-f, --with-formats view formats (default: false)
-e, --with-companies view speakers company (default: false)
-a, --with-addresses view speakers address (default: false)
-l, --with-languages view talks language (default: false)
-t, --titlelength <int> the title length (default: 100)
-w, --links <eventId> view links
-x, --export <file> export into tsv file
-r, --render render on a webpage (default: false)
-p, --compact compact render on a webpage (default: false)
-h, --help display help for command
-v, --version output the version number
-c, --with-categories view categories (default: false)
-f, --with-formats view formats (default: false)
-e, --with-companies view speakers company (default: false)
-a, --with-addresses view speakers address (default: false)
-t, --with-languages view talks language (default: false)
-l, --links <eventId> view links
-p, --compact compact render (default: false)
-h, --help display help for command
```

### Default usage
Expand Down
8 changes: 5 additions & 3 deletions src/DTO.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ConferenceHallTalk, TalkRow } from "./types";
import type { ConferenceHallTalk, Options, TalkRow } from "./types";

export const DTO = (talks: ConferenceHallTalk[]): TalkRow[] =>
export const DTO = (talks: ConferenceHallTalk[], options: Options): TalkRow[] =>
talks.map((talk) => ({
id: talk.id,
title: talk.title,
Expand All @@ -20,5 +20,7 @@ export const DTO = (talks: ConferenceHallTalk[]): TalkRow[] =>
confirmationStatus: talk.confirmationStatus,
level: talk.level,
languages: talk.languages,
link: `https://conference-hall.io/organizer/event/${Bun.env.EVENTID}/proposals/${talk.id}`,
link: options.links
? `https://conference-hall.io/organizer/event/${options.links}/proposals/${talk.id}`
: "",
}));
2 changes: 1 addition & 1 deletion src/choc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import css from "./render/main.css" with { type: "text" };
import type { Options } from "./types.js";

const choc = async (file: string, options: Options) => {
const talks = DTO(await Bun.file(file).json());
const talks = DTO(await Bun.file(file).json(), options);
const server = Bun.serve({
port: 1337,
async fetch(req) {
Expand Down
4 changes: 2 additions & 2 deletions src/render/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const joliTalk = (talk) => `
.map((s) => s.company)
.join(" ")} ">
<header>
<a href="${`https://conference-hall.io/organizer/event/@TODO/proposals/${talk.id}`}">${linkIcon}</a>
${talk.link !== "" ? `<a href="${talk.link}">${linkIcon}</a>` : ""}
<h3>${talk.title}</h3>
</header>
<div class="info">
Expand Down Expand Up @@ -91,7 +91,7 @@ const rowTalk = (talk) => `
)} " data-companies=" ${talk.speakers
.map((s) => s.company)
.join(" ")} ">
<td>${talk.title}</td>
<td>${talk.link !== "" ? `<a href="${talk.link}">${linkIcon}</a>` : ""}${talk.title}</td>
<td class="format">${talk.format}</td>
<td class="category">${talk.category}</td>
<td class="speakers">${talk.speakers.map((s) => s.name).join("<br />")}</td>
Expand Down

0 comments on commit f73d5fa

Please sign in to comment.