Spaces:
Sleeping
Sleeping
lemachinarbo commited on
Commit Β·
9ee5a0d
1
Parent(s): 90b3952
fix: correct log template rendering
Browse filesFiles changed (11)
- client/dist/assets/index-Bcu_ucDT.js β client/dist/assets/index-ChxAdgGY.jsRenamed
- client/dist/index.html+1-1
- client/src/templates/emotion.html β client/dist/templates/emotion.htmlRenamed
- client/src/templates/group-entry.html β client/dist/templates/group-entry.htmlRenamed
- client/src/templates/log-entry.html β client/dist/templates/log-entry.htmlRenamed
- client/src/public/templates/emotion.htmlAdded+1
- client/src/public/templates/group-entry.htmlAdded+4
- client/src/public/templates/log-entry.htmlAdded+7
- client/src/services/formatService.js+16-5
- client/src/services/storageService.js+3-5
- vite.config.js+1
3 unmodified lines456789103 unmodified lines<meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Lucas</title><script type="module" crossorigin src="/assets/index-Bcu_ucDT.js"></script></head><body x-data="app"><h1>Lucas</h1>3 unmodified lines456789103 unmodified lines<meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Lucas</title><script type="module" crossorigin src="/assets/index-ChxAdgGY.js"></script></head><body x-data="app"><h1>Lucas</h1>
1<span title="{{score}}">{{emoji}} {{emotion}}</span>1234<details> <summary><strong>{{date}}</strong></summary> {{entries}}</details>1234567<div class="entry" style="border-left: 4px solid --borderColor--; padding-left: 1rem; margin-bottom: 1rem;"> <div>{{time}} - {{transcription}}</div> <div style="padding-left: 2rem"> <em style="color: --borderColor--;">{{sentimentText}}</em> β {{emotions}} <br> </div></div> 123456711 unmodified lines1920212223242526272829303132import { sortEntriesByDate } from "./storageService.js";export const formatGroupedEntries = async (groupedEntries) => {const template = await loadTemplate("./templates/group-entry.html");const formattedSections = await Promise.all(Object.entries(groupedEntries).map(async ([date, entries]) => {11 unmodified linesreturn formattedSections.join("");};const loadTemplate = async (path) => {const res = await fetch(path);return res.text();};const formatEntry = async (entry) => {let template = await loadTemplate("./templates/log-entry.html");const emotionTemplate = await loadTemplate("./templates/emotion.html");const time = new Date(entry.date).toLocaleTimeString([], {hour: "2-digit",123456711 unmodified lines19202122232425262728293031323334353637383940414243import { sortEntriesByDate } from "./storageService.js";export const formatGroupedEntries = async (groupedEntries) => {const template = await loadTemplate("/templates/group-entry.html");const formattedSections = await Promise.all(Object.entries(groupedEntries).map(async ([date, entries]) => {11 unmodified linesreturn formattedSections.join("");};const templateCache = {};const loadTemplate = async (path) => {if (templateCache[path]) {return templateCache[path];}const fetchPromise = fetch(path).then((res) => res.text());templateCache[path] = fetchPromise; // Store the promise to avoid duplicate fetchesconst text = await fetchPromise;templateCache[path] = text; // Replace with resolved textreturn text;};const formatEntry = async (entry) => {let template = await loadTemplate("/templates/log-entry.html");const emotionTemplate = await loadTemplate("/templates/emotion.html");const time = new Date(entry.date).toLocaleTimeString([], {hour: "2-digit",
28 unmodified lines29303132333435363738394041424344454628 unmodified linesexport const loadLocalStorageEntries = async (app) => {const storedData = getStoredData();app.logMessage(storedData);if (!Array.isArray(storedData) || storedData.length === 0) {app.messageLog = "No transcription data found.";return;}const sortedData = sortEntriesByDate(storedData);app.logMessage(sortedData);const groupedByDate = groupEntriesByDate(sortedData);app.logMessage(groupedByDate);app.historyLog = await formatGroupedEntries(groupedByDate);};export const getStoredData = () => {28 unmodified lines2930313233343536373839404142434428 unmodified linesexport const loadLocalStorageEntries = async (app) => {const storedData = getStoredData();if (!Array.isArray(storedData) || storedData.length === 0) {app.messageLog = "No transcription data found.";return;}const sortedData = sortEntriesByDate(storedData);const groupedByDate = groupEntriesByDate(sortedData);const formattedEntries = formatGroupedEntries(groupedByDate);app.historyLog = formattedEntries;};export const getStoredData = () => {
6 unmodified lines7891011126 unmodified linesroot: "client/src",build: {outDir: "../dist",emptyOutDir: true,},server: {6 unmodified lines789101112136 unmodified linesroot: "client/src",build: {outDir: "../dist",publicDir: "public",emptyOutDir: true,},server: {
client/dist/assets/index-Bcu_ucDT.js β client/dist/assets/index-ChxAdgGY.jsRenamed
client/dist/index.html+1-1
client/src/templates/emotion.html β client/dist/templates/emotion.htmlRenamed
client/src/templates/group-entry.html β client/dist/templates/group-entry.htmlRenamed
client/src/templates/log-entry.html β client/dist/templates/log-entry.htmlRenamed
client/src/public/templates/emotion.htmlAdded+1
client/src/public/templates/group-entry.htmlAdded+4
client/src/public/templates/log-entry.htmlAdded+7
client/src/services/formatService.js+16-5
client/src/services/storageService.js+3-5
vite.config.js+1