feat: conversation titles

This commit is contained in:
Cat Flynn 2024-10-06 16:31:26 +01:00
parent cf368b792d
commit 948ee9dff1
5 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{ {
"title": "Julius Caesar",
"characters": [ "characters": [
"Mark Antony", "Mark Antony",
"Julius Caesar" "Julius Caesar"

View File

@ -1,4 +1,5 @@
{ {
"title": "Operation Ides of March",
"characters": [ "characters": [
"Mark Antony", "Mark Antony",
"Cassius", "Cassius",

View File

@ -1,4 +1,5 @@
{ {
"title": "Lepidus",
"characters": [ "characters": [
"Mark Antony", "Mark Antony",
"Lepidus" "Lepidus"

View File

@ -1,4 +1,5 @@
{ {
"title": "Lucius Antony",
"characters": [ "characters": [
"Mark Antony", "Mark Antony",
"Lucius Antony" "Lucius Antony"

View File

@ -234,10 +234,9 @@ function showConversation(path) {
setVisibleOnMobile(mainPanel, true); setVisibleOnMobile(mainPanel, true);
setVisibleOnMobile(conversationListElem, false); setVisibleOnMobile(conversationListElem, false);
const title = path.split(".")[0];
readConversationJson(path, json => { readConversationJson(path, json => {
conversation = new Conversation(title); conversation = new Conversation(json.title);
const jsonMessages = json.messages; const jsonMessages = json.messages;
const participants = json.characters; const participants = json.characters;
@ -264,7 +263,6 @@ function showConversation(path) {
} }
function addConversationPreview(path) { function addConversationPreview(path) {
const title = path.split(".")[0];
const listRoot = document.getElementById("side-panel"); const listRoot = document.getElementById("side-panel");
readConversationJson(path, json => { readConversationJson(path, json => {
@ -275,7 +273,7 @@ function addConversationPreview(path) {
elem.className = "conversation"; elem.className = "conversation";
const headerElem = document.createElement("h2"); const headerElem = document.createElement("h2");
headerElem.innerHTML = title; headerElem.innerHTML = json.title;
elem.appendChild(headerElem); elem.appendChild(headerElem);
const previewElem = document.createElement("span"); const previewElem = document.createElement("span");