From 948ee9dff16b7b12eabb18d6a08ae7c260085115 Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Sun, 6 Oct 2024 16:31:26 +0100 Subject: [PATCH] feat: conversation titles --- caesar.json | 1 + ides-of-march.json | 1 + lepidus.json | 1 + lucius.json | 1 + main.js | 6 ++---- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/caesar.json b/caesar.json index ce949d8..b60d73c 100644 --- a/caesar.json +++ b/caesar.json @@ -1,4 +1,5 @@ { + "title": "Julius Caesar", "characters": [ "Mark Antony", "Julius Caesar" diff --git a/ides-of-march.json b/ides-of-march.json index 50ab03a..4981793 100644 --- a/ides-of-march.json +++ b/ides-of-march.json @@ -1,4 +1,5 @@ { + "title": "Operation Ides of March", "characters": [ "Mark Antony", "Cassius", diff --git a/lepidus.json b/lepidus.json index 20b0afa..c9200cc 100644 --- a/lepidus.json +++ b/lepidus.json @@ -1,4 +1,5 @@ { + "title": "Lepidus", "characters": [ "Mark Antony", "Lepidus" diff --git a/lucius.json b/lucius.json index 148ba5c..5060c6f 100644 --- a/lucius.json +++ b/lucius.json @@ -1,4 +1,5 @@ { + "title": "Lucius Antony", "characters": [ "Mark Antony", "Lucius Antony" diff --git a/main.js b/main.js index e87a62d..155142b 100644 --- a/main.js +++ b/main.js @@ -234,10 +234,9 @@ function showConversation(path) { setVisibleOnMobile(mainPanel, true); setVisibleOnMobile(conversationListElem, false); - const title = path.split(".")[0]; readConversationJson(path, json => { - conversation = new Conversation(title); + conversation = new Conversation(json.title); const jsonMessages = json.messages; const participants = json.characters; @@ -264,7 +263,6 @@ function showConversation(path) { } function addConversationPreview(path) { - const title = path.split(".")[0]; const listRoot = document.getElementById("side-panel"); readConversationJson(path, json => { @@ -275,7 +273,7 @@ function addConversationPreview(path) { elem.className = "conversation"; const headerElem = document.createElement("h2"); - headerElem.innerHTML = title; + headerElem.innerHTML = json.title; elem.appendChild(headerElem); const previewElem = document.createElement("span");