Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(share): apply branding on public video share page

Richie McIlroy5e190b86990a
diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsx
index f6b288fcf..15bc34880 100644
--- a/apps/web/app/s/[videoId]/page.tsx
+++ b/apps/web/app/s/[videoId]/page.tsx
@@ -51,6 +51,7 @@ import {
import { resolveDefaultPlaybackSpeed } from "@/lib/playback-speed";
import * as EffectRuntime from "@/lib/server";
import { runPromise } from "@/lib/server";
+import { getSharePageBranding } from "@/lib/share-branding";
import {
isSocialCrawlerUserAgent,
SOCIAL_REFERRER_DOMAINS,
@@ -66,7 +67,6 @@ import { PasswordOverlay } from "./_components/PasswordOverlay";
import { PendingRecordingShare } from "./_components/PendingRecordingShare";
import { ShareHeader } from "./_components/ShareHeader";
import { Share } from "./Share";
-import type { SharePageBranding } from "./types";
const VIEW_NOTIFICATION_DELAY_MS = 2 * 60 * 1000;
const VIDEO_ID_PATTERN = /^[0-9abcdefghjkmnpqrstvwxyz]+$/;
@@ -192,36 +192,6 @@ const renderNoSuchElement = (awaitRecording: boolean) =>
? Effect.succeed(<PendingRecordingShare />)
: Effect.sync(() => notFound());
-function getSharePageBranding(data: {
- owner: { isPro: boolean };
- orgSettings?: OrganizationSettings | null;
- organizationName?: string | null;
- organizationIconUrl?: ImageUpload.ImageUrl | null;
- shareableLinkIconUrl?: ImageUpload.ImageUrl | null;
-}): SharePageBranding | null {
- if (!data.owner.isPro) {
- return { type: "cap" };
- }
-
- const brandedIcon = data.orgSettings?.shareableLinkUseOrganizationIcon
- ? data.organizationIconUrl
- : data.shareableLinkIconUrl;
-
- if (brandedIcon) {
- return {
- type: "custom",
- imageUrl: brandedIcon,
- name: data.organizationName ?? "Organization",
- };
- }
-
- if (data.orgSettings?.hideShareableLinkCapLogo) {
- return null;
- }
-
- return { type: "cap" };
-}
-
const getShareVideoPageCatchers = (
videoId: Video.VideoId,
awaitRecording: boolean,
diff --git a/apps/web/app/s/[videoId]/types.ts b/apps/web/app/s/[videoId]/types.ts
index 487f76d5b..1152dd054 100644
--- a/apps/web/app/s/[videoId]/types.ts
+++ b/apps/web/app/s/[videoId]/types.ts
@@ -27,12 +27,4 @@ export type VideoOwner = {
image?: ImageUpload.ImageUrl | null;
};
-export type SharePageBranding =
- | {
- type: "custom";
- imageUrl: ImageUpload.ImageUrl;
- name: string;
- }
- | {
- type: "cap";
- };
+export type { SharePageBranding } from "@/lib/share-branding";