tangled
alpha
login
or
join now
minito.dev
/
SkeetLonger.app
1
fork
atom
A web app for writing and sharing 301+ character Bluesky posts.
1
fork
atom
overview
issues
pulls
pipelines
Save text between reloads for redirect post login
Minito
4 months ago
110d6977
069bba5c
+10
-2
1 changed file
expand all
collapse all
unified
split
src
routes
index.tsx
+10
-2
src/routes/index.tsx
···
4
4
import Login from '../components/Login'
5
5
import { useAuth } from "../providers/UnifiedAuthProvider";
6
6
import { AtUri } from '@atproto/api';
7
7
-
import type { text } from 'node:stream/consumers';
8
7
9
8
export const Route = createFileRoute('/')({
10
9
component: RouteComponent,
···
13
12
function RouteComponent() {
14
13
const { agent, status } = useAuth();
15
14
16
16
-
const [postText, setPostText] = useState('')
15
15
+
const [postText, setPostText] = useState(() => {
16
16
+
// Initialize from localStorage
17
17
+
const savedPost = localStorage.getItem('draftPost');
18
18
+
return savedPost || '';
19
19
+
})
17
20
const [showLoginPrompt, setShowLoginPrompt] = useState(false)
18
21
const [showSuccessPopup, setShowSuccessPopup] = useState(false)
19
22
const [postUri, setPostUri] = useState('')
20
23
const charCount = postText.length
24
24
+
25
25
+
// Save to localStorage whenever postText changes
26
26
+
useEffect(() => {
27
27
+
localStorage.setItem('draftPost', postText);
28
28
+
}, [postText]);
21
29
22
30
const handleSubmit = async () => {
23
31
if (!agent || status !== 'signedIn') {