tangled
alpha
login
or
join now
bunware.org
/
pin.to.it
6
fork
atom
Scrapboard.org client
6
fork
atom
overview
issues
pulls
pipelines
fix: likes and add oauth spinner
TurtlePaw
7 months ago
bedd6088
dd6090cc
+21
-5
3 changed files
expand all
collapse all
unified
split
src
app
page.tsx
components
LikeCounter.tsx
nav
navbar.tsx
+15
-2
src/app/page.tsx
···
18
const [timeline, setTimeline] = useState<AppBskyFeedDefs.FeedViewPost[]>([]);
19
const [cursor, setCursor] = useState<string | null>(null);
20
const [loading, setLoading] = useState(false);
21
-
const { agent } = useAuth();
22
const sentinelRef = useRef<HTMLDivElement>(null);
23
24
const seenImageUrls = new Set<string>();
···
127
768: 1,
128
};
129
0
0
0
0
0
0
0
0
0
0
0
0
0
130
return (
131
<div className="items-center justify-items-center">
132
<div className="h-5" />
133
-
<main className="">
134
<Masonry
135
breakpointCols={breakpointColumnsObj}
136
className="flex -mx-2 w-auto"
···
18
const [timeline, setTimeline] = useState<AppBskyFeedDefs.FeedViewPost[]>([]);
19
const [cursor, setCursor] = useState<string | null>(null);
20
const [loading, setLoading] = useState(false);
21
+
const { agent, session } = useAuth();
22
const sentinelRef = useRef<HTMLDivElement>(null);
23
24
const seenImageUrls = new Set<string>();
···
127
768: 1,
128
};
129
130
+
console.log(session);
131
+
132
+
if (session == null) {
133
+
return (
134
+
<div className="items-center justify-items-center text-center">
135
+
<h1 className="text-lg mb-0.5 font-medium">
136
+
You're not logged in
137
+
</h1>
138
+
<p>Log in to see your feeds</p>
139
+
</div>
140
+
);
141
+
}
142
+
143
return (
144
<div className="items-center justify-items-center">
145
<div className="h-5" />
146
+
<main className="px-5">
147
<Masonry
148
breakpointCols={breakpointColumnsObj}
149
className="flex -mx-2 w-auto"
+2
-2
src/components/LikeCounter.tsx
···
47
>
48
{/* Old number (what we're transitioning FROM) */}
49
<div className="flex items-center justify-center h-[1.2em]">
50
-
{String(previousCount)}
51
</div>
52
{/* New number (what we're transitioning TO) */}
53
<div className="flex items-center justify-center h-[1.2em]">
54
-
{String(displayCount)}
55
</div>
56
</motion.div>
57
</div>
···
47
>
48
{/* Old number (what we're transitioning FROM) */}
49
<div className="flex items-center justify-center h-[1.2em]">
50
+
{String(direction == "down" ? displayCount : previousCount)}
51
</div>
52
{/* New number (what we're transitioning TO) */}
53
<div className="flex items-center justify-center h-[1.2em]">
54
+
{String(direction == "up" ? displayCount : previousCount)}
55
</div>
56
</motion.div>
57
</div>
+4
-1
src/nav/navbar.tsx
···
3
import Link from "next/link";
4
import { Button } from "@/components/ui/button";
5
import { ModeToggle } from "./ModeToggle"; // for dark mode toggle
6
-
import { Menu, X } from "lucide-react";
7
import { useState } from "react";
8
import { useAuth } from "@/lib/useAuth";
9
import {
···
118
function LoginButton() {
119
const { login } = useAuth();
120
const [handle, setHandle] = useState("");
0
121
return (
122
<Dialog>
123
<DialogTrigger>
···
140
<DialogFooter>
141
<Button
142
onClick={() => {
0
143
login(handle);
144
}}
145
disabled={!handle}
146
className="cursor-pointer"
147
>
0
148
Sign In
149
</Button>
150
</DialogFooter>
···
3
import Link from "next/link";
4
import { Button } from "@/components/ui/button";
5
import { ModeToggle } from "./ModeToggle"; // for dark mode toggle
6
+
import { LoaderCircle, Menu, X } from "lucide-react";
7
import { useState } from "react";
8
import { useAuth } from "@/lib/useAuth";
9
import {
···
118
function LoginButton() {
119
const { login } = useAuth();
120
const [handle, setHandle] = useState("");
121
+
const [isLoading, setLoading] = useState(false);
122
return (
123
<Dialog>
124
<DialogTrigger>
···
141
<DialogFooter>
142
<Button
143
onClick={() => {
144
+
setLoading(true);
145
login(handle);
146
}}
147
disabled={!handle}
148
className="cursor-pointer"
149
>
150
+
{isLoading && <LoaderCircle className="animate-spin ml-2" />}
151
Sign In
152
</Button>
153
</DialogFooter>