Your music, beautifully tracked. All yours. (coming soon) teal.fm
teal-fm atproto
fork

Configure Feed

Select the types of activity you want to include in your feed.

add a note on bluesky post when you manually submit

Natalie B 683fd28d e85e000c

+38 -5
+38 -5
apps/amethyst/app/(tabs)/(stamp)/stamp/submit.tsx
··· 16 16 import { Switch, View } from "react-native"; 17 17 import { MusicBrainzRecording, PlaySubmittedData } from "@/lib/oldStamp"; 18 18 import { Text } from "@/components/ui/text"; 19 + import { Textarea } from "@/components/ui/textarea"; 19 20 import { ExternalLink } from "@/components/ExternalLink"; 20 21 import { StampContext, StampContextValue, StampStep } from "./_layout"; 21 22 import { Image } from "react-native"; 22 23 import { Artist } from "@teal/lexicons/src/types/fm/teal/alpha/feed/defs"; 24 + import { cn } from "@/lib/utils"; 23 25 24 26 type CardyBResponse = { 25 27 error: string; ··· 162 164 163 165 const [isSubmitting, setIsSubmitting] = useState<boolean>(false); 164 166 const [shareWithBluesky, setShareWithBluesky] = useState<boolean>(false); 167 + const [blueskyPostText, setBlueskyPostText] = useState<string>(""); 165 168 166 169 const [blueskyEmbedCard, setBlueskyEmbedCard] = useState<EmbedCard | null>( 167 170 null, ··· 170 173 const selectedTrack = 171 174 state.step === StampStep.SUBMITTING ? state.submittingStamp : null; 172 175 176 + // Effect to initialize blueskyPostText when selectedTrack changes 177 + useEffect(() => { 178 + if (selectedTrack) { 179 + const defaultText = `💮 now playing: 180 + ${selectedTrack.title} by ${selectedTrack["artist-credit"]?.map((a) => a.artist.name).join(", ")} 181 + 182 + powered by @teal.fm`; 183 + setBlueskyPostText(defaultText); 184 + } 185 + }, [selectedTrack]); 186 + 173 187 useEffect(() => { 174 188 const fetchEmbedData = async (id: string) => { 175 189 try { ··· 249 263 if (shareWithBluesky && agent) { 250 264 // lol this type 251 265 const rt = new RichText({ 252 - text: `💮 now playing: 253 - ${record.trackName} by ${record.artists?.map((a) => a.artistName).join(", ")} 254 - 255 - powered by @teal.fm`, 266 + text: blueskyPostText, 256 267 }); 257 268 await rt.detectFacets(agent); 258 269 let embedInfo = await getEmbedInfo(selectedTrack.id); ··· 330 341 </Text> 331 342 </View> 332 343 333 - <View className="flex-col gap-4 items-center"> 344 + <View className="flex-col gap-4 items-center w-full"> 334 345 {blueskyEmbedCard && shareWithBluesky ? ( 335 346 <View className="gap-2 w-full"> 336 347 <Text className="text-sm text-muted-foreground text-center"> ··· 359 370 jsyk: there won't be an embed card on your post. 360 371 </Text> 361 372 ) 373 + )} 374 + {shareWithBluesky && ( 375 + <View className="text-sm text-muted-foreground w-full items-end"> 376 + <Textarea 377 + className="w-full p-2 pb-4 border border-border rounded-md text-card-foreground bg-card min-h-[100px] max-h-[200px]" 378 + multiline 379 + value={blueskyPostText} 380 + onChangeText={setBlueskyPostText} 381 + placeholder="Enter your Bluesky post text here..." 382 + /> 383 + <Text 384 + className={cn( 385 + "text-sm text-muted-foreground text-center absolute bottom-1 right-2", 386 + blueskyPostText.length > 150 387 + ? "text-gray-600 dark:text-gray-300" 388 + : "", 389 + blueskyPostText.length > 290 ? "text-red-500" : "", 390 + )} 391 + > 392 + {blueskyPostText.length}/300 393 + </Text> 394 + </View> 362 395 )} 363 396 <View className="flex-row gap-2 items-center"> 364 397 <Switch