diff --git a/ka-note/client/src/lib/components/DashboardView.svelte b/ka-note/client/src/lib/components/DashboardView.svelte index d0e1f30..a861af7 100644 --- a/ka-note/client/src/lib/components/DashboardView.svelte +++ b/ka-note/client/src/lib/components/DashboardView.svelte @@ -8,6 +8,7 @@ import { extractAssignments, extractProjects, extractMentions, extractCompanies } from '$lib/utils/extractors'; import { mention } from '$lib/actions/mention'; import RenderedMarkdown from './RenderedMarkdown.svelte'; + import LinkTitle from './LinkTitle.svelte'; import MarkdownEditor from './MarkdownEditor.svelte'; import EditableMarkdown from './EditableMarkdown.svelte'; import ConfirmDialog from './ConfirmDialog.svelte'; @@ -276,7 +277,7 @@ {#each topics as lt (lt.topic.id)}
{lt.isDone ? '✓' : '○'} - {lt.topic.title} + {lt.contextName}
{/each} @@ -450,7 +451,7 @@ >{isDone ? '✓' : ''} {entry.date} {formatTime(entry.updatedAt)}
-
{title}
+
{#if body} {/if} diff --git a/ka-note/client/src/lib/components/JournalView.svelte b/ka-note/client/src/lib/components/JournalView.svelte index e561583..245a7ee 100644 --- a/ka-note/client/src/lib/components/JournalView.svelte +++ b/ka-note/client/src/lib/components/JournalView.svelte @@ -9,6 +9,7 @@ import DateNavigator from './DateNavigator.svelte'; import ConfirmDialog from './ConfirmDialog.svelte'; import WiedervorlageSection from './WiedervorlageSection.svelte'; + import LinkTitle from './LinkTitle.svelte'; interface Props { contextId: string; @@ -69,17 +70,6 @@ } } - function truncateUrlDisplay(text: string): string { - if (!/^https?:\/\//i.test(text)) return text; - try { - const u = new URL(text); - const path = u.pathname !== '/' ? u.pathname : ''; - const display = u.hostname + path; - return display.length > 60 ? display.slice(0, 57) + '…' : display; - } catch { - return text.length > 60 ? text.slice(0, 57) + '…' : text; - } - } async function handleAddEntry() { let title = entryTitle.trim(); @@ -281,11 +271,7 @@ {formatTime(entry.updatedAt)}
- {#if /^https?:\/\//i.test(title)} - {truncateUrlDisplay(title)} - {:else} - {title} - {/if} + {#if entry.linkedContextId} {contextNameMap().get(entry.linkedContextId) ?? entry.linkedContextId} diff --git a/ka-note/client/src/lib/components/LinkTitle.svelte b/ka-note/client/src/lib/components/LinkTitle.svelte new file mode 100644 index 0000000..42b4826 --- /dev/null +++ b/ka-note/client/src/lib/components/LinkTitle.svelte @@ -0,0 +1,21 @@ + + +{#if isUrl(text)} + e.stopPropagation()} + >{truncateUrlDisplay(text)} +{:else} + {text} +{/if} diff --git a/ka-note/client/src/lib/components/RatingsView.svelte b/ka-note/client/src/lib/components/RatingsView.svelte index 32b4390..5a87896 100644 --- a/ka-note/client/src/lib/components/RatingsView.svelte +++ b/ka-note/client/src/lib/components/RatingsView.svelte @@ -3,6 +3,7 @@ import { db } from '$lib/db/schema'; import { softDeleteRating } from '$lib/db/repositories'; import { RATING_CONFIG, type RatingValue } from '$lib/utils/ratingConfig'; + import LinkTitle from './LinkTitle.svelte'; import { goto } from '$app/navigation'; import type { Rating } from '@ka-note/shared'; import ConfirmDialog from './ConfirmDialog.svelte'; @@ -143,7 +144,7 @@ | {item.contextName} | - {item.topicTitle} +
{cfg.label}
{#if item.rating.comment} diff --git a/ka-note/client/src/lib/components/SnoozedView.svelte b/ka-note/client/src/lib/components/SnoozedView.svelte index 9bd4154..5d6e584 100644 --- a/ka-note/client/src/lib/components/SnoozedView.svelte +++ b/ka-note/client/src/lib/components/SnoozedView.svelte @@ -2,6 +2,7 @@ import { liveQuery } from 'dexie'; import { db } from '$lib/db/schema'; import { updateTopic } from '$lib/db/repositories'; + import LinkTitle from './LinkTitle.svelte'; import type { Topic, AgendaContext } from '@ka-note/shared'; interface Props { @@ -49,7 +50,7 @@
- {topic.title} + {#if isDailyLog && topic.contextId !== 'daily-log'} {contextMap.get(topic.contextId) ?? topic.contextId} {/if} diff --git a/ka-note/client/src/lib/components/TopicCard.svelte b/ka-note/client/src/lib/components/TopicCard.svelte index 7ecebcd..ae65de0 100644 --- a/ka-note/client/src/lib/components/TopicCard.svelte +++ b/ka-note/client/src/lib/components/TopicCard.svelte @@ -6,6 +6,7 @@ import { today } from '$lib/db/helpers'; import { processedTopicIds, collapsedTopicIds } from '$lib/stores/agenda'; import HistoryItem from './HistoryItem.svelte'; + import LinkTitle from './LinkTitle.svelte'; import MeetingControls from './MeetingControls.svelte'; import MarkdownEditor from './MarkdownEditor.svelte'; import ConfirmDialog from './ConfirmDialog.svelte'; @@ -149,7 +150,7 @@ autofocus /> {:else} - {topic.title} +
-
- {#if /^https?:\/\//i.test(title)} - {truncateUrlDisplay(title)} - {:else} - {title} - {/if} -
+
{#if body} {/if} diff --git a/ka-note/client/src/lib/utils/urlUtils.ts b/ka-note/client/src/lib/utils/urlUtils.ts new file mode 100644 index 0000000..9a07bc5 --- /dev/null +++ b/ka-note/client/src/lib/utils/urlUtils.ts @@ -0,0 +1,15 @@ +export function isUrl(text: string): boolean { + return /^https?:\/\//i.test(text); +} + +export function truncateUrlDisplay(text: string, maxLen = 60): string { + if (!isUrl(text)) return text; + try { + const u = new URL(text); + const path = u.pathname !== '/' ? u.pathname : ''; + const display = u.hostname + path; + return display.length > maxLen ? display.slice(0, maxLen - 3) + '…' : display; + } catch { + return text.length > maxLen ? text.slice(0, maxLen - 3) + '…' : text; + } +}