MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / ShareButtonInner

Function ShareButtonInner

src/components/ui/ShareButton.tsx:80–101  ·  view source on GitHub ↗

* Inner component that uses R3F hooks (must be inside Canvas context)

({ shareSource, copied, setCopied, className }: ShareButtonInnerProps)

Source from the content-addressed store, hash-verified

78 * Inner component that uses R3F hooks (must be inside Canvas context)
79 */
80function ShareButtonInner({ shareSource, copied, setCopied, className }: ShareButtonInnerProps) {
81 const { controls } = useThree();
82 const display = getShareButtonDisplayState('share', copied);
83
84 const handleShare = useCallback(async () => {
85 const viewState = getControlsViewState(controls);
86 const url = generateShareableUrl(shareSource, viewState);
87 await copyWithFeedback(url, setCopied);
88 }, [controls, shareSource, setCopied]);
89
90 return (
91 <button
92 type="button"
93 onClick={handleShare}
94 className={`${getShareButtonClass(copied)} ${className}`}
95 title={display.title}
96 >
97 <ShareButtonIcon iconKind={display.iconKind} />
98 <span>{display.label}</span>
99 </button>
100 );
101}
102
103/**
104 * Standalone ShareButton that doesn't require R3F context.

Callers

nothing calls this directly

Calls 5

generateShareableUrlFunction · 0.90
getShareButtonClassFunction · 0.90
getControlsViewStateFunction · 0.85
copyWithFeedbackFunction · 0.85

Tested by

no test coverage detected