Compare commits
68 Commits
jazz-react
...
cojson@0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d496b03e4 | ||
|
|
261c9aa51d | ||
|
|
5ac5d732a9 | ||
|
|
f2e9bc9f92 | ||
|
|
6d4b8ecfde | ||
|
|
2da366e1cd | ||
|
|
e902405c93 | ||
|
|
ecbf6d0248 | ||
|
|
f44a4fa7a2 | ||
|
|
b72d478ba1 | ||
|
|
d0fd66df00 | ||
|
|
b2bdfc702e | ||
|
|
dc3d6a28f6 | ||
|
|
43e339a4bc | ||
|
|
e1a66fd76b | ||
|
|
2074e45158 | ||
|
|
b06dac36a5 | ||
|
|
7f036c170e | ||
|
|
ce612394dc | ||
|
|
b3b12a020e | ||
|
|
a91f343d6d | ||
|
|
59a7ae94b4 | ||
|
|
c74f1aea8d | ||
|
|
debdb6dccc | ||
|
|
11a952d45b | ||
|
|
3df07327f1 | ||
|
|
c66a3fb8e9 | ||
|
|
57a3dbe2b4 | ||
|
|
3f1cbcdaee | ||
|
|
bd1bf3fd2c | ||
|
|
065e84fc7d | ||
|
|
341b056e09 | ||
|
|
75bf523b6a | ||
|
|
2ad11eff11 | ||
|
|
2bfab83df6 | ||
|
|
9526674a95 | ||
|
|
4f2424f5e8 | ||
|
|
58c7305e47 | ||
|
|
c05dd58c7d | ||
|
|
cc3d31fc3b | ||
|
|
83433fcfe2 | ||
|
|
7cdfc62593 | ||
|
|
a717754bb4 | ||
|
|
1617940ce2 | ||
|
|
d8508c260e | ||
|
|
7e754cae9d | ||
|
|
5e7b59293d | ||
|
|
d133d4724d | ||
|
|
e6ef9b6819 | ||
|
|
91f9ea1823 | ||
|
|
3404fa99bf | ||
|
|
4bdf0b064b | ||
|
|
1e1372bb71 | ||
|
|
b1be0bbdf3 | ||
|
|
d4f2f6fd99 | ||
|
|
f901c4628d | ||
|
|
c970eec586 | ||
|
|
ca909a09a5 | ||
|
|
ad9afc14ba | ||
|
|
846a22fb87 | ||
|
|
50133de036 | ||
|
|
8eff068bdf | ||
|
|
77383b20c6 | ||
|
|
4965807ce9 | ||
|
|
b424ff04fb | ||
|
|
0f4bf6ab77 | ||
|
|
65336464fc | ||
|
|
a628f5cc97 |
@@ -1,5 +1,17 @@
|
||||
# chat-rn-clerk
|
||||
|
||||
## 1.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react-native@0.11.4
|
||||
- jazz-react-native-auth-clerk@0.11.4
|
||||
- jazz-react-native-media-images@0.11.4
|
||||
|
||||
## 1.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.84",
|
||||
"version": "1.0.85",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react-native@0.11.4
|
||||
|
||||
## 1.0.80
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.80",
|
||||
"version": "1.0.81",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
|
||||
@@ -25,11 +25,8 @@ appId: com.jazz.chatrn
|
||||
- assertVisible: "Logout"
|
||||
|
||||
# send a message
|
||||
- runFlow:
|
||||
label: "Erase existing message"
|
||||
file: erase_text.yml
|
||||
env:
|
||||
id: "message-input"
|
||||
- tapOn:
|
||||
id: "message-input"
|
||||
- inputText: "bro, low key, it do be like that tho"
|
||||
- tapOn:
|
||||
id: "send-button"
|
||||
@@ -44,5 +41,10 @@ appId: com.jazz.chatrn
|
||||
|
||||
# logout
|
||||
- tapOn: "Logout"
|
||||
- assertVisible: "boorad"
|
||||
- assertVisible: "bro, low key, it do be like that tho"
|
||||
- assertVisible: "Anonymous user"
|
||||
# This doesn't work on CI, maybe because Android has a different alert dialog
|
||||
# - tapOn: "Join chat"
|
||||
# - inputText: "co_zFs6KFyhxPw4xtw83tcEMzeHUNv" # Use a static id because maestro doesn't have access to the system clipboard
|
||||
# - pressKey: "enter"
|
||||
# - assertVisible: "boorad"
|
||||
# - assertVisible: "bro, low key, it do be like that tho"
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.66
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser@0.11.4
|
||||
- jazz-vue@0.11.4
|
||||
|
||||
## 0.0.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.65",
|
||||
"version": "0.0.66",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.163
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 2074e45: In the chat app example, show a "Message not readable" placeholder, if messages from a chat list are not readable by the user.
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser-media-images@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.162
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.162",
|
||||
"version": "0.0.163",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createImage } from "jazz-browser-media-images";
|
||||
import { useCoState } from "jazz-react";
|
||||
import { ID } from "jazz-tools";
|
||||
import { useAccount, useCoState } from "jazz-react";
|
||||
import { Account, ID } from "jazz-tools";
|
||||
import { useState } from "react";
|
||||
import { Chat, Message } from "./schema.ts";
|
||||
import {
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from "./ui.tsx";
|
||||
|
||||
export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
const account = useAccount();
|
||||
const chat = useCoState(Chat, props.chatID, [{}]);
|
||||
const [showNLastMessages, setShowNLastMessages] = useState(30);
|
||||
|
||||
@@ -47,7 +48,7 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
chat
|
||||
.slice(-showNLastMessages)
|
||||
.reverse() // this plus flex-col-reverse on ChatBody gives us scroll-to-bottom behavior
|
||||
.map((msg) => <ChatBubble msg={msg} key={msg.id} />)
|
||||
.map((msg) => <ChatBubble me={account.me} msg={msg} key={msg.id} />)
|
||||
) : (
|
||||
<EmptyChatMessage />
|
||||
)}
|
||||
@@ -74,7 +75,20 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
||||
);
|
||||
}
|
||||
|
||||
function ChatBubble(props: { msg: Message }) {
|
||||
function ChatBubble(props: { me: Account; msg: Message }) {
|
||||
if (!props.me.canRead(props.msg)) {
|
||||
return (
|
||||
<BubbleContainer fromMe={false}>
|
||||
<BubbleBody fromMe={false}>
|
||||
<BubbleText
|
||||
text="Message not readable"
|
||||
className="text-gray-500 italic"
|
||||
/>
|
||||
</BubbleBody>
|
||||
</BubbleContainer>
|
||||
);
|
||||
}
|
||||
|
||||
const lastEdit = props.msg._edits.text;
|
||||
const fromMe = lastEdit.by?.isMe;
|
||||
const { text, image } = props.msg;
|
||||
|
||||
@@ -70,8 +70,12 @@ export function BubbleBody(props: {
|
||||
);
|
||||
}
|
||||
|
||||
export function BubbleText(props: { text: string }) {
|
||||
return <p className="px-2 leading-relaxed">{props.text}</p>;
|
||||
export function BubbleText(props: { text: string; className?: string }) {
|
||||
return (
|
||||
<p className={clsx("px-2 leading-relaxed", props.className)}>
|
||||
{props.text}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
export function BubbleImage(props: { image: ImageDefinition }) {
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.62
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
- jazz-react-auth-clerk@0.11.4
|
||||
|
||||
## 0.0.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.61",
|
||||
"version": "0.0.62",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@clerk/clerk-react": "^5.4.1",
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-react-auth-clerk": "workspace:0.11.3",
|
||||
"jazz-react-auth-clerk": "workspace:0.11.4",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# file-share-svelte
|
||||
|
||||
## 0.0.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-svelte@0.11.4
|
||||
|
||||
## 0.0.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-share-svelte",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.46",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
28
examples/filestream/.gitignore
vendored
Normal file
28
examples/filestream/.gitignore
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
playwright-report
|
||||
277
examples/filestream/CHANGELOG.md
Normal file
277
examples/filestream/CHANGELOG.md
Normal file
@@ -0,0 +1,277 @@
|
||||
# jazz-tailwind-demo-auth-starter
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.52
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2f99de0]
|
||||
- jazz-tools@0.10.15
|
||||
- jazz-react@0.10.15
|
||||
|
||||
## 0.0.51
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [75211e3]
|
||||
- jazz-tools@0.10.14
|
||||
- jazz-react@0.10.14
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [4612e05]
|
||||
- jazz-tools@0.10.12
|
||||
- jazz-react@0.10.12
|
||||
|
||||
## 0.0.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.10.9
|
||||
|
||||
## 0.0.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [2fb6428]
|
||||
- jazz-tools@0.10.8
|
||||
- jazz-react@0.10.8
|
||||
|
||||
## 0.0.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1136d9b]
|
||||
- Updated dependencies [0eed228]
|
||||
- jazz-react@0.10.7
|
||||
- jazz-tools@0.10.7
|
||||
|
||||
## 0.0.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1d71ca1]
|
||||
- Updated dependencies [ada802b]
|
||||
- jazz-react@0.10.6
|
||||
- jazz-tools@0.10.6
|
||||
|
||||
## 0.0.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [59ff77e]
|
||||
- jazz-tools@0.10.5
|
||||
- jazz-react@0.10.5
|
||||
|
||||
## 0.0.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.10.4
|
||||
- jazz-tools@0.10.4
|
||||
|
||||
## 0.0.42
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d8582fc]
|
||||
- jazz-tools@0.10.3
|
||||
- jazz-react@0.10.3
|
||||
|
||||
## 0.0.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.10.2
|
||||
- jazz-tools@0.10.2
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5a63cba]
|
||||
- jazz-tools@0.10.1
|
||||
- jazz-react@0.10.1
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [498954f]
|
||||
- Updated dependencies [d42c2aa]
|
||||
- Updated dependencies [dd03464]
|
||||
- Updated dependencies [b426342]
|
||||
- jazz-react@0.10.0
|
||||
- jazz-tools@0.10.0
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.23
|
||||
- jazz-tools@0.9.23
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.22
|
||||
|
||||
## 0.0.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1be017d]
|
||||
- jazz-tools@0.9.21
|
||||
- jazz-react@0.9.21
|
||||
|
||||
## 0.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [b01cc1f]
|
||||
- jazz-tools@0.9.20
|
||||
- jazz-react@0.9.20
|
||||
|
||||
## 0.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.19
|
||||
- jazz-tools@0.9.19
|
||||
|
||||
## 0.0.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.18
|
||||
- jazz-tools@0.9.18
|
||||
|
||||
## 0.0.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [24b3b6a]
|
||||
- jazz-tools@0.9.16
|
||||
- jazz-react@0.9.16
|
||||
|
||||
## 0.0.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7491711]
|
||||
- jazz-tools@0.9.15
|
||||
- jazz-react@0.9.15
|
||||
|
||||
## 0.0.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3df93cc]
|
||||
- jazz-tools@0.9.14
|
||||
- jazz-react@0.9.14
|
||||
|
||||
## 0.0.28
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.13
|
||||
- jazz-tools@0.9.13
|
||||
|
||||
## 0.0.27
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.12
|
||||
- jazz-tools@0.9.12
|
||||
|
||||
## 0.0.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.11
|
||||
- jazz-tools@0.9.11
|
||||
|
||||
## 0.0.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5e83864]
|
||||
- jazz-react@0.9.10
|
||||
- jazz-tools@0.9.10
|
||||
|
||||
## 0.0.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [8eb9247]
|
||||
- jazz-tools@0.9.9
|
||||
- jazz-react@0.9.9
|
||||
|
||||
## 0.0.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d1d773b]
|
||||
- jazz-tools@0.9.8
|
||||
- jazz-react@0.9.8
|
||||
|
||||
## 0.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.9.4
|
||||
|
||||
## 0.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1b71969]
|
||||
- jazz-react@0.9.1
|
||||
- jazz-tools@0.9.1
|
||||
|
||||
## 0.0.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [956a4d1]
|
||||
- Updated dependencies [8eda792]
|
||||
- jazz-react@0.9.0
|
||||
- jazz-tools@0.9.0
|
||||
|
||||
## 0.0.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [dc62b95]
|
||||
- Updated dependencies [1de26f8]
|
||||
- jazz-tools@0.8.51
|
||||
- jazz-react@0.8.51
|
||||
66
examples/filestream/README.md
Normal file
66
examples/filestream/README.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# File upload example with Jazz and React
|
||||
|
||||
This is an example of how to upload and render images with Jazz.
|
||||
|
||||
Live version: https://file-upload-demo.jazz.tools
|
||||
|
||||
## Getting started
|
||||
|
||||
You can either
|
||||
1. Clone the jazz repository, and run the app within the monorepo.
|
||||
2. Or create a new Jazz project using this example as a template.
|
||||
|
||||
|
||||
### Using the example as a template
|
||||
|
||||
Create a new Jazz project, and use this example as a template.
|
||||
```bash
|
||||
npx create-jazz-app@latest --example file-upload --project-name file-upload
|
||||
```
|
||||
|
||||
Go to the new project directory.
|
||||
```bash
|
||||
cd file-upload
|
||||
```
|
||||
|
||||
Run the dev server.
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Using the monorepo
|
||||
|
||||
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||
|
||||
Clone the jazz repository.
|
||||
```bash
|
||||
git clone https://github.com/garden-co/jazz.git
|
||||
```
|
||||
|
||||
Install and build dependencies.
|
||||
```bash
|
||||
pnpm i && npx turbo build
|
||||
```
|
||||
|
||||
Go to the example directory.
|
||||
```bash
|
||||
cd jazz/examples/file-upload/
|
||||
```
|
||||
|
||||
Start the dev server.
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||
|
||||
## Questions / problems / feedback
|
||||
|
||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||
|
||||
|
||||
## Configuration: sync server
|
||||
|
||||
By default, the example app uses [Jazz Cloud](https://jazz.tools/cloud) (`wss://cloud.jazz.tools`) - so cross-device use, invites and collaboration should just work.
|
||||
|
||||
You can also run a local sync server by running `npx jazz-run sync` and adding the query param `?sync=ws://localhost:4200` to the URL of the example app (for example: `http://localhost:5173/?peer=ws://localhost:4200`), or by setting the `sync` parameter of `JazzProvider` component in [./src/main.tsx](./src/main.tsx).
|
||||
BIN
examples/filestream/favicon.ico
Normal file
BIN
examples/filestream/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
13
examples/filestream/index.html
Normal file
13
examples/filestream/index.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en" class="h-full">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/png" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Jazz | React + Demo Auth + Tailwind</title>
|
||||
</head>
|
||||
<body class="h-full flex flex-col">
|
||||
<div id="root" class="align-self-center flex-1"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
32
examples/filestream/package.json
Normal file
32
examples/filestream/package.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "filestream",
|
||||
"private": true,
|
||||
"version": "0.0.2",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"preview": "vite preview",
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write"
|
||||
},
|
||||
"dependencies": {
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.9.4",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"globals": "^15.11.0",
|
||||
"is-ci": "^3.0.1",
|
||||
"postcss": "^8.5.3",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
"vite": "^6.0.11"
|
||||
}
|
||||
}
|
||||
46
examples/filestream/playwright.config.ts
Normal file
46
examples/filestream/playwright.config.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
import isCI from "is-ci";
|
||||
|
||||
/**
|
||||
* See https://playwright.dev/docs/test-configuration.
|
||||
*/
|
||||
export default defineConfig({
|
||||
testDir: "./tests",
|
||||
/* Run tests in files in parallel */
|
||||
fullyParallel: true,
|
||||
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
||||
forbidOnly: isCI,
|
||||
/* Retry on CI only */
|
||||
retries: isCI ? 2 : 0,
|
||||
/* Opt out of parallel tests on CI. */
|
||||
workers: isCI ? 1 : undefined,
|
||||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
||||
reporter: "html",
|
||||
|
||||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
||||
use: {
|
||||
/* Base URL to use in actions like `await page.goto('/')`. */
|
||||
baseURL: "http://localhost:5173/",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: "on-first-retry",
|
||||
permissions: ["clipboard-read", "clipboard-write"],
|
||||
},
|
||||
|
||||
/* Configure projects for major browsers */
|
||||
projects: [
|
||||
{
|
||||
name: "chromium",
|
||||
use: { ...devices["Desktop Chrome"] },
|
||||
},
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm preview --port 5173",
|
||||
url: "http://localhost:5173/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
});
|
||||
6
examples/filestream/postcss.config.js
Normal file
6
examples/filestream/postcss.config.js
Normal file
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
37
examples/filestream/src/App.tsx
Normal file
37
examples/filestream/src/App.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { FileWidget } from "./FileWidget.js";
|
||||
import { Logo } from "./Logo.tsx";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
<main className="container mt-16 flex flex-col gap-8">
|
||||
<Logo />
|
||||
<FileWidget />
|
||||
<p className="text-center">
|
||||
Edit the form above,{" "}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => window.location.reload()}
|
||||
className="font-semibold underline"
|
||||
>
|
||||
refresh
|
||||
</button>{" "}
|
||||
this page, and see your changes persist.
|
||||
</p>
|
||||
|
||||
<p className="text-center my-16">
|
||||
Go to{" "}
|
||||
<a
|
||||
className="font-semibold underline"
|
||||
href="https://jazz.tools/docs/react/guide"
|
||||
>
|
||||
jazz.tools/docs/react/guide
|
||||
</a>{" "}
|
||||
for a full tutorial.
|
||||
</p>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
269
examples/filestream/src/FileWidget.tsx
Normal file
269
examples/filestream/src/FileWidget.tsx
Normal file
@@ -0,0 +1,269 @@
|
||||
"use client";
|
||||
import { useAccount } from "jazz-react";
|
||||
import { FileStream } from "jazz-tools";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
export function FileWidget() {
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
const dragAndDropElementRef = useRef<HTMLDivElement>(null);
|
||||
const [isUploading, setIsUploading] = useState(false);
|
||||
const [progress, setProgress] = useState(0);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const { me } = useAccount();
|
||||
|
||||
async function handleUpload(event: React.FormEvent) {
|
||||
event.preventDefault();
|
||||
setError(null);
|
||||
if (!me?.profile) {
|
||||
setError("User profile not found");
|
||||
return;
|
||||
}
|
||||
|
||||
setProgress(0);
|
||||
|
||||
const file = inputRef.current?.files?.[0];
|
||||
if (!file) {
|
||||
setError("Please select a file");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setIsUploading(true);
|
||||
me.profile.file = await FileStream.createFromBlob(file, {
|
||||
onProgress: (p) => setProgress(Math.round(p * 100)),
|
||||
});
|
||||
} catch (error) {
|
||||
setError(
|
||||
error instanceof Error ? error.message : "Failed to upload file",
|
||||
);
|
||||
console.error("Error uploading file:", error);
|
||||
} finally {
|
||||
setIsUploading(false);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDelete() {
|
||||
if (!me?.profile) return;
|
||||
delete me.profile?.file;
|
||||
}
|
||||
|
||||
async function handleDownload() {
|
||||
if (!me?.profile) return;
|
||||
|
||||
const file = me.profile.file;
|
||||
if (!file) return;
|
||||
|
||||
try {
|
||||
const blob = file.toBlob();
|
||||
const url = URL.createObjectURL(blob || new Blob());
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = file.id || "download";
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
} catch (error) {
|
||||
console.error("Error downloading file:", error);
|
||||
}
|
||||
}
|
||||
|
||||
function formatFileSize(bytes?: number): string {
|
||||
if (!bytes) return "0 Bytes";
|
||||
const k = 1024;
|
||||
const sizes = ["Bytes", "KB", "MB", "GB"];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
||||
}
|
||||
|
||||
const onDragEnter = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dragAndDropElementRef?.current?.classList.replace(
|
||||
"border-stone-400",
|
||||
"border-blue-700",
|
||||
);
|
||||
};
|
||||
|
||||
const onDragOver = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dragAndDropElementRef?.current?.classList.replace(
|
||||
"border-stone-400",
|
||||
"border-blue-700",
|
||||
);
|
||||
};
|
||||
|
||||
const onDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dragAndDropElementRef?.current?.classList.replace(
|
||||
"border-blue-700",
|
||||
"border-stone-400",
|
||||
);
|
||||
};
|
||||
|
||||
const onDrop = async (e: React.DragEvent<HTMLDivElement>) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
dragAndDropElementRef?.current?.classList.replace(
|
||||
"border-blue-700",
|
||||
"border-stone-400",
|
||||
);
|
||||
|
||||
if (!me?.profile) {
|
||||
setError("User profile not found");
|
||||
return;
|
||||
}
|
||||
|
||||
const droppedFiles = e.dataTransfer.files;
|
||||
if (!droppedFiles || droppedFiles.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const file = droppedFiles[0];
|
||||
setProgress(0);
|
||||
|
||||
try {
|
||||
setIsUploading(true);
|
||||
me.profile.file = await FileStream.createFromBlob(file, {
|
||||
onProgress: (p) => setProgress(Math.round(p * 100)),
|
||||
});
|
||||
} catch (error) {
|
||||
setError(
|
||||
error instanceof Error ? error.message : "Failed to upload file",
|
||||
);
|
||||
console.error("Error uploading file:", error);
|
||||
} finally {
|
||||
setIsUploading(false);
|
||||
}
|
||||
};
|
||||
|
||||
if (me?.profile?.file == null) {
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div
|
||||
className="flex flex-col border-2 border-dashed border-stone-400 h-48 items-center justify-center bg-stone-100 m-5 rounded-md"
|
||||
ref={dragAndDropElementRef}
|
||||
onDragEnter={onDragEnter}
|
||||
onDragOver={onDragOver}
|
||||
onDragLeave={onDragLeave}
|
||||
onDrop={onDrop}
|
||||
>
|
||||
<p>Drag & drop your file here</p>
|
||||
</div>
|
||||
<form onSubmit={handleUpload} className="flex gap-2">
|
||||
<input
|
||||
className="bg-stone-100 py-1.5 px-2 text-sm rounded-md w-4/5"
|
||||
ref={inputRef}
|
||||
type="file"
|
||||
accept="file"
|
||||
onChange={() => setError(null)}
|
||||
disabled={isUploading}
|
||||
/>
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md disabled:opacity-50"
|
||||
disabled={isUploading}
|
||||
>
|
||||
{isUploading ? `Uploading...` : "Upload file"}
|
||||
</button>
|
||||
</form>
|
||||
{error && (
|
||||
<div className="text-red-800 text-sm pl-4" role="alert">
|
||||
{error}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isUploading && (
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="py-1.5 px-3 text-sm">Progress: {progress}%</div>
|
||||
<div className="h-2 bg-stone-200 rounded-full flex-1">
|
||||
<div
|
||||
className="h-full bg-blue-500 rounded-full transition-all duration-300"
|
||||
style={{ width: `${progress}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const fileData = me?.profile?.file?.getChunks();
|
||||
const mimeType = fileData?.mimeType || "unknown";
|
||||
|
||||
return (
|
||||
<div className="gap-2">
|
||||
<div className="p-4">
|
||||
<div className="space-y-2">
|
||||
<div className="flex justify-between">
|
||||
<span className="font-bold">File name</span>
|
||||
<span>{fileData?.fileName}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="font-bold">Type</span>
|
||||
<span>{mimeType}</span>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span className="font-bold">Size</span>
|
||||
<span>{formatFileSize(fileData?.totalSizeBytes)}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 justify-end">
|
||||
<button
|
||||
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md"
|
||||
onClick={handleDelete}
|
||||
>
|
||||
Delete file
|
||||
</button>
|
||||
|
||||
<button
|
||||
className="bg-stone-100 py-1.5 px-3 text-sm rounded-md"
|
||||
onClick={handleDownload}
|
||||
>
|
||||
Download file
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="w-full justify-center pt-8">
|
||||
{fileData?.mimeType?.startsWith("image/") && (
|
||||
<div className="flex justify-center">
|
||||
<img
|
||||
src={URL.createObjectURL(
|
||||
me?.profile?.file?.toBlob() || new Blob(),
|
||||
)}
|
||||
alt="File preview"
|
||||
className="max-w-xs mb-4"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{fileData?.mimeType?.startsWith("audio/") && (
|
||||
<div className="flex justify-center">
|
||||
<audio
|
||||
src={URL.createObjectURL(
|
||||
me?.profile?.file?.toBlob() || new Blob(),
|
||||
)}
|
||||
controls
|
||||
className="w-full mb-4"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{fileData?.mimeType?.startsWith("video/") && (
|
||||
<div className="flex justify-center">
|
||||
<video
|
||||
src={URL.createObjectURL(
|
||||
me?.profile?.file?.toBlob() || new Blob(),
|
||||
)}
|
||||
controls
|
||||
className="w-full mb-4"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
21
examples/filestream/src/Logo.tsx
Normal file
21
examples/filestream/src/Logo.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
export function Logo() {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 386 146"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
className="text-black w-48 mx-auto"
|
||||
>
|
||||
<path
|
||||
d="M176.725 33.865H188.275V22.7H176.725V33.865ZM164.9 129.4H172.875C182.72 129.4 188.275 123.9 188.275 114.22V43.6H176.725V109.545C176.725 115.65 173.975 118.51 167.925 118.51H164.9V129.4ZM245.298 53.28C241.613 45.47 233.363 41.95 222.748 41.95C208.998 41.95 200.748 48.44 197.888 58.615L208.613 61.915C210.648 55.315 216.368 52.565 222.638 52.565C231.933 52.565 235.673 56.415 236.058 64.61C226.433 65.93 216.643 67.195 209.768 69.23C200.583 72.145 195.743 77.865 195.743 86.83C195.743 96.51 202.673 104.65 215.818 104.65C225.443 104.65 232.318 101.35 237.213 94.365V103H247.388V66.425C247.388 61.475 247.168 57.185 245.298 53.28ZM217.853 95.245C210.483 95.245 207.128 91.34 207.128 86.72C207.128 82.045 210.593 79.515 215.323 77.92C220.328 76.435 226.983 75.5 235.948 74.18C235.893 76.93 235.673 80.725 234.738 83.475C233.418 89.25 227.643 95.245 217.853 95.245ZM251.22 103H301.545V92.715H269.535L303.195 45.47V43.6H254.3V53.885H284.935L251.22 101.185V103ZM304.815 103H355.14V92.715H323.13L356.79 45.47V43.6H307.895V53.885H338.53L304.815 101.185V103Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M136.179 44.8277C136.179 44.8277 136.179 44.8277 136.179 44.8276V21.168C117.931 28.5527 97.9854 32.6192 77.0897 32.6192C65.1466 32.6192 53.5138 31.2908 42.331 28.7737V51.4076C42.331 51.4076 42.331 51.4076 42.331 51.4076V81.1508C41.2955 80.4385 40.1568 79.8458 38.9405 79.3915C36.1732 78.358 33.128 78.0876 30.1902 78.6145C27.2524 79.1414 24.5539 80.4419 22.4358 82.3516C20.3178 84.2613 18.8754 86.6944 18.291 89.3433C17.7066 91.9921 18.0066 94.7377 19.1528 97.2329C20.2991 99.728 22.2403 101.861 24.7308 103.361C27.2214 104.862 30.1495 105.662 33.1448 105.662H33.1455C33.6061 105.662 33.8365 105.662 34.0314 105.659C44.5583 105.449 53.042 96.9656 53.2513 86.4386C53.2534 86.3306 53.2544 86.2116 53.2548 86.0486H53.2552V85.7149L53.2552 85.5521V82.0762L53.2552 53.1993C61.0533 54.2324 69.0092 54.7656 77.0897 54.7656C77.6696 54.7656 78.2489 54.7629 78.8276 54.7574V110.696C77.792 109.983 76.6533 109.391 75.437 108.936C72.6697 107.903 69.6246 107.632 66.6867 108.159C63.7489 108.686 61.0504 109.987 58.9323 111.896C56.8143 113.806 55.3719 116.239 54.7875 118.888C54.2032 121.537 54.5031 124.283 55.6494 126.778C56.7956 129.273 58.7368 131.405 61.2273 132.906C63.7179 134.406 66.646 135.207 69.6414 135.207C70.1024 135.207 70.3329 135.207 70.5279 135.203C81.0548 134.994 89.5385 126.51 89.7478 115.983C89.7517 115.788 89.7517 115.558 89.7517 115.097V111.621L89.7517 54.3266C101.962 53.4768 113.837 51.4075 125.255 48.2397V80.9017C124.219 80.1894 123.081 79.5966 121.864 79.1424C119.097 78.1089 116.052 77.8384 113.114 78.3653C110.176 78.8922 107.478 80.1927 105.36 82.1025C103.242 84.0122 101.799 86.4453 101.215 89.0941C100.631 91.743 100.931 94.4886 102.077 96.9837C103.223 99.4789 105.164 101.612 107.655 103.112C110.145 104.612 113.073 105.413 116.069 105.413C116.53 105.413 116.76 105.413 116.955 105.409C127.482 105.2 135.966 96.7164 136.175 86.1895C136.179 85.9945 136.179 85.764 136.179 85.3029V81.8271L136.179 44.8277Z"
|
||||
fill="#3313F7"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
1
examples/filestream/src/apiKey.ts
Normal file
1
examples/filestream/src/apiKey.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const apiKey = "filestream-example-jazz@garden.co";
|
||||
3
examples/filestream/src/index.css
Normal file
3
examples/filestream/src/index.css
Normal file
@@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
29
examples/filestream/src/main.tsx
Normal file
29
examples/filestream/src/main.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { JazzProvider } from "jazz-react";
|
||||
import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App.tsx";
|
||||
import { apiKey } from "./apiKey.ts";
|
||||
import "./index.css";
|
||||
import { JazzAccount } from "./schema.ts";
|
||||
|
||||
// We use this to identify the app in the passkey auth
|
||||
export const APPLICATION_NAME = "Jazz File Stream Example";
|
||||
|
||||
declare module "jazz-react" {
|
||||
export interface Register {
|
||||
Account: JazzAccount;
|
||||
}
|
||||
}
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
<StrictMode>
|
||||
<JazzProvider
|
||||
sync={{
|
||||
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
|
||||
}}
|
||||
AccountSchema={JazzAccount}
|
||||
>
|
||||
<App />
|
||||
</JazzProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
14
examples/filestream/src/schema.ts
Normal file
14
examples/filestream/src/schema.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Account, FileStream, Profile, co } from "jazz-tools";
|
||||
|
||||
export class JazzProfile extends Profile {
|
||||
file = co.ref(FileStream, { optional: true });
|
||||
}
|
||||
|
||||
export class JazzAccount extends Account {
|
||||
profile = co.ref(JazzProfile);
|
||||
|
||||
/** The account migration is run on account creation and on every log-in.
|
||||
* You can use it to set up the account root and any other initial CoValues you need.
|
||||
*/
|
||||
migrate(this: JazzAccount) {}
|
||||
}
|
||||
1
examples/filestream/src/vite-env.d.ts
vendored
Normal file
1
examples/filestream/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
23
examples/filestream/tailwind.config.ts
Normal file
23
examples/filestream/tailwind.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { Config } from "tailwindcss";
|
||||
|
||||
const config: Config = {
|
||||
content: ["./index.html", "./src/**/*.{js,ts,jsx,tsx}"],
|
||||
theme: {
|
||||
extend: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: {
|
||||
DEFAULT: "0.75rem",
|
||||
sm: "1rem",
|
||||
},
|
||||
screens: {
|
||||
lg: "600px",
|
||||
xl: "600px",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
} as const;
|
||||
|
||||
export default config;
|
||||
9
examples/filestream/tests/starter.spec.ts
Normal file
9
examples/filestream/tests/starter.spec.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("home page loads", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
await expect(page.getByText("Welcome!")).toBeVisible();
|
||||
|
||||
await page.getByLabel("Name").fill("Bob");
|
||||
await expect(page.getByText("Welcome, Bob!")).toBeVisible();
|
||||
});
|
||||
24
examples/filestream/tsconfig.app.json
Normal file
24
examples/filestream/tsconfig.app.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
examples/filestream/tsconfig.json
Normal file
7
examples/filestream/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||
22
examples/filestream/tsconfig.node.json
Normal file
22
examples/filestream/tsconfig.node.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2023"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"isolatedModules": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
8
examples/filestream/vercel.json
Normal file
8
examples/filestream/vercel.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"build": {
|
||||
"env": {
|
||||
"APP_NAME": "filestream"
|
||||
}
|
||||
},
|
||||
"ignoreCommand": "node ../../ignore-vercel-build.js"
|
||||
}
|
||||
7
examples/filestream/vite.config.ts
Normal file
7
examples/filestream/vite.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
});
|
||||
@@ -1,5 +1,16 @@
|
||||
# form
|
||||
|
||||
## 0.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser-media-images@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "form",
|
||||
"private": true,
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# image-upload
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser-media-images@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-upload",
|
||||
"private": true,
|
||||
"version": "0.0.59",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-inspector
|
||||
|
||||
## 0.0.113
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7f036c1]
|
||||
- cojson@0.11.4
|
||||
- cojson-transport-ws@0.11.4
|
||||
|
||||
## 0.0.112
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-inspector-app",
|
||||
"private": true,
|
||||
"version": "0.0.112",
|
||||
"version": "0.0.113",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -16,8 +16,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.11.3",
|
||||
"cojson-transport-ws": "workspace:0.11.3",
|
||||
"cojson": "workspace:0.11.4",
|
||||
"cojson-transport-ws": "workspace:0.11.4",
|
||||
"hash-slash": "workspace:0.2.2",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# multiauth
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
- jazz-react-auth-clerk@0.11.4
|
||||
|
||||
## 0.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "multiauth",
|
||||
"private": true,
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.3",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d133d47]
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- Updated dependencies [e902405]
|
||||
- jazz-inspector@0.11.4
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.83",
|
||||
"version": "0.0.84",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -22,8 +22,8 @@
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-inspector": "workspace:*",
|
||||
"jazz-react": "workspace:0.11.3",
|
||||
"jazz-tools": "workspace:0.11.3",
|
||||
"jazz-react": "workspace:0.11.4",
|
||||
"jazz-tools": "workspace:0.11.4",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
@@ -194,3 +194,16 @@ export async function onAnonymousAccountDiscarded(
|
||||
me.root.rootPlaylist.tracks.push(track);
|
||||
}
|
||||
}
|
||||
|
||||
export async function deletePlaylist(playlistId: string) {
|
||||
const { root } = await MusicaAccount.getMe().ensureLoaded({
|
||||
root: {
|
||||
playlists: [],
|
||||
},
|
||||
});
|
||||
|
||||
const index = root.playlists.findIndex((p) => p?.id === playlistId);
|
||||
if (index > -1) {
|
||||
root.playlists.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,16 @@ export function MusicTrackRow({
|
||||
removeTrackFromPlaylist(playlist, track);
|
||||
}
|
||||
|
||||
function deleteTrack() {
|
||||
if (!me || !track) return;
|
||||
const tracks = me.root.rootPlaylist?.tracks;
|
||||
if (!tracks) return;
|
||||
const index = tracks.findIndex((t) => t?.id === trackId);
|
||||
if (index !== -1) {
|
||||
tracks.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<li
|
||||
className={
|
||||
@@ -90,6 +100,15 @@ export function MusicTrackRow({
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem
|
||||
key={`delete`}
|
||||
onSelect={async () => {
|
||||
if (!track) return;
|
||||
deleteTrack();
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
{playlists.map((playlist, index) => (
|
||||
<Fragment key={index}>
|
||||
<DropdownMenuItem
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { deletePlaylist } from "@/4_actions";
|
||||
import { useAccount } from "jazz-react";
|
||||
import { Trash2 } from "lucide-react";
|
||||
import { useNavigate, useParams } from "react-router";
|
||||
import { LocalOnlyTag } from "./LocalOnlyTag";
|
||||
|
||||
@@ -24,6 +26,13 @@ export function SidePanel() {
|
||||
navigate(`/playlist/${playlistId}`);
|
||||
}
|
||||
|
||||
async function handleDeletePlaylist(playlistId: string) {
|
||||
if (confirm("Are you sure you want to delete this playlist?")) {
|
||||
await deletePlaylist(playlistId);
|
||||
navigate(`/`);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<aside className="w-64 p-6 bg-white overflow-y-auto">
|
||||
<div className="flex items-center mb-1">
|
||||
@@ -65,18 +74,28 @@ export function SidePanel() {
|
||||
</a>
|
||||
</li>
|
||||
{me?.root.playlists.map((playlist, index) => (
|
||||
<li key={index}>
|
||||
<li
|
||||
key={index}
|
||||
className={`px-2 py-1 flex transition-all duration-300 rounded items-center justify-between ${
|
||||
playlist.id === playlistId ? "bg-blue-100" : ""
|
||||
}`}
|
||||
>
|
||||
<a
|
||||
href="#"
|
||||
className={`block px-2 py-1 text-sm rounded ${
|
||||
playlist.id === playlistId
|
||||
? "bg-blue-100 text-blue-600"
|
||||
: "hover:bg-blue-100"
|
||||
}`}
|
||||
className={`w-full text-sm`}
|
||||
onClick={(evt) => handlePlaylistClick(evt, playlist.id)}
|
||||
>
|
||||
{playlist.title}
|
||||
</a>
|
||||
{playlist.id === playlistId && (
|
||||
<button
|
||||
onClick={() => handleDeletePlaylist(playlist.id)}
|
||||
className="ml-2 text-red-600 hover:text-red-800 animate-in fade-in scale-in duration-200"
|
||||
aria-label={`Delete ${playlist.title}`}
|
||||
>
|
||||
<Trash2 size={16} />
|
||||
</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# organization
|
||||
|
||||
## 0.0.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.55
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "organization",
|
||||
"private": true,
|
||||
"version": "0.0.55",
|
||||
"version": "0.0.56",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# passkey-svelte
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-svelte@0.11.4
|
||||
|
||||
## 0.0.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "passkey-svelte",
|
||||
"version": "0.0.49",
|
||||
"version": "0.0.50",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# minimal-auth-passkey
|
||||
|
||||
## 0.0.61
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passkey",
|
||||
"private": true,
|
||||
"version": "0.0.60",
|
||||
"version": "0.0.61",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# passphrase
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passphrase",
|
||||
"private": true,
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.58",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.81",
|
||||
"version": "0.0.82",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -12,8 +12,8 @@
|
||||
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"jazz-react": "workspace:0.11.3",
|
||||
"jazz-tools": "workspace:0.11.3",
|
||||
"jazz-react": "workspace:0.11.4",
|
||||
"jazz-tools": "workspace:0.11.4",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "^7.41.5",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.180
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser-media-images@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.179
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.179",
|
||||
"version": "0.0.180",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -19,9 +19,9 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-browser-media-images": "workspace:0.11.3",
|
||||
"jazz-react": "workspace:0.11.3",
|
||||
"jazz-tools": "workspace:0.11.3",
|
||||
"jazz-browser-media-images": "workspace:0.11.4",
|
||||
"jazz-react": "workspace:0.11.4",
|
||||
"jazz-tools": "workspace:0.11.4",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
@@ -41,7 +41,7 @@
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"is-ci": "^3.0.1",
|
||||
"jazz-run": "workspace:0.11.3",
|
||||
"jazz-run": "workspace:0.11.4",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# reactions
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser-media-images@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactions",
|
||||
"private": true,
|
||||
"version": "0.0.59",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# todo-vue
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-browser@0.11.4
|
||||
- jazz-vue@0.11.4
|
||||
|
||||
## 0.0.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todo-vue",
|
||||
"version": "0.0.63",
|
||||
"version": "0.0.64",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.179
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.178
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.178",
|
||||
"version": "0.0.179",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -16,8 +16,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-react": "workspace:0.11.3",
|
||||
"jazz-tools": "workspace:0.11.3",
|
||||
"jazz-react": "workspace:0.11.4",
|
||||
"jazz-tools": "workspace:0.11.4",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# version-history
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [d133d47]
|
||||
- Updated dependencies [57a3dbe]
|
||||
- Updated dependencies [a717754]
|
||||
- Updated dependencies [a91f343]
|
||||
- Updated dependencies [e902405]
|
||||
- jazz-inspector@0.11.4
|
||||
- jazz-tools@0.11.4
|
||||
- jazz-react@0.11.4
|
||||
|
||||
## 0.0.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "version-history",
|
||||
"private": true,
|
||||
"version": "0.0.56",
|
||||
"version": "0.0.57",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -12,6 +12,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/forms": "^0.5.9",
|
||||
"jazz-inspector": "workspace:*",
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -80,7 +80,7 @@ export function IssueVersionHistory({ id }: { id: ID<Issue> }) {
|
||||
<div className="flex flex-col text-sm gap-2">
|
||||
<h2 className="sr-only">Edits</h2>
|
||||
{edits.map((edit, i) => (
|
||||
<div>
|
||||
<div key={i}>
|
||||
<p className="text-xs text-stone-400">
|
||||
{edit.madeAt.toLocaleString()}
|
||||
</p>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { StrictMode } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App.tsx";
|
||||
import "./index.css";
|
||||
import { JazzInspector } from "jazz-inspector";
|
||||
import { apiKey } from "./apiKey.ts";
|
||||
|
||||
createRoot(document.getElementById("root")!).render(
|
||||
@@ -16,6 +17,7 @@ createRoot(document.getElementById("root")!).render(
|
||||
<DemoAuthBasicUI appName="Jazz Version History Example">
|
||||
<App />
|
||||
</DemoAuthBasicUI>
|
||||
<JazzInspector position="bottom right" />
|
||||
</JazzProvider>
|
||||
</StrictMode>,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
export function JazzIcon({ className }: { className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
className={className}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="125"
|
||||
height="125"
|
||||
viewBox="0 0 125 125"
|
||||
fill="none"
|
||||
>
|
||||
<rect width="125" height="125" fill="white" />
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M118.179 29.6597V6C99.931 13.3847 79.9854 17.4512 59.0897 17.4512C47.1466 17.4512 35.5138 16.1228 24.331 13.6057V36.2396V65.9828C23.2955 65.2705 22.1568 64.6778 20.9405 64.2235C18.1732 63.19 15.128 62.9196 12.1902 63.4465C9.25242 63.9734 6.55392 65.2739 4.43582 67.1836C2.31782 69.0933 0.875416 71.5264 0.291016 74.1753C-0.293384 76.8241 0.00661504 79.5697 1.15281 82.0649C2.29911 84.56 4.24032 86.693 6.73082 88.193C9.22142 89.694 12.1495 90.494 15.1448 90.494C15.6054 90.494 15.8365 90.494 16.0314 90.491C26.5583 90.281 35.042 81.7976 35.2513 71.2706C35.2534 71.1626 35.2544 71.0436 35.2548 70.8806L35.2552 70.5469V70.3841V66.9082V38.0313C43.0533 39.0644 51.0092 39.5976 59.0897 39.5976C59.6696 39.5976 60.2489 39.5949 60.8276 39.5894V95.528C59.792 94.815 58.6533 94.223 57.437 93.768C54.6697 92.735 51.6246 92.464 48.6867 92.991C45.7489 93.518 43.0504 94.819 40.9323 96.728C38.8143 98.638 37.3719 101.071 36.7875 103.72C36.2032 106.369 36.5031 109.115 37.6494 111.61C38.7956 114.105 40.7368 116.237 43.2273 117.738C45.7179 119.238 48.646 120.039 51.6414 120.039C52.1024 120.039 52.3329 120.039 52.5279 120.035C63.0548 119.826 71.5385 111.342 71.7478 100.815C71.7517 100.62 71.7517 100.39 71.7517 99.929V96.453V39.1586C83.962 38.3088 95.837 36.2395 107.255 33.0717V65.7337C106.219 65.0214 105.081 64.4286 103.864 63.9744C101.097 62.9409 98.052 62.6704 95.114 63.1973C92.176 63.7242 89.478 65.0247 87.36 66.9345C85.242 68.8442 83.799 71.2773 83.215 73.9261C82.631 76.575 82.931 79.3206 84.077 81.8157C85.223 84.3109 87.164 86.444 89.655 87.944C92.145 89.444 95.073 90.245 98.069 90.245C98.53 90.245 98.76 90.245 98.955 90.241C109.482 90.032 117.966 81.5484 118.175 71.0215C118.179 70.8265 118.179 70.596 118.179 70.1349V66.6591V29.6597Z"
|
||||
fill="#3313F7"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -3,19 +3,20 @@ import { packages } from "@/lib/packages";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
interface Props {
|
||||
params: { package: string };
|
||||
params: Promise<{ package: string }>;
|
||||
}
|
||||
|
||||
export default function Page({ params }: Props) {
|
||||
if (!packages.map((p) => p.name).includes(params.package)) {
|
||||
export default async function Page({ params }: Props) {
|
||||
const packageName = (await params).package;
|
||||
if (!packages.map((p) => p.name).includes(packageName)) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
return <PackageDocs package={params.package} />;
|
||||
return <PackageDocs package={packageName} />;
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: Props) {
|
||||
const packageName = params.package;
|
||||
const packageName = (await params).package;
|
||||
return {
|
||||
title: `${packageName} - jazz`,
|
||||
description: `API reference for ${packageName}.`,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CodeGroup } from '@/components/forMdx'
|
||||
import { JazzIcon } from "gcmp-design-system/src/app/components/atoms/logos/JazzIcon";
|
||||
|
||||
# Jazz Inspector
|
||||
|
||||
@@ -27,7 +28,7 @@ npm install jazz-inspector
|
||||
Render the component within your `JazzProvider`.
|
||||
|
||||
<CodeGroup>
|
||||
```sh
|
||||
```tsx
|
||||
import { JazzInspector } from "jazz-inspector";
|
||||
|
||||
<JazzProvider> // old
|
||||
@@ -36,4 +37,32 @@ import { JazzInspector } from "jazz-inspector";
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
This will show the Inspector launch button on the right of your page.
|
||||
|
||||
### Positioning the Inspector button
|
||||
|
||||
You can also customize the button position with the following options:
|
||||
|
||||
- right (default)
|
||||
- left
|
||||
- bottom right
|
||||
- bottom left
|
||||
- top right
|
||||
- top left
|
||||
|
||||
For example:
|
||||
<CodeGroup>
|
||||
```tsx
|
||||
<JazzInspector position="bottom left"/>
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
<div className="bg-stone-200 flex items-center justify-center h-72 relative dark:bg-stone-900 mt-5">
|
||||
<span>Your app</span>
|
||||
|
||||
<button className="size-10 p-1.5 border rounded-lg left-4 bottom-4 absolute bg-white shadow-sm" type="button">
|
||||
<JazzIcon className="w-full h-auto"/>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Check out the [music player app](https://github.com/garden-co/jazz/blob/main/examples/music-player/src/2_main.tsx) for a full example.
|
||||
|
||||
@@ -7,16 +7,19 @@ import type { Toc } from "@stefanprobst/rehype-extract-toc";
|
||||
import { Prose } from "gcmp-design-system/src/app/components/molecules/Prose";
|
||||
|
||||
async function getMdxSource(slugPath: string, framework: string) {
|
||||
// Try to import the framework-specific file first
|
||||
try {
|
||||
return await import(`./${slugPath}.mdx`);
|
||||
} catch (error) {
|
||||
return await import(`./${slugPath}/${framework}.mdx`);
|
||||
} catch (error) {
|
||||
// Fallback to vanilla
|
||||
return await import(`./${slugPath}.mdx`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params: { slug, framework },
|
||||
}: { params: { slug: string[]; framework: string } }) {
|
||||
params,
|
||||
}: { params: Promise<{ slug: string[]; framework: string }> }) {
|
||||
const { slug, framework } = await params;
|
||||
const slugPath = slug.join("/");
|
||||
try {
|
||||
const mdxSource = await getMdxSource(slugPath, framework);
|
||||
@@ -39,8 +42,9 @@ export async function generateMetadata({
|
||||
}
|
||||
|
||||
export default async function Page({
|
||||
params: { slug, framework },
|
||||
}: { params: { slug: string[]; framework: string } }) {
|
||||
params,
|
||||
}: { params: Promise<{ slug: string[]; framework: string }> }) {
|
||||
const { slug, framework } = await params;
|
||||
const slugPath = slug.join("/");
|
||||
const bodyClassName = "overflow-x-hidden lg:flex-1 py-10 max-w-3xl mx-auto";
|
||||
|
||||
|
||||
@@ -32,6 +32,13 @@ export class MyAppRoot extends CoMap {
|
||||
myChats = co.ref(ListOfChats);
|
||||
myContacts = co.ref(ListOfAccounts);
|
||||
}
|
||||
|
||||
// Register the Account schema so `useAccount` returns our custom `MyAppAccount`
|
||||
declare module "jazz-react" {
|
||||
interface Register {
|
||||
Account: MyAppAccount;
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -92,6 +99,13 @@ export class MyAppProfile extends Profile {
|
||||
name = co.string; // compatible with default Profile schema
|
||||
avatar = co.optional.ref(ImageDefinition);
|
||||
}
|
||||
|
||||
// Register the Account schema so `useAccount` returns our custom `MyAppAccount` // old
|
||||
declare module "jazz-react" {// old
|
||||
interface Register {// old
|
||||
Account: MyAppAccount;// old
|
||||
}// old
|
||||
}// old
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class ListOfTasks extends CoList.Of(co.ref(Task)) {}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
To instantiate a CoList:
|
||||
To create a `CoList`:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
@@ -61,40 +61,69 @@ console.log(todoTasks.length); // 1
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Writing to CoLists
|
||||
## Updating CoLists
|
||||
|
||||
CoLists support all the standard JavaScript array mutation methods:
|
||||
Update `CoList`s just like you would JavaScript arrays:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
// Add items
|
||||
resources.push("Courgette"); // Add to end
|
||||
resources.unshift("Lettuce"); // Add to beginning
|
||||
|
||||
console.log(resources);
|
||||
// ["Lettuce", "Tomatoes", "Basil", "Peppers", "Courgette"]
|
||||
|
||||
// Add complex items to lists of references
|
||||
tasks.push(Task.create({
|
||||
title: "Install irrigation system",
|
||||
resources.push("Tomatoes"); // Add to end
|
||||
resources.unshift("Lettuce"); // Add to beginning
|
||||
tasks.push(Task.create({ // Add complex items
|
||||
title: "Install irrigation",
|
||||
status: "todo"
|
||||
}));
|
||||
|
||||
// Remove items
|
||||
resources.pop(); // Remove last item
|
||||
resources.shift(); // Remove first item
|
||||
resources.splice(1, 2); // Remove items at index 1 and 2
|
||||
|
||||
// Replace items
|
||||
resources[0] = "Cucumber"; // Replace first item
|
||||
resources[0] = "Cucumber"; // Replace by index
|
||||
|
||||
console.log(resources); // ["Cucumber"]
|
||||
|
||||
// Modify items in a list of references
|
||||
tasks[0].status = "in-progress"; // Modify a property of an item
|
||||
// Modify nested items
|
||||
tasks[0].status = "complete"; // Update properties of references
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Deleting Items
|
||||
|
||||
Remove specific items by index with `splice`, or remove the first or last item with `pop` or `shift`:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
// Remove 2 items starting at index 1
|
||||
resources.splice(1, 2);
|
||||
console.log(resources); // ["Cucumber", "Peppers"]
|
||||
|
||||
// Remove a single item at index 0
|
||||
resources.splice(0, 1);
|
||||
console.log(resources); // ["Peppers"]
|
||||
|
||||
// Remove items
|
||||
const lastItem = resources.pop(); // Remove and return last item
|
||||
resources.shift(); // Remove first item
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Array Methods
|
||||
|
||||
`CoList`s support the standard JavaScript array methods you already know:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
// Add multiple items at once
|
||||
resources.push("Tomatoes", "Basil", "Peppers");
|
||||
|
||||
// Find items
|
||||
const basil = resources.find(r => r === "Basil");
|
||||
|
||||
// Filter (returns regular array, not a CoList)
|
||||
const tItems = resources.filter(r => r.startsWith("T"));
|
||||
console.log(tItems); // ["Tomatoes"]
|
||||
|
||||
// Sort (modifies the CoList in-place)
|
||||
resources.sort();
|
||||
console.log(resources); // ["Basil", "Peppers", "Tomatoes"]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Type Safety
|
||||
|
||||
@@ -102,42 +131,16 @@ CoLists maintain type safety for their items:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
// TypeScript knows each item's type
|
||||
// TypeScript catches type errors
|
||||
resources.push("Carrots"); // ✓ Valid string
|
||||
resources.push(42); // ✗ Type error: expected string
|
||||
|
||||
// For lists of references, TypeScript knows the referenced type
|
||||
// For lists of references
|
||||
tasks.forEach(task => {
|
||||
console.log(task.title); // TypeScript knows 'task' has a 'title'
|
||||
console.log(task.title); // TypeScript knows task has title
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Array Methods
|
||||
|
||||
CoLists support many standard JavaScript array methods:
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
resources.push("Tomatoes", "Basil", "Peppers");
|
||||
|
||||
// Filter
|
||||
const springResources = resources.filter(resource => resource.includes("Tomato"));
|
||||
console.log(springResources); // ["Tomatoes"]
|
||||
|
||||
// Map (creates a regular array, not a CoList)
|
||||
const resourceNames = resources.map(resource => resource.toUpperCase());
|
||||
console.log(resourceNames); // ["TOMATOES", "BASIL", "PEPPERS"]
|
||||
|
||||
// Find
|
||||
const basil = resources.find(resource => resource === "Basil");
|
||||
|
||||
// Sort (modifies the CoList in-place)
|
||||
resources.sort();
|
||||
console.log(resources); // ["Basil", "Cucumber", "Peppers", "Tomatoes"]
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Common Patterns
|
||||
|
||||
@@ -16,8 +16,6 @@ export default function Home() {
|
||||
<>
|
||||
<HeroSection />
|
||||
|
||||
<ProblemStatementSection />
|
||||
|
||||
<div className="container flex flex-col gap-12 mt-12 lg:gap-20 lg:mt-20">
|
||||
<HowJazzWorksSection />
|
||||
|
||||
@@ -32,6 +30,8 @@ export default function Home() {
|
||||
</p>
|
||||
</Testimonial>
|
||||
|
||||
<ProblemStatementSection />
|
||||
|
||||
<ChatDemoSection />
|
||||
|
||||
<LocalFirstFeaturesSection />
|
||||
@@ -61,8 +61,8 @@ export default function Cloud() {
|
||||
</div>
|
||||
|
||||
<div className="bg-stone-100 border-y dark:bg-stone-925 py-8 lg:py-16 dark:border-y-0 dark:bg-transparent dark:py-0">
|
||||
<div className="container">
|
||||
<H2 className="mb-5 sm:text-center md:text-left">Pricing</H2>
|
||||
<div className="container space-y-5">
|
||||
<H2>Pricing</H2>
|
||||
|
||||
<Pricing />
|
||||
</div>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#### How are sync-minutes counted?
|
||||
|
||||
Sync-minutes are counted on a **per-connected-device, per-minute basis.**<br/>
|
||||
A device is considered syncing **only when it's actively sending or receiving data.**
|
||||
|
||||
#### How can I estimate my usage?
|
||||
|
||||
The best way to estimate your usage is to **guess how many minutes per month each user will spend actively using your app.**
|
||||
Storage is mostly determined by large binary blobs (like images or videos) that you store in Jazz.
|
||||
|
||||
#### What happens if I exceed my plan's limits?
|
||||
|
||||
All limits are initially soft limits, so don't worry if you suddenly get lots of users or traffic!
|
||||
|
||||
Sync beyond the limit is still served, but at a lower priority.
|
||||
Data beyond the storage limit is still stored and backed up, but may be significantly slower to access.
|
||||
If you exceed your plan's limits consistently, we'll reach out to discuss upgrading your plan.
|
||||
@@ -213,6 +213,30 @@ const ImageUploadIllustration = () => (
|
||||
</div>
|
||||
);
|
||||
|
||||
const FileUploadIllustration = () => (
|
||||
<div className="flex flex-col items-center justify-center h-full p-8">
|
||||
<div className="p-3 w-[12rem] h-[8rem] border border-dashed border-blue dark:border-blue-500 rounded-lg flex gap-2 flex-col items-center justify-center">
|
||||
<Icon
|
||||
name="upload"
|
||||
size="4xl"
|
||||
className="stroke-blue mx-auto dark:stroke-blue-500"
|
||||
/>
|
||||
<p className="whitespace-nowrap text-stone-900 dark:text-white">
|
||||
take-five.mp3
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className=" w-[12rem] h-2 rounded-full overflow-hidden bg-stone-200 mt-3">
|
||||
<div className="w-3/4 h-full bg-green-500"/>
|
||||
</div>
|
||||
<div className="w-[12rem] flex justify-between text-xs mt-1.5">
|
||||
<p>Uploading...</p>
|
||||
|
||||
<p>76%</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const ReactionsIllustration = () => (
|
||||
<div className="flex bg-stone-100 h-full flex-col items-center justify-center dark:bg-transparent">
|
||||
<div className="inline-flex justify-center gap-1.5 mx-auto">
|
||||
@@ -346,12 +370,21 @@ const reactExamples: Example[] = [
|
||||
{
|
||||
name: "Image upload",
|
||||
slug: "image-upload",
|
||||
description: "Learn how to upload and delete images",
|
||||
description: "Learn how to upload and delete images.",
|
||||
tech: [tech.react],
|
||||
features: [features.imageUpload],
|
||||
demoUrl: "https://image-upload-demo.jazz.tools",
|
||||
illustration: <ImageUploadIllustration />,
|
||||
},
|
||||
{
|
||||
name: "File upload",
|
||||
slug: "filestream",
|
||||
description: "Upload different types of files, and show upload progress, file size, and type.",
|
||||
tech: [tech.react],
|
||||
features: [features.fileUpload],
|
||||
demoUrl: "https://file-upload-demo.jazz.tools",
|
||||
illustration: <FileUploadIllustration />,
|
||||
},
|
||||
{
|
||||
name: "Reactions",
|
||||
slug: "reactions",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import LatencyChart from "@/components/LatencyChart";
|
||||
import { clsx } from "clsx";
|
||||
import { HeroHeader } from "gcmp-design-system/src/app/components/molecules/HeroHeader";
|
||||
import type { Metadata } from "next";
|
||||
@@ -13,10 +14,6 @@ export const metadata: Metadata = {
|
||||
},
|
||||
};
|
||||
|
||||
const LatencyChart = dynamic(() => import("@/components/LatencyChart"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
interface DataRow {
|
||||
up: boolean;
|
||||
latencyOverTime: [number[], number[]];
|
||||
|
||||
@@ -7,7 +7,7 @@ import { pingColorThresholds } from "../../../components/cloud/pingColorThreshol
|
||||
// generated with: globalping ping cloud.jazz.tools from world --limit 500 --packets 16 --json | jq "del(.results[].result.rawOutput)" > pings.json
|
||||
import pings from "../../../components/cloud/pings.json";
|
||||
|
||||
export const revalidate = 2 * 60 * 60; // 2 hours
|
||||
export const revalidate = 7200; // 2 hours
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const spacing = parseFloat(req.nextUrl.searchParams.get("spacing") || "1.5");
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { Button } from "gcmp-design-system/src/app/components/atoms/Button";
|
||||
import { track } from '@vercel/analytics';
|
||||
|
||||
export function FakeGetStartedButton() {
|
||||
export function FakeGetStartedButton({ tier }: { tier: "starter" | "indie" }) {
|
||||
return (
|
||||
<Button
|
||||
onClick={() => {
|
||||
track("FakeSignUp", { tier });
|
||||
alert(
|
||||
"During the public alpha, please use your email address as the API key, as shown in the docs!",
|
||||
"During the public alpha, all limits are lifted. Please use your email address as the API key, as shown in the docs!",
|
||||
);
|
||||
window.location.pathname = "/docs";
|
||||
}}
|
||||
size="md"
|
||||
variant="primary"
|
||||
variant={tier === "starter" ? "secondary" : "primary"}
|
||||
>
|
||||
Get started
|
||||
Get {tier === "starter" ? "Starter" : "Indie"} API Key
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,21 +3,15 @@ import { Button } from "gcmp-design-system/src/app/components/atoms/Button";
|
||||
import {
|
||||
CircleCheckIcon,
|
||||
LucideBuilding2,
|
||||
LucideCheck,
|
||||
LucideChevronUp,
|
||||
LucideChevronsUp,
|
||||
LucideCloudDownload,
|
||||
LucideCrown,
|
||||
LucideDatabase,
|
||||
LucideDatabaseZap,
|
||||
LucideHammer,
|
||||
LucideHandshake,
|
||||
LucideIcon,
|
||||
LucideMessageCircle,
|
||||
LucideMicroscope,
|
||||
LucidePhone,
|
||||
LucideSearch,
|
||||
LucideTicketCheck,
|
||||
LucideInfinity,
|
||||
LucideServer,
|
||||
LucideUsers,
|
||||
LucideZap,
|
||||
} from "lucide-react";
|
||||
import { FakeGetStartedButton } from "./FakeGetStartedButton";
|
||||
import { IndieTierLogo, ProTierLogo, StarterTierLogo } from "./TierLogos";
|
||||
@@ -36,11 +30,11 @@ export function ListItem({
|
||||
const iconSize = 16;
|
||||
|
||||
const iconVariants = {
|
||||
gray: <Icon size={iconSize} className="text-stone-500 shrink-0" />,
|
||||
gray: <Icon size={iconSize} className="text-stone-500 shrink-0 mt-1" />,
|
||||
blue: (
|
||||
<Icon
|
||||
size={iconSize}
|
||||
className="text-blue-500 dark:text-white shrink-0"
|
||||
className="text-blue dark:text-white shrink-0 mt-1"
|
||||
/>
|
||||
),
|
||||
};
|
||||
@@ -48,7 +42,7 @@ export function ListItem({
|
||||
return (
|
||||
<li
|
||||
className={clsx(
|
||||
"inline-flex items-center gap-2 text-stone-800 dark:text-stone-200 py-2",
|
||||
"inline-flex gap-3 text-stone-800 dark:text-stone-200 py-2",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
@@ -60,224 +54,227 @@ export function ListItem({
|
||||
|
||||
export function Pricing() {
|
||||
return (
|
||||
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4">
|
||||
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<StarterTierLogo />
|
||||
Starter
|
||||
</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-2xl font-light tabular-nums tracking-tighter">
|
||||
$0
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h3>
|
||||
|
||||
<p className="text-sm">Everything you need for brand new projects.</p>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Limits (lifted during public alpha)
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideUsers} variant="gray">
|
||||
<s className="text-stone-500">max. 100 monthly active users</s>
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabase} variant="gray">
|
||||
<s className="text-stone-500">max. 10 GB storage</s>
|
||||
</ListItem>
|
||||
<ListItem icon={LucideCloudDownload} variant="gray">
|
||||
<s className="text-stone-500">max. 2 GB egress/mo</s>
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Cloud features
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideCheck}>Real-time sync</ListItem>
|
||||
<ListItem icon={LucideDatabase}>Cloud storage</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Support
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideMessageCircle}>Community support</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<FakeGetStartedButton />
|
||||
|
||||
<p className="text-sm">No credit card required.</p>
|
||||
</div>
|
||||
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<div>
|
||||
<>
|
||||
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4 mb-10">
|
||||
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<IndieTierLogo />
|
||||
Indie
|
||||
<StarterTierLogo />
|
||||
Starter
|
||||
</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-2xl font-light tabular-nums tracking-tighter">
|
||||
$19
|
||||
$0
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<p className="text-sm">
|
||||
Get robust real-time infra at predictable costs.
|
||||
</p>
|
||||
<p className="text-sm">Everything you need to get started.</p>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Limits & extra usage
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideUsers}>
|
||||
max. 10,000 monthly active users
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabase}>
|
||||
incl. 500 GB storage{" "}
|
||||
<span className="text-sm text-stone-900 dark:text-white">
|
||||
(then $0.02 per GB)
|
||||
</span>
|
||||
</ListItem>
|
||||
<ListItem icon={LucideCloudDownload}>
|
||||
incl. 100 GB egress/mo{" "}
|
||||
<span className="text-sm text-stone-900 dark:text-white">
|
||||
(then $0.1 per GB)
|
||||
</span>
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Cloud features
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideZap}>Priority real-time sync</ListItem>
|
||||
<ListItem icon={LucideDatabaseZap}>
|
||||
SSD cloud storage & daily backups
|
||||
</ListItem>
|
||||
<ListItem icon={LucideSearch}>Basic user analytics</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Support
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideMessageCircle}>Community support</ListItem>
|
||||
<ListItem icon={LucideTicketCheck}>
|
||||
Prioritised feature requests
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Button size="md" variant="secondary" disabled>
|
||||
Coming soon
|
||||
</Button>
|
||||
|
||||
<p className="text-sm">
|
||||
We've designed this tier to be affordable but also
|
||||
self-sustaining, so you can rely on it long-term.
|
||||
</p>
|
||||
</div>
|
||||
<div className="md:flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925 pb-6">
|
||||
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<ProTierLogo />
|
||||
Pro
|
||||
<div>
|
||||
<ul className="flex flex-col my-4 text-sm lg:text-base">
|
||||
<ListItem icon={LucideUsers}>
|
||||
<span className="tabular-nums">100</span> monthly active users
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabase}>
|
||||
<span className="tabular-nums">10</span> GB storage
|
||||
</ListItem>
|
||||
<ListItem icon={LucideCloudDownload}>
|
||||
<span className="tabular-nums">2</span> GB egress/mo
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-lg font-normal">from</span>{" "}
|
||||
<span className="text-2xl font-light tabular-nums tracking-tighter">
|
||||
$199
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
|
||||
<FakeGetStartedButton tier="starter"/>
|
||||
|
||||
<p className="text-sm">No credit card required. Takes 20s.</p>
|
||||
</div>
|
||||
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<div>
|
||||
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<IndieTierLogo />
|
||||
Indie
|
||||
</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-2xl font-light tabular-nums tracking-tighter">
|
||||
$4
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h3>
|
||||
</div>
|
||||
</h3>
|
||||
|
||||
<p className="text-sm">
|
||||
Get our best infra and move quickly with our help.
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
Get robust real-time infra at predictable costs.
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Limits
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideUsers}>Custom monthly active users</ListItem>
|
||||
<ListItem icon={LucideDatabase}>Custom storage</ListItem>
|
||||
<ListItem icon={LucideCloudDownload}>Custom egress</ListItem>
|
||||
</ul>
|
||||
<div>
|
||||
<ul className="flex flex-col my-4 text-sm lg:text-base">
|
||||
<ListItem icon={LucideUsers}>
|
||||
<span className="tabular-nums">10,000</span> monthly active
|
||||
users
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabase}>
|
||||
<span className="tabular-nums">100</span> GB storage incl.{" "}
|
||||
<span className="text-sm">
|
||||
(then $0.02 per GB)
|
||||
</span>
|
||||
</ListItem>
|
||||
<ListItem icon={LucideCloudDownload}>
|
||||
<span className="tabular-nums">20</span> GB egress/mo incl.{" "}
|
||||
<span className="text-sm">
|
||||
(then $0.1 per GB)
|
||||
</span>
|
||||
</ListItem>
|
||||
<hr className="my-2 border-stone-200 dark:border-stone-800" />
|
||||
<ListItem icon={LucideChevronsUp}>High-priority sync</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<FakeGetStartedButton tier="indie"/>
|
||||
|
||||
<p className="text-sm">
|
||||
One month free trial. Unlimited projects. Takes 1min.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex-1 flex flex-col gap-3 overflow-hidden rounded-xl p-6 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925 pb-6">
|
||||
<h3 className="flex justify-between items-center font-semibold text-stone-900 text-xl dark:text-white">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<ProTierLogo />
|
||||
Pro
|
||||
</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-lg font-normal">from</span>{" "}
|
||||
<span className="text-2xl font-light tabular-nums tracking-tighter">
|
||||
$199
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h3>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Cloud features
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideCrown}>
|
||||
Highest-priority real-time sync
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabaseZap}>
|
||||
SSD cloud storage & custom backups
|
||||
</ListItem>
|
||||
<ListItem icon={LucideMicroscope}>Advanced user analytics</ListItem>
|
||||
</ul>
|
||||
<p className="text-sm">
|
||||
Get our best infra and move quickly with our help.
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<ul className="flex flex-col my-4 text-sm lg:text-base">
|
||||
<ListItem icon={LucideUsers}>
|
||||
Custom monthly active users
|
||||
</ListItem>
|
||||
<ListItem icon={LucideDatabase}>
|
||||
Custom storage
|
||||
</ListItem>
|
||||
<ListItem icon={LucideCloudDownload}>
|
||||
Custom egress/mo
|
||||
</ListItem>
|
||||
<hr className="my-2 border-stone-200 dark:border-stone-800" />
|
||||
<ListItem icon={LucideHandshake}>
|
||||
Rapid integration & premium onboarding
|
||||
</ListItem>
|
||||
<ListItem icon={LucideBuilding2}>
|
||||
SLAs, certifications, dedicated support
|
||||
</ListItem>
|
||||
<ListItem icon={LucideServer}>
|
||||
Dedicated / on-prem infrastructure
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Button href="https://cal.com/anselm-io/cloud-pro-intro">
|
||||
Schedule intro call
|
||||
</Button>
|
||||
|
||||
<p className="text-sm">
|
||||
Our engineering team will get you going for free.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Support
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucidePhone}>Dedicated support</ListItem>
|
||||
<ListItem icon={LucideHammer}>Custom feature development</ListItem>
|
||||
<ListItem icon={LucideHandshake}>
|
||||
Rapid integration & premium onboarding
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold text-stone-900 dark:text-white">
|
||||
Enterprise needs
|
||||
</h4>
|
||||
<ul className="flex flex-col divide-y text-sm lg:text-base dark:divide-stone-900">
|
||||
<ListItem icon={LucideBuilding2}>
|
||||
SLAs, on-prem & certifications
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<Button href="https://cal.com/anselm-io/cloud-pro-intro" size="md">
|
||||
Book intro call
|
||||
</Button>
|
||||
|
||||
<p className="text-sm">
|
||||
Our team of devs & product experts will get you going for free. Then
|
||||
we'll make a deal just for you.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* <H3>Add-ons</H3>
|
||||
<div className="flex flex-col sm:max-w-lg mx-auto md:max-w-none md:flex-row md:items-start gap-4 mb-10">
|
||||
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
|
||||
<div className="flex items-center gap-1.5">Simple Analytics</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-xl font-light tabular-nums tracking-tighter">
|
||||
$10
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h4>
|
||||
<div>
|
||||
<ul className="flex flex-col text-sm lg:text-base">
|
||||
<ListItem icon={LucideScanSearch}>
|
||||
<span className="tabular-nums">100</span> inspected users{" "}
|
||||
<span className="text-sm text-stone-900 dark:text-white">
|
||||
(then $0.01 per user)
|
||||
</span>
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
<p className="text-sm">
|
||||
You can choose which subset of users to inspect.
|
||||
</p>
|
||||
</div>
|
||||
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
|
||||
<div className="flex items-center gap-1.5">Advanced Analytics</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-xl font-light tabular-nums tracking-tighter">
|
||||
$50
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h4>
|
||||
<div>
|
||||
<ul className="flex flex-col text-sm lg:text-base">
|
||||
<ListItem icon={LucideMicroscope}>
|
||||
<span className="tabular-nums">1,000</span> inspected users{" "}
|
||||
<span className="text-sm text-stone-900 dark:text-white">
|
||||
(then $0.05 per user)
|
||||
</span>
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
<p className="text-sm">
|
||||
You can choose which subset of users to inspect.
|
||||
</p>
|
||||
</div>
|
||||
<div className="md:flex-[2] flex flex-col gap-1 overflow-hidden rounded-xl px-6 py-4 shadow-lg shadow-gray-900/5 bg-white dark:bg-stone-925">
|
||||
<h4 className="flex justify-between items-center font-semibold text-stone-900 text-lg dark:text-white">
|
||||
<div className="flex items-center gap-1.5">Custom Sync Domain</div>
|
||||
<div className="text-stone-900 dark:text-white">
|
||||
<span className="text-xl font-light tabular-nums tracking-tighter">
|
||||
$50
|
||||
</span>
|
||||
<span className="text-sm font-normal text-stone-600 dark:text-stone-500">
|
||||
/mo
|
||||
</span>
|
||||
</div>
|
||||
</h4>
|
||||
<div>
|
||||
<ul className="flex flex-col text-sm lg:text-base">
|
||||
<ListItem icon={LucideGlobe}>
|
||||
Sync via <code>sync.yourdomain.com</code>
|
||||
</ListItem>
|
||||
</ul>
|
||||
</div>
|
||||
<p className="text-sm">
|
||||
White-labeled & friendly with complex CORS setups.
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,10 @@ const frameworks: Record<
|
||||
label: "React Native",
|
||||
experimental: false,
|
||||
},
|
||||
[Framework.Vanilla]: {
|
||||
label: "VanillaJS",
|
||||
experimental: false,
|
||||
},
|
||||
[Framework.Svelte]: {
|
||||
label: "Svelte",
|
||||
experimental: true,
|
||||
|
||||
@@ -19,8 +19,9 @@ export function DocNav({ className }: { className?: string }) {
|
||||
.map((item) => {
|
||||
if (!item.href?.startsWith("/docs")) return item;
|
||||
|
||||
const frameworkDone = (item.done as any)[framework] ?? 0;
|
||||
let done =
|
||||
typeof item.done === "number" ? item.done : item.done[framework];
|
||||
typeof item.done === "number" ? item.done : frameworkDone;
|
||||
let href = item.href.replace("/docs", `/docs/${framework}`);
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
```ts
|
||||
const message = Message.create({
|
||||
text: “Hello world!”
|
||||
}, { owner: ... })
|
||||
}, chat._owner)
|
||||
|
||||
chat.push(message)
|
||||
```
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
```tsx
|
||||
<JazzProvider
|
||||
sync={{
|
||||
peer: "wss://cloud.jazz.tools/?key=you@example.com",
|
||||
}}
|
||||
sync={{ peer: "wss://cloud.jazz.tools/?key=you@example.com" }}
|
||||
>
|
||||
{children}
|
||||
</JazzProvider>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
```tsx
|
||||
const ChatScreen = (id) => {
|
||||
const ChatScreen = ({ id }) => {
|
||||
const chat = useCoState(Chat, id)
|
||||
|
||||
return chat.messages.map(msg => (
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
```ts
|
||||
export class Message extends CoMap {
|
||||
class Message extends CoMap {
|
||||
text = co.string;
|
||||
}
|
||||
|
||||
export class Chat extends CoList.Of(
|
||||
co.ref(Message)
|
||||
) {}
|
||||
class Chat extends CoList.Of(co.ref(Message)) {}
|
||||
```
|
||||
|
||||
|
||||
@@ -10,18 +10,18 @@ const data = [
|
||||
{
|
||||
title: "Private",
|
||||
description:
|
||||
"Create a CoValue visible only to you by assigning your Account as an owner.",
|
||||
"By default, CoValues are visible only to you.",
|
||||
codeSample: CollaborationPrivate,
|
||||
},
|
||||
{
|
||||
title: "Public",
|
||||
description: "Start collaborating by giving write access to everyone.",
|
||||
title: "Shared",
|
||||
description: "Use Groups for precise access control.",
|
||||
codeSample: CollaborationPublic,
|
||||
},
|
||||
{
|
||||
title: "Invite-only",
|
||||
title: "By Invitation",
|
||||
description:
|
||||
"Generate an invite link, and share only with people you want to collaborate with.",
|
||||
"Create links that allow anyone to join.",
|
||||
codeSample: CollaborationInvite,
|
||||
},
|
||||
];
|
||||
@@ -34,9 +34,7 @@ export function CollaborationFeaturesSection() {
|
||||
title="Making secure collaboration the default"
|
||||
slogan={
|
||||
<>
|
||||
Every piece of data is assigned a role-based permission on creation
|
||||
— reader, writer, or admin. These permissions are defined in
|
||||
an <code>Account</code> or <code>Group</code>.
|
||||
Every CoValue belongs to a <code>Group</code>, where you can assign roles to users to control access — all from the client.
|
||||
</>
|
||||
}
|
||||
></SectionHeader>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
```tsx
|
||||
// links to message, Group is inferred
|
||||
createInviteLink(
|
||||
chatId,
|
||||
"writer", // or reader or admin
|
||||
messageId,
|
||||
"writer", // role that recipient gets
|
||||
);
|
||||
```
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
```tsx
|
||||
const { me } = useAccount();
|
||||
|
||||
Message.create(
|
||||
{ text: ... },
|
||||
{ owner: me }
|
||||
);
|
||||
Message.create({
|
||||
text: "Private message to myself."
|
||||
});
|
||||
```
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user