an app to share curated trails sidetrail.app
1

Configure Feed

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

1"use client"; 2 3import { useRouter } from "next/navigation"; 4import { ActionButton } from "@/components/ActionButton"; 5import { createDraft } from "@/data/drafts/actions"; 6import { useAuthAction } from "@/auth/useAuthAction"; 7import "./NewTrailButton.css"; 8 9interface NewTrailButtonProps { 10 text?: string; 11} 12 13export function NewTrailButton({ text = "+ new trail" }: NewTrailButtonProps) { 14 const router = useRouter(); 15 const requireAuth = useAuthAction(); 16 17 const createAction = requireAuth(async () => { 18 const rkey = await createDraft(); 19 router.push(`/drafts/${rkey}`); 20 }); 21 22 return ( 23 <ActionButton action={createAction} className="NewTrailButton" pendingChildren="creating..."> 24 {text} 25 </ActionButton> 26 ); 27}