tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
291
fork
atom
a tool for shared writing and social publishing
291
fork
atom
overview
issues
27
pulls
pipelines
await a push before publishing
awarm.space
6 months ago
5a873fcb
50404a18
+21
-10
2 changed files
expand all
collapse all
unified
split
app
[leaflet_id]
publish
PublishPost.tsx
page.tsx
+3
app/[leaflet_id]/publish/PublishPost.tsx
···
12
12
import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs";
13
13
import { AtUri } from "@atproto/syntax";
14
14
import { PublishIllustration } from "./PublishIllustration/PublishIllustration";
15
15
+
import { useReplicache } from "src/replicache";
15
16
16
17
type Props = {
17
18
title: string;
···
53
54
let [postContent, setPostContent] = useState("");
54
55
let [isLoading, setIsLoading] = useState(false);
55
56
let params = useParams();
57
57
+
let { rep } = useReplicache();
56
58
57
59
async function submit() {
58
60
if (isLoading) return;
59
61
setIsLoading(true);
62
62
+
await rep?.push();
60
63
let doc = await publishToPublication({
61
64
root_entity: props.root_entity,
62
65
publication_uri: props.publication_uri,
+18
-10
app/[leaflet_id]/publish/page.tsx
···
5
5
import { getIdentityData } from "actions/getIdentityData";
6
6
7
7
import { AtpAgent } from "@atproto/api";
8
8
+
import { ReplicacheProvider } from "src/replicache";
8
9
9
10
export const preferredRegion = ["sfo1"];
10
11
export const dynamic = "force-dynamic";
···
41
42
42
43
let profile = await agent.getProfile({ actor: identity.atp_did });
43
44
return (
44
44
-
<PublishPost
45
45
-
leaflet_id={leaflet_id}
46
46
-
root_entity={rootEntity}
47
47
-
profile={profile.data}
48
48
-
title={pub.title}
49
49
-
publication_uri={pub.publication}
50
50
-
description={pub.description}
51
51
-
record={pub.publications?.record as PubLeafletPublication.Record}
52
52
-
posts_in_pub={pub.publications?.documents_in_publications[0].count}
53
53
-
/>
45
45
+
<ReplicacheProvider
46
46
+
rootEntity={rootEntity}
47
47
+
token={res.data}
48
48
+
name={rootEntity}
49
49
+
initialFacts={[]}
50
50
+
>
51
51
+
<PublishPost
52
52
+
leaflet_id={leaflet_id}
53
53
+
root_entity={rootEntity}
54
54
+
profile={profile.data}
55
55
+
title={pub.title}
56
56
+
publication_uri={pub.publication}
57
57
+
description={pub.description}
58
58
+
record={pub.publications?.record as PubLeafletPublication.Record}
59
59
+
posts_in_pub={pub.publications?.documents_in_publications[0].count}
60
60
+
/>
61
61
+
</ReplicacheProvider>
54
62
);
55
63
}