+23
-13
src/routes/__root.tsx
+23
-13
src/routes/__root.tsx
···
11
11
Scripts,
12
12
createRootRoute,
13
13
useLocation,
14
+
useNavigate,
14
15
} from "@tanstack/react-router";
15
16
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
16
17
import * as React from "react";
···
61
62
{ rel: "icon", href: "/favicon.ico" },
62
63
],
63
64
}),
64
-
errorComponent: (props) => {
65
-
return (
66
-
<RootDocument>
67
-
<DefaultCatchBoundary {...props} />
68
-
</RootDocument>
69
-
);
70
-
},
65
+
errorComponent: import.meta.env.DEV
66
+
? undefined
67
+
: (props) => (
68
+
<RootDocument>
69
+
<DefaultCatchBoundary {...props} />
70
+
</RootDocument>
71
+
),
71
72
notFoundComponent: () => <NotFound />,
72
73
component: RootComponent,
73
74
});
···
86
87
87
88
function RootDocument({ children }: { children: React.ReactNode }) {
88
89
const location = useLocation();
90
+
const navigate = useNavigate();
89
91
const { agent, authed } = useAuth();
90
92
const isHome = location.pathname === "/";
91
93
const isNotifications = location.pathname.startsWith("/notifications");
92
-
const isProfile = location.pathname.startsWith("/profile/");
94
+
const isProfile = agent && ((location.pathname === (`/profile/${agent.assertDid}`)) || (location.pathname === (`/profile/${encodeURIComponent(agent.assertDid)}`)));
93
95
94
96
const [postOpen, setPostOpen] = useState(false);
95
97
const [postText, setPostText] = useState("");
···
242
244
}`}
243
245
onClick={() => {
244
246
if (authed && agent && agent.assertDid) {
245
-
window.location.href = `/profile/${agent.assertDid}`;
247
+
//window.location.href = `/profile/${agent.assertDid}`;
248
+
navigate({
249
+
to: "/profile/$did",
250
+
params: { did: agent.assertDid },
251
+
})
246
252
}
247
253
}}
248
254
type="button"
···
347
353
348
354
<div className="flex-1"></div>
349
355
<p className="text-xs text-gray-400 dark:text-gray-500 text-justify mx-4 mb-4">
350
-
Red Dwarf is a bluesky client that uses Constellation and
351
-
direct PDS queries. Skylite would be a
352
-
self-hosted bluesky "instance". Stay tuned for the release of Skylite.
356
+
Red Dwarf is a bluesky client that uses Constellation and direct PDS
357
+
queries. Skylite would be a self-hosted bluesky "instance". Stay
358
+
tuned for the release of Skylite.
353
359
</p>
354
360
</aside>
355
361
</div>
···
409
415
}`}
410
416
onClick={() => {
411
417
if (authed && agent && agent.assertDid) {
412
-
window.location.href = `/profile/${agent.assertDid}`;
418
+
//window.location.href = `/profile/${agent.assertDid}`;
419
+
navigate({
420
+
to: "/profile/$did",
421
+
params: { did: agent.assertDid },
422
+
})
413
423
}
414
424
}}
415
425
type="button"