Files
outline/app/hooks/useShareBranding.ts
Copilot 7ed41eadc6 Add per-share branding: title and logoUrl overrides (#12003)
* feat: add title and logoUrl to Share model

Agent-Logs-Url: https://github.com/outline/outline/sessions/9bc9d438-6892-4903-9d32-6b6868f4fd97

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* fix: use STRING(4096) for logoUrl column in migration

Agent-Logs-Url: https://github.com/outline/outline/sessions/9bc9d438-6892-4903-9d32-6b6868f4fd97

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* feat: use share title and logoUrl to override team branding on shared page

Agent-Logs-Url: https://github.com/outline/outline/sessions/854d6d22-e80b-4673-b3b2-0f9cf43a3246

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* refactor: use ShareValidation class constants for title/logoUrl max lengths

Agent-Logs-Url: https://github.com/outline/outline/sessions/ea462d6a-d4d3-4882-ab8e-88060bf64877

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* fix: use ShareValidation constants in @Length msg template literals

Agent-Logs-Url: https://github.com/outline/outline/sessions/694116c2-47e8-4001-a103-c8a62c7ac71e

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* feat: add display settings popover with custom title and icon for shares

Move share toggles (search indexing, email subscriptions, show last
modified, show TOC) into a popover triggered by a settings cog. The
popover also includes inputs for a custom site title and icon upload
to override team branding on shared pages. Rename logoUrl to iconUrl,
loosen URL validation to allow relative attachment paths, and surface
the popover in the shared page header for users with edit permission.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* styling

* Display branding on single shared pages

* Review comments

* refactor

* PR feedback

* Lose 'Remove icon' button

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-26 21:23:13 -04:00

34 lines
1.1 KiB
TypeScript

import type { PublicTeam } from "@shared/types";
import { useTeamContext } from "~/components/TeamContext";
import type Share from "~/models/Share";
import type Team from "~/models/Team";
type ShareBranding = {
displayName: string | null;
displayLogoUrl: string | null;
displayLogoModel: Team | PublicTeam | undefined;
brandingAvailable: boolean;
};
/**
* Returns the resolved branding (name + logo) to display for a share, falling
* back to the team's name and avatar when the share has no custom values.
*
* @param share the share to derive branding for.
* @returns the resolved name, logo URL, fallback model, and whether any
* branding is available to display.
*/
export default function useShareBranding(share: Share): ShareBranding {
const team = useTeamContext();
const displayName = share.title ?? team?.name ?? null;
const displayLogoUrl = share.iconUrl ?? team?.avatarUrl ?? null;
const displayLogoModel = displayLogoUrl ? undefined : team;
return {
displayName,
displayLogoUrl,
displayLogoModel,
brandingAvailable: !!(displayName || displayLogoUrl),
};
}