-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathTodos.tsx
More file actions
153 lines (149 loc) · 5.65 KB
/
Copy pathTodos.tsx
File metadata and controls
153 lines (149 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
"use client";
import { useMap, useYSweetDebugUrl } from "@y-sweet/react";
export function Todos() {
const debugUrl = useYSweetDebugUrl();
const todos = useMap<boolean>("todos");
return (
<main className="flex flex-col p-6">
<h2 className="font-bold text-lg mb-2">
When you're working on your app…
</h2>
<ol className="list-decimal list flex flex-col gap-3 mb-12">
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("sync") || false}
onChange={(e) => todos.set("sync", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Open{" "}
<a href={window.location.href} target="_blank">
this page in a new window
</a>
.
</p>
<p className="col-start-2 text-xs text-gray-500">
Every interactive element on this page syncs its state with all
visitors.
</p>
</li>
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("types") || false}
onChange={(e) => todos.set("types", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Learn how to use our{" "}
<a
href="https://docs.jamsocket.com/y-sweet/reference/react"
target="_blank"
>
Y-Sweet React library
</a>
.
</p>
<p className="col-start-2 text-xs text-gray-500">
Y-Sweet's React hooks make it easy to use state that automatically
syncs.
</p>
</li>
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("debug") || false}
onChange={(e) => todos.set("debug", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Inspect your document in the{" "}
<a href={debugUrl} target="_blank">
Y-Sweet debugger
</a>
.
</p>
<p className="col-start-2 text-xs text-gray-500">
Y-Sweet lets you see the state of your document and everyone editing
it in real time.
</p>
</li>
</ol>
<h2 className="font-bold text-lg mb-2">When you're ready to go live…</h2>
<ol className="list-decimal list-inside flex flex-col gap-3">
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("account") || false}
onChange={(e) => todos.set("account", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Sign up for{" "}
<a href="https://auth.jamsocket.com/en/signup" target="_blank">
Jamsocket
</a>
.
</p>
<p className="col-start-2 text-xs text-gray-500">
Jamsocket makes it easy to host Y-Sweet services.
</p>
</li>
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("service") || false}
onChange={(e) => todos.set("service", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Create a Y-Sweet service in the{" "}
<a href="https://app.jamsocket.com" target="_blank">
Jamsocket dashboard
</a>
.
</p>
<p className="col-start-2 text-xs text-gray-500">
Y-Sweet is Jamsocket's service for building collaborative apps using
Yjs.
</p>
</li>
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("connstring") || false}
onChange={(e) => todos.set("connstring", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Generate a connection string for your new Y-Sweet service.
</p>
<p className="col-start-2 text-xs text-gray-500">
A connection string is like an API key that tells your Next.js app
how to talk to Y-Sweet.
</p>
</li>
<li className="grid grid-cols-[auto_1fr] grid-auto-flow-row gap-x-4 gap-y-1 items-center">
<input
className="peer"
type="checkbox"
checked={todos.get("env") || false}
onChange={(e) => todos.set("env", e.target.checked)}
/>
<p className="col-start-2 peer-checked:line-through">
Add the connection string as the environment variable{" "}
<code>CONNECTION_STRING</code>.
</p>
<p className="col-start-2 text-xs text-gray-500">
Vercel has documentation on how to add an{" "}
<a href="https://vercel.com/docs/projects/environment-variables">
environment variable
</a>{" "}
to your project.
</p>
</li>
</ol>
</main>
);
}