tangled
alpha
login
or
join now
tynanpurdy.com
/
atprofile
3
fork
atom
Fork of atp.tools as a universal profile for people on the ATmosphere
3
fork
atom
overview
issues
pulls
pipelines
add proper titling
natalie
1 year ago
207cafa3
a935dda6
+23
-1
5 changed files
expand all
collapse all
unified
split
index.html
src
hooks
useDocumentTitle.tsx
routes
at:
$handle
$collection.index.lazy.tsx
$handle.$collection.$rkey.lazy.tsx
$handle.index.tsx
+1
-1
index.html
···
4
4
<meta charset="UTF-8" />
5
5
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
6
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
-
<title>Vite + Preact + TS</title>
7
7
+
<title>atp.tools</title>
8
8
</head>
9
9
<body>
10
10
<div id="app"></div>
+7
src/hooks/useDocumentTitle.tsx
···
1
1
+
import { useEffect } from "react";
2
2
+
3
3
+
export function useDocumentTitle(title: string) {
4
4
+
useEffect(() => {
5
5
+
document.title = title;
6
6
+
}, [title]);
7
7
+
}
+7
src/routes/at:/$handle.$collection.$rkey.lazy.tsx
···
1
1
import { RenderJson } from "@/components/renderJson";
2
2
+
import { useDocumentTitle } from "@/hooks/useDocumentTitle";
2
3
import { QtClient, useXrpc } from "@/providers/qtprovider";
3
4
import "@atcute/bluesky/lexicons";
4
5
import {
···
95
96
handle,
96
97
collection,
97
98
rkey,
99
99
+
);
100
100
+
101
101
+
useDocumentTitle(
102
102
+
repoInfo
103
103
+
? `${repoInfo?.handle ? `${repoInfo.handle} | ` : ""}${collection} | atp.tools`
104
104
+
: "atp.tools",
98
105
);
99
106
100
107
if (error) {
+5
src/routes/at:/$handle.index.tsx
···
1
1
import RepoIcons from "@/components/repoIcons";
2
2
+
import { useDocumentTitle } from "@/hooks/useDocumentTitle";
2
3
import { QtClient, useXrpc } from "@/providers/qtprovider";
3
4
import "@atcute/bluesky/lexicons";
4
5
import {
···
28
29
isLoading: true,
29
30
error: null,
30
31
});
32
32
+
33
33
+
useDocumentTitle(
34
34
+
state.data?.handle ? `${state.data.handle} | atp.tools` : "atp.tools",
35
35
+
);
31
36
32
37
useEffect(() => {
33
38
const abortController = new AbortController();
+3
src/routes/at:/$handle/$collection.index.lazy.tsx
···
1
1
+
import { useDocumentTitle } from "@/hooks/useDocumentTitle";
1
2
import { QtClient } from "@/providers/qtprovider";
2
3
import { ComAtprotoRepoListRecords } from "@atcute/client/lexicons";
3
4
import {
···
88
89
const { records, identity, isLoading, error, fetchMore, cursor } =
89
90
useCollectionRecords(handle, collection);
90
91
const loaderRef = useRef<HTMLDivElement>(null);
92
92
+
93
93
+
useDocumentTitle(records ? `${collection} | atp.tools` : "atp.tools");
91
94
92
95
useEffect(() => {
93
96
if (!loaderRef.current) return;