Skip to content

Commit c013365

Browse files
committed
fix(share): keep the share CTA's post text brand-aware
Navbar's actions slot is not gated by hideBrand, so a whitelabeled public chat or shared file rendered a Share menu whose drafted post advertised Sim. Compose the mention from brand.name when brand.isWhitelabeled, matching the rule the email footer already applies.
1 parent 001cbb4 commit c013365

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

apps/sim/app/(landing)/components/share-link-button/share-link-button.tsx

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { Duplicate } from '@sim/emcn/icons'
1212
import { LinkedInIcon, xIcon as XIcon } from '@/components/icons'
1313
import { buildLinkedInPostUrl, buildXShareUrl } from '@/lib/social-share'
14+
import { useBrandConfig } from '@/ee/whitelabeling'
1415

1516
interface ShareLinkButtonProps {
1617
/** The resource name, shown in the composed post. */
@@ -25,21 +26,29 @@ interface ShareLinkButtonProps {
2526
* menu to copy the page link or post it to X / LinkedIn with a pre-drafted
2627
* message ("Check out my {brand} {kind}! / {name} / {link}").
2728
*
28-
* The brand mention differs by platform: X gets `@simdotai`, which the tweet
29+
* The mention is brand-aware. On a whitelabeled instance every mention is
30+
* `brand.name`, so an outbound post from a customer's public chat or shared file
31+
* never advertises Sim — the same rule the email footer applies via
32+
* `brand.isWhitelabeled`. This surface renders under {@link Navbar}'s `actions`
33+
* slot, which is deliberately NOT gated by `hideBrand` (that hides only the
34+
* wordmark), so the mention has to carry the whitelabel rule itself.
35+
*
36+
* Unbranded, the mention differs by platform: X gets `@simdotai`, which the tweet
2937
* intent renders as a real tag; LinkedIn cannot create `@`-mentions from a share
3038
* URL (its composer treats `text` as literal — a real mention only exists as an
31-
* org URN created live in the composer or via the API), so it uses plain "Sim" to
32-
* avoid a dead "@simdotai". LinkedIn also uses the feed composer, not
33-
* `share-offsite`, which can't pre-fill text. The X and LinkedIn glyphs are
39+
* org URN created live in the composer or via the API), so it uses the plain
40+
* brand name to avoid a dead "@simdotai". LinkedIn also uses the feed composer,
41+
* not `share-offsite`, which can't pre-fill text. The X and LinkedIn glyphs are
3442
* `currentColor`, so they follow the menu item's text color; these surfaces are
3543
* pinned light by the theme provider (`forcedTheme`), so the portalled menu
3644
* resolves light tokens to match.
3745
*/
3846
export function ShareLinkButton({ title, kind }: ShareLinkButtonProps) {
47+
const brand = useBrandConfig()
3948
const { copied, copy } = useCopyToClipboard({ resetMs: 1500 })
4049

41-
const composePost = (brand: string) =>
42-
`Check out my ${brand} ${kind}!\n\n${title}: ${window.location.href}`
50+
const composePost = (mention: string) =>
51+
`Check out my ${mention} ${kind}!\n\n${title}: ${window.location.href}`
4352

4453
const openShare = (url: string) => {
4554
window.open(url, '_blank', 'noopener,noreferrer')
@@ -57,11 +66,15 @@ export function ShareLinkButton({ title, kind }: ShareLinkButtonProps) {
5766
<Duplicate />
5867
{copied ? 'Copied!' : 'Copy link'}
5968
</DropdownMenuItem>
60-
<DropdownMenuItem onSelect={() => openShare(buildXShareUrl(composePost('@simdotai')))}>
69+
<DropdownMenuItem
70+
onSelect={() =>
71+
openShare(buildXShareUrl(composePost(brand.isWhitelabeled ? brand.name : '@simdotai')))
72+
}
73+
>
6174
<XIcon />
6275
Post on X
6376
</DropdownMenuItem>
64-
<DropdownMenuItem onSelect={() => openShare(buildLinkedInPostUrl(composePost('Sim')))}>
77+
<DropdownMenuItem onSelect={() => openShare(buildLinkedInPostUrl(composePost(brand.name)))}>
6578
<LinkedInIcon />
6679
Post on LinkedIn
6780
</DropdownMenuItem>

0 commit comments

Comments
 (0)