Skip to content

Commit

Permalink
Move second summary line to subheader
Browse files Browse the repository at this point in the history
  • Loading branch information
FlaminSarge committed Nov 2, 2024
1 parent fc7dc6e commit 008ee63
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/components/ChatSummary.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
</div>
</div>
{#if !shorten && !dismissed}
<div class="mt-1 whitespace-pre-line" transition:slide|local={{ duration: 300 }}>
<MessageRun runs={summary.subheader} deleted forceDark forceTLColor={Theme.DARK}/>
</div>
<div class="mt-1 whitespace-pre-line" transition:slide|local={{ duration: 300 }}>
<MessageRun runs={summary.summary} forceDark forceTLColor={Theme.DARK}/>
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/ts/chat-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,10 @@ const parseMessageRuns = (runs?: Ytc.MessageRun[]): Ytc.ParsedRun[] => {
const parseChatSummary = (renderer: Ytc.AddChatItem, isEphemeral: boolean | undefined, bannerTimeoutMs: number | undefined): Ytc.ParsedSummary | undefined => {
const baseRenderer = renderer.liveChatBannerChatSummaryRenderer!;
const runs = parseMessageRuns(renderer.liveChatBannerChatSummaryRenderer?.chatSummary.runs);
if (runs[2].type === 'text') {
runs[2].text = '(' + runs[2].text + ')';
}
const item: Ytc.ParsedSummary = {
type: 'summary',
header: runs.slice(0, 3),
header: [runs[0]],
subheader: [runs[2]],
summary: runs.slice(4),
icon: baseRenderer.icon && {
iconType: baseRenderer.icon?.iconType.toLowerCase(),
Expand Down
1 change: 1 addition & 0 deletions src/ts/typings/ytc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ declare namespace Ytc {
interface ParsedSummary {
type: 'summary';
header: ParsedRun[];
subheader: ParsedRun[];
summary: ParsedRun[];
id: string;
icon?: {
Expand Down

0 comments on commit 008ee63

Please sign in to comment.