From e28f4beaccff969bc3c48f37a238d6d49fd255e4 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Fri, 26 Jan 2024 19:11:39 +0100 Subject: [PATCH 1/8] add complexe view to videos page --- .../src/lib/components/PSVideo.svelte | 22 ++++--- .../src/routes/videos/+page.svelte | 62 ++++++++++++------- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/src/psaggregator/src/lib/components/PSVideo.svelte b/src/psaggregator/src/lib/components/PSVideo.svelte index 9b1f011..d82d827 100644 --- a/src/psaggregator/src/lib/components/PSVideo.svelte +++ b/src/psaggregator/src/lib/components/PSVideo.svelte @@ -3,6 +3,10 @@ import moment from "moment"; export let video: ContentPiece; + export let lineClamp: 2 | 3 | 4 | 5 | 6 = 2; + + let classes = ""; + export { classes as class }; $: humanReadableMinutes = video.duration ? Math.floor(video.duration / 60) : null; $: humanReadableSeconds = video.duration ? video.duration % 60 : null; @@ -18,27 +22,27 @@ background: linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0, transparent 40%); transition: background 0.2s; } + + .line-clamp { + display: -webkit-box; + -webkit-box-orient: vertical; + overflow: hidden; + } - +
{video.title}
{#if humanReadableMinutes !== null && humanReadableSeconds !== null} {("00" + humanReadableMinutes).slice(-2)}:{("00" + humanReadableSeconds).slice( - -2 - )} + >{("00" + humanReadableMinutes).slice(-2)}:{("00" + humanReadableSeconds).slice(-2)} {/if}
-
+
{video.title}
diff --git a/src/psaggregator/src/routes/videos/+page.svelte b/src/psaggregator/src/routes/videos/+page.svelte index 8d95855..8be3865 100644 --- a/src/psaggregator/src/routes/videos/+page.svelte +++ b/src/psaggregator/src/routes/videos/+page.svelte @@ -3,12 +3,15 @@ import type { PageData } from "./$types"; import moment from "moment"; import { browser } from "$app/environment"; - import { ProgressRadial } from "@skeletonlabs/skeleton"; + import { ProgressRadial, SlideToggle } from "@skeletonlabs/skeleton"; + import PsVideo from "$lib/components/PSVideo.svelte"; + import MediaQuery from "$lib/utils/MediaQuery.svelte"; export let data: PageData; const batchSize = 50; + let showAdvancedView = false; let previousMonth: string | null = null; let skip = 0; let loading = false; @@ -72,26 +75,41 @@ }); -
- {#each data.videos as video} - {#if video.startDate} - {@const newMonth = checkMonth(video.startDate)} - {#if newMonth} -
+
+ From 8c11cd939c2ebe8eabb4054e28a4416f561002fc Mon Sep 17 00:00:00 2001 From: zaanposni Date: Fri, 26 Jan 2024 19:25:44 +0100 Subject: [PATCH 2/8] add play button to uploadplanentry, remove link --- .../src/lib/components/TwitchEntry.svelte | 62 +++++++++++++++++++ .../src/lib/components/UploadPlanEntry.svelte | 62 +++++++------------ src/psaggregator/src/routes/+page.svelte | 3 +- 3 files changed, 87 insertions(+), 40 deletions(-) create mode 100644 src/psaggregator/src/lib/components/TwitchEntry.svelte diff --git a/src/psaggregator/src/lib/components/TwitchEntry.svelte b/src/psaggregator/src/lib/components/TwitchEntry.svelte new file mode 100644 index 0000000..93e7e5d --- /dev/null +++ b/src/psaggregator/src/lib/components/TwitchEntry.svelte @@ -0,0 +1,62 @@ + + +{#if entry.href} + +
+ {#if entry.type === "TwitchStream"} +
+ {#if entry.startDate} + {@const date = moment(entry.startDate)} +
+ {#if !moment().isSame(date, "day")} + {date.format("DD. MMM,")} + {/if} + {date.format("HH:mm")} +
+ {/if} + {entry.title} + {#if entry.importedFrom === "OpenAI"} +
+
+ +
+ {/if} +
+{:else} +
+
+ {#if entry.type === "TwitchStream"} +
+ {#if entry.startDate} + {@const date = moment(entry.startDate)} +
+ {#if !moment().isSame(date, "day")} + {date.format("DD. MMM,")} + {/if} + {date.format("HH:mm")} +
+ {/if} + {entry.title} + {#if entry.importedFrom === "OpenAI"} +
+
+ +
+ {/if} +
+{/if} diff --git a/src/psaggregator/src/lib/components/UploadPlanEntry.svelte b/src/psaggregator/src/lib/components/UploadPlanEntry.svelte index 93e7e5d..11959dc 100644 --- a/src/psaggregator/src/lib/components/UploadPlanEntry.svelte +++ b/src/psaggregator/src/lib/components/UploadPlanEntry.svelte @@ -1,15 +1,15 @@ -{#if entry.href} - -
+
+
+
{#if entry.type === "TwitchStream"}
{#if entry.startDate} {@const date = moment(entry.startDate)} -
+
{#if !moment().isSame(date, "day")} {date.format("DD. MMM,")} {/if} {date.format("HH:mm")}
{/if} - {entry.title} - {#if entry.importedFrom === "OpenAI"} -
-
- -
- {/if} -
-{:else} -
-
- {#if entry.type === "TwitchStream"} -
- {#if entry.startDate} - {@const date = moment(entry.startDate)} -
- {#if !moment().isSame(date, "day")} - {date.format("DD. MMM,")} - {/if} - {date.format("HH:mm")} -
- {/if} - {entry.title} - {#if entry.importedFrom === "OpenAI"} -
-
- -
- {/if}
-{/if} + {entry.title} + {#if entry.href || entry.importedFrom === "OpenAI"} +
+ {/if} + {#if entry.href} + + + + + Ansehen + + {/if} + {#if entry.importedFrom === "OpenAI"} +
+ +
+ {/if} +
diff --git a/src/psaggregator/src/routes/+page.svelte b/src/psaggregator/src/routes/+page.svelte index 90d865e..d967f93 100644 --- a/src/psaggregator/src/routes/+page.svelte +++ b/src/psaggregator/src/routes/+page.svelte @@ -8,6 +8,7 @@ import YouTubeCommunityPost from "$lib/components/YouTubeCommunityPost.svelte"; import MediaQuery from "$lib/utils/MediaQuery.svelte"; import InstagramPost from "$lib/components/InstagramPost.svelte"; + import TwitchEntry from "$lib/components/TwitchEntry.svelte"; export let data: PageServerData; @@ -101,7 +102,7 @@
{#each data.upcomingStreams as stream} - + {:else}
Momentan sind keine geplanten Streams bekannt. From 7c8ade08db657d60e754664df3846d3d7268ef0d Mon Sep 17 00:00:00 2001 From: zaanposni Date: Fri, 26 Jan 2024 19:29:41 +0100 Subject: [PATCH 3/8] seperate external and internal urls in header --- .../src/lib/components/BigHeader.svelte | 54 +++++++++++-------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/src/psaggregator/src/lib/components/BigHeader.svelte b/src/psaggregator/src/lib/components/BigHeader.svelte index 08db89a..9b8762d 100644 --- a/src/psaggregator/src/lib/components/BigHeader.svelte +++ b/src/psaggregator/src/lib/components/BigHeader.svelte @@ -6,33 +6,41 @@ -
+
PS Aggregator Logo - {#if matches} - Home - Videos - News - API - Motivation - - GitHub - - {/if} - {#if KOFI_USERNAME} - - Ko-fi - - {/if} - - PietSmiet.de - - {#if !matches && LEGAL_URL} - - Legal +
+
+ +
+ {#if matches} + + GitHub + + {/if} + {#if KOFI_USERNAME} + + Ko-fi + + {/if} + + PietSmiet.de - {/if} + {#if !matches && LEGAL_URL} + + Legal + + {/if} +
From ed2db023169edd6e838b672409770abee8930796 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Fri, 26 Jan 2024 19:54:18 +0100 Subject: [PATCH 4/8] absolute date values and settings page --- src/psaggregator/src/config/config.ts | 3 +++ .../src/lib/components/BigHeader.svelte | 1 + .../src/lib/components/Footer.svelte | 8 +++++- .../src/lib/components/InstagramPost.svelte | 5 ++-- .../src/lib/components/PSVideo.svelte | 11 +++++--- .../components/YouTubeCommunityPost.svelte | 5 ++-- src/psaggregator/src/lib/utils/dateFormat.ts | 13 ++++++++++ src/psaggregator/src/routes/+layout.svelte | 9 ++++++- .../src/routes/settings/+page.svelte | 25 +++++++++++++++++++ 9 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 src/psaggregator/src/lib/utils/dateFormat.ts create mode 100644 src/psaggregator/src/routes/settings/+page.svelte diff --git a/src/psaggregator/src/config/config.ts b/src/psaggregator/src/config/config.ts index 24a4b5e..020dc03 100644 --- a/src/psaggregator/src/config/config.ts +++ b/src/psaggregator/src/config/config.ts @@ -1,4 +1,5 @@ import { env } from "$env/dynamic/public"; +import { writable } from "svelte/store"; export const MAIL_TO_URL = "mailto:psaggregator@zaanposni.com"; export const LEGAL_URL = env.PUBLIC_LEGAL_URL; @@ -7,3 +8,5 @@ export const KOFI_USERNAME = env.PUBLIC_KOFI_USERNAME; export const GITHUB_URL = "https://github.com/zaanposni/psaggregator"; export const GITHUB_AUTHOR_URL = "https://github.com/zaanposni"; + +export const SHOW_ABSOLUTE_DATES = writable(false); diff --git a/src/psaggregator/src/lib/components/BigHeader.svelte b/src/psaggregator/src/lib/components/BigHeader.svelte index 9b8762d..949819d 100644 --- a/src/psaggregator/src/lib/components/BigHeader.svelte +++ b/src/psaggregator/src/lib/components/BigHeader.svelte @@ -19,6 +19,7 @@ News API Motivation + Einstellungen {/if}
diff --git a/src/psaggregator/src/lib/components/Footer.svelte b/src/psaggregator/src/lib/components/Footer.svelte index ffb5124..613c3f0 100644 --- a/src/psaggregator/src/lib/components/Footer.svelte +++ b/src/psaggregator/src/lib/components/Footer.svelte @@ -4,7 +4,7 @@ import { version } from "$app/environment"; import { TabAnchor, TabGroup } from "@skeletonlabs/skeleton"; import { page } from "$app/stores"; - import { Api, FavoriteFilled, Home, Document, Thumbnail_2 } from "carbon-icons-svelte"; + import { Api, FavoriteFilled, Home, Document, Thumbnail_2, Settings } from "carbon-icons-svelte"; - + {#if matches} -
- +
+ PS Aggregator by @@ -31,21 +31,19 @@ GitHub {#if LEGAL_URL} - + Legal {/if} v{version} - - Dies ist ein privates Projekt und steht in keiner Verbindung zur PietSmiet UG & Co. KG. - + Dies ist ein privates Projekt und steht in keiner Verbindung zur PietSmiet UG & Co. KG.
{:else} @@ -55,6 +53,12 @@
Home + +
+ +
+ Uploadplan +
diff --git a/src/psaggregator/src/routes/plan/+page.server.ts b/src/psaggregator/src/routes/plan/+page.server.ts new file mode 100644 index 0000000..2e0e59a --- /dev/null +++ b/src/psaggregator/src/routes/plan/+page.server.ts @@ -0,0 +1,30 @@ +import prisma from "$lib/prisma"; +import type { ScheduledContentPiece } from "@prisma/client"; +import moment from "moment"; + +export async function load() { + const upperBound = moment().endOf("day").toDate(); + const lowerBound = moment().startOf("day").toDate(); + + const today = await prisma.scheduledContentPiece.findMany({ + where: { + type: { + equals: "PSVideo" + }, + importedFrom: { + equals: "PietSmietDE" + }, + startDate: { + lt: upperBound, + gt: lowerBound + } + }, + orderBy: { + startDate: "asc" + } + }) as ScheduledContentPiece[]; + + return { + today + }; +} diff --git a/src/psaggregator/src/routes/plan/+page.svelte b/src/psaggregator/src/routes/plan/+page.svelte new file mode 100644 index 0000000..3afbf47 --- /dev/null +++ b/src/psaggregator/src/routes/plan/+page.svelte @@ -0,0 +1,145 @@ + + + + + +
+
+ {#if matches} +
+ +

Uploadplan - {currentDate.format("DD MMMM YYYY")}

+ { + const selectedDate = moment(e.target.value); + if (selectedDate.isAfter(moment(), "day")) { + return; + } + currentDate = selectedDate; + await loadData(currentDate.format("YYYY-MM-DD")); + }} /> + +
+ {:else} +

Uploadplan

+
+ + { + const selectedDate = moment(e.target.value); + if (selectedDate.isAfter(moment(), "day")) { + return; + } + currentDate = selectedDate; + await loadData(currentDate.format("YYYY-MM-DD")); + }} /> + +
+ {/if} +
+
+ Auf dieser Seite kannst du alte Uploadpläne ansehen. + Mit dem Design bin ich hier noch nicht ganz zufrieden. + Gib mir gerne Feedback via Mail, Reddit, GitHub. +
+ {#if today != undefined} +
+ {#each today as content} + + {:else} +
+ Für dieses Datum wurde kein Uploadplan importiert. +
+ {/each} +
+ {:else} +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/if} +
+
From e10f30078f20ffc2e0278bf434ecb4f53b39eca7 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sat, 27 Jan 2024 09:56:33 +0100 Subject: [PATCH 6/8] added changelog --- .../src/lib/components/BigHeader.svelte | 16 +++++- .../src/lib/components/Changelog.svelte | 52 +++++++++++++++++++ src/psaggregator/src/routes/+layout.svelte | 12 +++-- src/psaggregator/src/routes/+page.svelte | 20 +++++++ 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 src/psaggregator/src/lib/components/Changelog.svelte diff --git a/src/psaggregator/src/lib/components/BigHeader.svelte b/src/psaggregator/src/lib/components/BigHeader.svelte index 1bdee94..1b872be 100644 --- a/src/psaggregator/src/lib/components/BigHeader.svelte +++ b/src/psaggregator/src/lib/components/BigHeader.svelte @@ -1,7 +1,18 @@ @@ -21,6 +32,9 @@ API Motivation Einstellungen +
+ +
{/if}
diff --git a/src/psaggregator/src/lib/components/Changelog.svelte b/src/psaggregator/src/lib/components/Changelog.svelte new file mode 100644 index 0000000..4ac737b --- /dev/null +++ b/src/psaggregator/src/lib/components/Changelog.svelte @@ -0,0 +1,52 @@ + + + + + diff --git a/src/psaggregator/src/routes/+layout.svelte b/src/psaggregator/src/routes/+layout.svelte index 102a94f..5fab5c4 100644 --- a/src/psaggregator/src/routes/+layout.svelte +++ b/src/psaggregator/src/routes/+layout.svelte @@ -1,6 +1,6 @@ -