diff --git a/components/PageHead.tsx b/components/PageHead.tsx index 845fe38..2cc1bd2 100644 --- a/components/PageHead.tsx +++ b/components/PageHead.tsx @@ -4,10 +4,29 @@ export default function PageHead() { return ( Riffusion + + + + + + + + + + ); diff --git a/components/Share.tsx b/components/Share.tsx index 2a11659..a7411d5 100644 --- a/components/Share.tsx +++ b/components/Share.tsx @@ -174,6 +174,21 @@ export default function Share({ return `https://www.reddit.com/r/riffusion/submit?title=Prompt:+${encodedPrompt}&url=${encodedUrl}`; }, [nowPlayingResult, inferenceResults]); + const getTwitterLink = useCallback(() => { + if (inferenceResults.length == 0) { + return null; + } + + const result = nowPlayingResult ? nowPlayingResult : inferenceResults[0]; + + const encodedPrompt = encodeURIComponent(result.input.start.prompt); + const encodedUrl = encodeURIComponent(generateLink(0)); + + return `https://twitter.com/intent/tweet?&text=Check+out+this+prompt+on+%23riffusion:+${encodeURI( + '"' + )}${encodedPrompt}${encodeURI('"')}${encodeURI("\n\n")}${encodedUrl}`; + }, [nowPlayingResult, inferenceResults]); + return ( <>