diff --git a/src/components/ChatSummary.svelte b/src/components/ChatSummary.svelte index 35f46ad..5453cc7 100644 --- a/src/components/ChatSummary.svelte +++ b/src/components/ChatSummary.svelte @@ -5,6 +5,7 @@ import Icon from 'smelte/src/components/Icon'; import { Theme } from '../ts/chat-constants'; import { createEventDispatcher } from 'svelte'; + import { showTimestamps } from '../ts/storage'; export let summary: Ytc.ParsedSummary; @@ -55,6 +56,11 @@ {run.text} {/if} {/each} + {#if summary.timestamp && $showTimestamps} + + {summary.timestamp} + + {/if}
diff --git a/src/components/RedirectBanner.svelte b/src/components/RedirectBanner.svelte index d087727..6a2faaa 100644 --- a/src/components/RedirectBanner.svelte +++ b/src/components/RedirectBanner.svelte @@ -2,11 +2,11 @@ import { slide, fade } from 'svelte/transition'; import MessageRun from './MessageRuns.svelte'; import Tooltip from './common/Tooltip.svelte'; + import Button from 'smelte/src/components/Button'; import Icon from 'smelte/src/components/Icon'; import { Theme } from '../ts/chat-constants'; import { createEventDispatcher } from 'svelte'; - import { showProfileIcons } from '../ts/storage'; - import Button from 'smelte/src/components/Button'; + import { showProfileIcons, showTimestamps } from '../ts/storage'; export let redirect: Ytc.ParsedRedirect; @@ -53,6 +53,11 @@ Live Redirect Notice + {#if redirect.timestamp && $showTimestamps} + + {redirect.timestamp} + + {/if}
diff --git a/src/ts/chat-parser.ts b/src/ts/chat-parser.ts index 6ce4055..4eed832 100644 --- a/src/ts/chat-parser.ts +++ b/src/ts/chat-parser.ts @@ -103,6 +103,7 @@ const parseChatSummary = (renderer: Ytc.AddChatItem, actionId: string, showtime: message: splitRuns[2], }, showtime: showtime, + timestamp: formatTimestamp(Date.now() * 1000), }; return item; } @@ -132,6 +133,7 @@ const parseRedirectBanner = (renderer: Ytc.AddChatItem, actionId: string, showti } }, showtime: showtime, + timestamp: formatTimestamp(Date.now() * 1000), }; return item; } diff --git a/src/ts/typings/ytc.d.ts b/src/ts/typings/ytc.d.ts index 1efecea..42804a9 100644 --- a/src/ts/typings/ytc.d.ts +++ b/src/ts/typings/ytc.d.ts @@ -489,6 +489,7 @@ declare namespace Ytc { message: ParsedRun[]; }; showtime: number; + timestamp?: string; } interface ParsedRedirect { @@ -503,6 +504,7 @@ declare namespace Ytc { } }; showtime: number; + timestamp?: string; } interface ParsedPoll {