import { useState } from "react"; import { useNavigate, useSearchParams, Link } from "react-router-dom"; import { useAuth } from "../context/AuthContext"; import Composer from "../components/Composer"; export default function New() { const { isAuthenticated, loading } = useAuth(); const navigate = useNavigate(); const [searchParams] = useSearchParams(); const initialUrl = searchParams.get("url") || ""; let initialSelector = null; const selectorParam = searchParams.get("selector"); if (selectorParam) { try { initialSelector = JSON.parse(selectorParam); } catch (e) { console.error("Failed to parse selector:", e); } } const legacyQuote = searchParams.get("quote") || ""; if (legacyQuote && !initialSelector) { initialSelector = { type: "TextQuoteSelector", exact: legacyQuote, }; } const [url, setUrl] = useState(initialUrl); if (loading) { return (
You need to be logged in with your Bluesky account
Sign in with BlueskyWrite in the margins of the web