Logo is a proper link
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { resolve } from '$app/paths';
|
||||
import { cleanNumber } from '$lib/numbers';
|
||||
import { cleanNumber, numberWithCommas } from '$lib/numbers';
|
||||
import { _ } from '$lib/i18n';
|
||||
import type { VideoPlay } from '$lib/api/model';
|
||||
import { onMount } from 'svelte';
|
||||
import { expandSummery } from '$lib/misc';
|
||||
import { interfaceAutoExpandDesc } from '$lib/store';
|
||||
import { humanizeTimestamp } from '$lib/time';
|
||||
|
||||
let { video, description }: { video: VideoPlay; description: string } = $props();
|
||||
|
||||
@@ -20,8 +21,18 @@
|
||||
<summary id="description" class="bold none">
|
||||
<nav>
|
||||
<div class="max">
|
||||
{cleanNumber(video.viewCount)}
|
||||
{$_('views')} • {video.publishedText}
|
||||
<span>
|
||||
{cleanNumber(video.viewCount)}
|
||||
{$_('views')}
|
||||
<div class="tooltip no-space">{numberWithCommas(video.viewCount)} {$_('views')}</div>
|
||||
</span>
|
||||
•
|
||||
<span>
|
||||
{video.publishedText}
|
||||
{#if !video.fallbackPatch}
|
||||
<div class="tooltip no-space">{humanizeTimestamp(video.published)}</div>
|
||||
{/if}
|
||||
</span>
|
||||
</div>
|
||||
</nav>
|
||||
</summary>
|
||||
|
||||
@@ -9,9 +9,13 @@ dayjs.extend(duration);
|
||||
dayjs.extend(relativeTime);
|
||||
dayjs.extend(advancedFormat);
|
||||
|
||||
export function humanFriendlyTimestamp(utcTimestamp: number): string {
|
||||
export function humanizeTimestamp(epochTime: number): string {
|
||||
return dayjs.utc(epochTime).local().format('hh:mm A DD/MM/YYYY');
|
||||
}
|
||||
|
||||
export function relativeTimestamp(epochTime: number): string {
|
||||
const now = dayjs();
|
||||
const timestamp = dayjs.utc(utcTimestamp).local();
|
||||
const timestamp = dayjs.utc(epochTime).local();
|
||||
|
||||
const isSameDay = now.isSame(timestamp, 'day');
|
||||
const isSameMonth = now.isSame(timestamp, 'month');
|
||||
|
||||
@@ -245,14 +245,10 @@
|
||||
|
||||
<div>
|
||||
<nav class="left m l surface-container" class:tv-nav={$isAndroidTvStore}>
|
||||
<header
|
||||
role="presentation"
|
||||
onclick={() => goto(resolve($interfaceDefaultPage, {}))}
|
||||
style="cursor: pointer;"
|
||||
tabindex="-1"
|
||||
class="small-padding"
|
||||
>
|
||||
<Logo />
|
||||
<header role="presentation" style="cursor: pointer;" tabindex="-1" class="small-padding">
|
||||
<a href={resolve($interfaceDefaultPage, {})}>
|
||||
<Logo />
|
||||
</a>
|
||||
</header>
|
||||
{#if $isAndroidTvStore}
|
||||
<a href={resolve('/search', {})} class:active={$page.url.href.endsWith('/search')}>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
import LikesDislikes from '$lib/components/watch/LikesDislikes.svelte';
|
||||
import Comment from '$lib/components/watch/Comment.svelte';
|
||||
import { expandSummery } from '$lib/misc';
|
||||
import { humanFriendlyTimestamp } from '$lib/time.js';
|
||||
import { relativeTimestamp } from '$lib/time.js';
|
||||
import { getWatchDetails } from '$lib/watch.js';
|
||||
import { page } from '$app/state';
|
||||
|
||||
@@ -252,12 +252,12 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (data.video.premiereTimestamp) {
|
||||
premiereTime = humanFriendlyTimestamp(data.video.premiereTimestamp);
|
||||
premiereTime = relativeTimestamp(data.video.premiereTimestamp);
|
||||
premiereUpdateInterval = setInterval(async () => {
|
||||
data = await getWatchDetails(data.video.videoId, page.url);
|
||||
|
||||
if (data.video.premiereTimestamp) {
|
||||
premiereTime = humanFriendlyTimestamp(data.video.premiereTimestamp);
|
||||
premiereTime = relativeTimestamp(data.video.premiereTimestamp);
|
||||
} else {
|
||||
clearInterval(premiereUpdateInterval);
|
||||
playerState.set({ ...$playerState, data: { ...data } });
|
||||
|
||||
Reference in New Issue
Block a user