Compare commits
1 Commits
jazz-react
...
styling/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b11018da81 |
51
.github/workflows/jazz-run.yml
vendored
51
.github/workflows/jazz-run.yml
vendored
@@ -1,51 +0,0 @@
|
||||
name: Jazz Run Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Enable corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build jazz-run
|
||||
run: pnpm exec turbo build && chmod +x dist/index.js;
|
||||
working-directory: ./packages/jazz-run
|
||||
|
||||
- name: Run create account
|
||||
run: ./dist/index.js account create --name "Jazz Run CI test"
|
||||
working-directory: ./packages/jazz-run
|
||||
|
||||
2
.github/workflows/playwright.yml
vendored
2
.github/workflows/playwright.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
project: ["e2e/BinaryCoStream", "e2e/CoValues", "examples/chat", "examples/music-player", "examples/pets"]
|
||||
project: ["e2e/BinaryCoStream", "e2e/CoValues", "examples/chat", "examples/pets"]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
@@ -1,51 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Enable corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
version: pnpm changeset-version
|
||||
publish: pnpm release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
6
.github/workflows/unit-test.yml
vendored
6
.github/workflows/unit-test.yml
vendored
@@ -13,13 +13,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Enable corepack
|
||||
run: corepack enable
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.node-version'
|
||||
cache: 'pnpm'
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to [the community leaders responsible for enforcement](mailto:hello@gcmp.io).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
@@ -1,73 +0,0 @@
|
||||
# Contribution Guide
|
||||
|
||||
Thank you for considering contributing to Jazz! Jazz is an open-source framework for building local-first apps. We value your time and effort and are excited to collaborate with you. This guide will help you get started with contributing.
|
||||
|
||||
## How to Contribute
|
||||
|
||||
### 1. Reporting Bugs
|
||||
|
||||
If you find a bug, please [open an issue with as much detail as possible](https://github.com/gardencmp/jazz/issues). Include:
|
||||
|
||||
- A clear and descriptive title.
|
||||
- Steps to reproduce the issue.
|
||||
- What you expected to happen.
|
||||
- What actually happened.
|
||||
|
||||
### 2. Suggesting Enhancements
|
||||
|
||||
We welcome all ideas! If you have suggestions, feel free to open an issue marked with the "enhancement" label. Please provide context on why the enhancement would be beneficial and how it could be implemented.
|
||||
|
||||
### 3. Pull Requests
|
||||
|
||||
1. **Fork the repository** and create your feature branch (see [GitHub's guide on forking a repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) if you're unfamiliar with the process):
|
||||
|
||||
2. **Make your changes**, ensuring that you follow our coding standards (`pnpm format` (prettier) and `pnpm lint` (eslint) will automatically let you know there are issues).
|
||||
|
||||
3. **Commit your changes** with a descriptive commit message.
|
||||
|
||||
4. **Push to your fork** and submit a pull request.
|
||||
|
||||
5. **Describe your pull request**, explaining the problem it solves or the enhancement it adds.
|
||||
|
||||
### 4. Code Style Guidelines
|
||||
|
||||
- We use [Prettier](https://prettier.io/) for formatting. Please ensure your code is formatted before submitting.
|
||||
- Write descriptive comments where necessary.
|
||||
|
||||
### 5. Local Setup
|
||||
|
||||
1. **Clone the repository**:
|
||||
```bash
|
||||
git clone https://github.com/gardencmp/jazz.git
|
||||
```
|
||||
|
||||
2. **Install dependencies**:
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
3. **Run tests** to verify everything is working:
|
||||
```bash
|
||||
pnpm test
|
||||
```
|
||||
|
||||
### 6. Testing
|
||||
|
||||
Please write tests for any new features or bug fixes. We use Vitest for unit tests. Make sure all tests pass before submitting a pull request.
|
||||
|
||||
### 7. Communication
|
||||
|
||||
- If you're unsure about anything, feel free to ask questions by opening a discussion, reaching out via issues, or on our [Discord](https://discord.gg/utDMjHYg42).
|
||||
- Be respectful and constructive, this is a welcoming community for everyone.
|
||||
- Please be mindful of GitHub’s [Community Guidelines](https://docs.github.com/en/site-policy/github-terms/github-community-guidelines), which include being kind, avoiding disruptive behavior, and respecting others.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
Please read and adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md) to ensure a positive experience for all contributors.
|
||||
|
||||
---
|
||||
|
||||
Thank you again for your interest in contributing to Jazz. Your help makes this project better for everyone!
|
||||
|
||||
If you have any questions, don't hesitate to reach out. Let's make something great together!
|
||||
|
||||
@@ -1,60 +1,5 @@
|
||||
# @jazz-e2e/binarycostream
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6ed75eb]
|
||||
- Updated dependencies [3cc6aee]
|
||||
- cojson@0.8.12
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1ed4ab5]
|
||||
- cojson@0.8.11
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@jazz-e2e/binarycostream",
|
||||
"private": true,
|
||||
"version": "0.0.93",
|
||||
"version": "0.0.86",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -14,11 +14,11 @@
|
||||
"*.{js,jsx,mdx,json}": "prettier --write"
|
||||
},
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.8.12",
|
||||
"cojson": "workspace:0.8.5",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"is-ci": "^3.0.1",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
|
||||
@@ -27,11 +27,10 @@ export default defineConfig({
|
||||
/* 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/",
|
||||
baseURL: isCI ? "http://localhost:4173/" : "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 */
|
||||
@@ -43,11 +42,8 @@ export default defineConfig({
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm preview --port 5173",
|
||||
url: "http://localhost:5173/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
webServer: isCI ? {
|
||||
command: "pnpm preview",
|
||||
url: "http://localhost:4173/",
|
||||
} : undefined,
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createJazzReactApp, useDemoAuth } from "jazz-react";
|
||||
import { createJazzReactApp } from "jazz-react";
|
||||
import { getValueId } from "./lib/searchParams";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { ephemeralCredentialsAuth } from "jazz-tools";
|
||||
import { useState } from "react";
|
||||
|
||||
const key = getValueId()
|
||||
? `downloader-e2e@jazz.tools`
|
||||
@@ -13,22 +14,13 @@ const Jazz = createJazzReactApp();
|
||||
export const { useAccount, useCoState } = Jazz;
|
||||
|
||||
export function AuthAndJazz({ children }: { children: React.ReactNode }) {
|
||||
const [auth, state] = useDemoAuth();
|
||||
|
||||
const signedUp = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (state.state === "ready" && !signedUp.current) {
|
||||
state.signUp('Mister X');
|
||||
signedUp.current = true;
|
||||
}
|
||||
}, [state.state])
|
||||
const [ephemeralAuth] = useState(ephemeralCredentialsAuth())
|
||||
|
||||
return (
|
||||
<Jazz.Provider auth={auth} peer={
|
||||
<Jazz.Provider auth={ephemeralAuth} peer={
|
||||
localSync
|
||||
? `ws://localhost:4200?key=${key}`
|
||||
: `wss://cloud.jazz.tools/?key=${key}`
|
||||
: `wss://mesh.jazz.tools/?key=${key}`
|
||||
}>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -1,60 +1,5 @@
|
||||
# @jazz-e2e/covalues
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6ed75eb]
|
||||
- Updated dependencies [3cc6aee]
|
||||
- cojson@0.8.12
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1ed4ab5]
|
||||
- cojson@0.8.11
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@jazz-e2e/covalues",
|
||||
"private": true,
|
||||
"version": "0.0.92",
|
||||
"version": "0.0.85",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -27,11 +27,10 @@ export default defineConfig({
|
||||
/* 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/",
|
||||
baseURL: isCI ? "http://localhost:4173/" : "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 */
|
||||
@@ -43,11 +42,8 @@ export default defineConfig({
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm preview --port 5173",
|
||||
url: "http://localhost:5173/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
webServer: isCI ? {
|
||||
command: "pnpm preview",
|
||||
url: "http://localhost:4173/",
|
||||
} : undefined,
|
||||
});
|
||||
|
||||
@@ -2,20 +2,15 @@ import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import { AuthAndJazz } from "./jazz";
|
||||
import { TestInput } from "./pages/TestInput";
|
||||
import { ResumeSyncState } from "./pages/ResumeSyncState";
|
||||
import { RouterProvider, createBrowserRouter } from "react-router-dom";
|
||||
import { RouterProvider, createHashRouter } from "react-router-dom";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
const router = createHashRouter([
|
||||
{
|
||||
path: "/test-input",
|
||||
path: "/",
|
||||
element: <TestInput />,
|
||||
},
|
||||
{
|
||||
path: "/resume-sync",
|
||||
element: <ResumeSyncState />,
|
||||
},
|
||||
{
|
||||
path: "/",
|
||||
path: "/test-input",
|
||||
element: <TestInput />,
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -1,43 +1,25 @@
|
||||
import { createJazzReactApp, useDemoAuth } from "jazz-react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { createJazzReactApp } from "jazz-react";
|
||||
import { ephemeralCredentialsAuth } from "jazz-tools";
|
||||
import { useState } from "react";
|
||||
|
||||
const key = `test-comap@jazz.tools`;
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
const peer =
|
||||
(url.searchParams.get("peer") as `ws://${string}`) ??
|
||||
`wss://cloud.jazz.tools/`;
|
||||
const localSync = new URLSearchParams(location.search).has("localSync");
|
||||
|
||||
const Jazz = createJazzReactApp();
|
||||
|
||||
export const { useAccount, useCoState } = Jazz;
|
||||
|
||||
function getUserInfo() {
|
||||
return url.searchParams.get("userName") ?? "Mister X";
|
||||
}
|
||||
|
||||
export function AuthAndJazz({ children }: { children: React.ReactNode }) {
|
||||
const [auth, state] = useDemoAuth();
|
||||
const [ephemeralAuth] = useState(ephemeralCredentialsAuth())
|
||||
|
||||
const signedUp = useRef(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (state.state === "ready" && !signedUp.current) {
|
||||
const userName = getUserInfo();
|
||||
|
||||
if (state.existingUsers.includes(userName)) {
|
||||
state.logInAs(userName);
|
||||
} else {
|
||||
state.signUp(userName);
|
||||
}
|
||||
|
||||
signedUp.current = true;
|
||||
}
|
||||
}, [state.state]);
|
||||
|
||||
return (
|
||||
<Jazz.Provider auth={auth} peer={`${peer}?key=${key}`}>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
);
|
||||
return (
|
||||
<Jazz.Provider auth={ephemeralAuth} peer={
|
||||
localSync
|
||||
? `ws://localhost:4200?key=${key}`
|
||||
: `wss://mesh.jazz.tools/?key=${key}`
|
||||
}>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
import { co, CoMap, Group, ID } from "jazz-tools";
|
||||
import { useAccount, useCoState } from "../jazz";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export class ResumeSyncCoMap extends CoMap {
|
||||
value = co.string;
|
||||
}
|
||||
|
||||
function getIdParam() {
|
||||
const url = new URL(window.location.href);
|
||||
return (url.searchParams.get("id") as ID<ResumeSyncCoMap>) ?? undefined;
|
||||
}
|
||||
|
||||
export function ResumeSyncState() {
|
||||
const [id, setId] = useState(getIdParam);
|
||||
const coMap = useCoState(ResumeSyncCoMap, id);
|
||||
const { me } = useAccount();
|
||||
|
||||
useEffect(() => {
|
||||
if (id) {
|
||||
const url = new URL(window.location.href);
|
||||
url.searchParams.set("id", id);
|
||||
history.pushState({}, "", url.toString());
|
||||
}
|
||||
}, [id])
|
||||
|
||||
useEffect(() => {
|
||||
if (!me || id) return;
|
||||
|
||||
const group = Group.create({ owner: me });
|
||||
|
||||
group.addMember("everyone", "writer");
|
||||
|
||||
setId(ResumeSyncCoMap.create({ value: "" }, { owner: group }).id);
|
||||
}, [me]);
|
||||
|
||||
if (!coMap) return null;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1>Resume Sync State</h1>
|
||||
<p data-testid="id">{coMap.id}</p>
|
||||
<label htmlFor="value">Value</label>
|
||||
<input
|
||||
id="value"
|
||||
value={coMap.value ?? ""}
|
||||
onChange={(e) => {
|
||||
coMap.value = e.target.value;
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { setTimeout } from "node:timers/promises";
|
||||
|
||||
test.describe("ResumeSyncState", () => {
|
||||
test.skip("should resume the sync even after a page reload", async ({ page, browser }) => {
|
||||
const context = page.context();
|
||||
|
||||
await page.goto("/resume-sync?userName=SuperMario");
|
||||
|
||||
const id = await page.getByTestId("id").textContent();
|
||||
|
||||
// Sync an initial value
|
||||
await page.getByRole("textbox", { name: "Value" }).fill("Let's go!");
|
||||
await setTimeout(1000);
|
||||
|
||||
await context.setOffline(true);
|
||||
|
||||
// Change the value while offline
|
||||
await page.getByRole("textbox", { name: "Value" }).fill("Mammamia!");
|
||||
|
||||
// Navigate away from the page
|
||||
await page.goto(`about:blank`);
|
||||
|
||||
await setTimeout(1000);
|
||||
await context.setOffline(false);
|
||||
|
||||
// Reload the page but without loading the coValue
|
||||
// await page.goto(`/resume-sync?userName=SuperMario`);
|
||||
await page.goto(`/resume-sync?userName=SuperMario`);
|
||||
|
||||
await setTimeout(1000);
|
||||
|
||||
await expect(page.getByTestId("id")).toBeInViewport();
|
||||
|
||||
// Create a new incognito instance and try to load the coValue
|
||||
const newUserPage = await (await browser.newContext()).newPage();
|
||||
await newUserPage.goto(`/resume-sync?userName=Luigi&id=${id}`);
|
||||
|
||||
await expect(newUserPage.getByTestId("id")).toBeInViewport();
|
||||
|
||||
// The initial user should have synced the value even if the coValue was not loaded
|
||||
// when the user is back online
|
||||
await expect(newUserPage.getByRole("textbox", { name: "Value" })).toHaveValue("Mammamia!", {
|
||||
timeout: 20_000
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,63 +1,5 @@
|
||||
# jazz-example-book-shelf
|
||||
|
||||
## 0.1.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-browser-media-images@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-browser-media-images@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-browser-media-images@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3cc6aee]
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
- jazz-browser-media-images@0.8.12
|
||||
|
||||
## 0.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
- jazz-browser-media-images@0.8.11
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.8.7
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.8.6
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Jazz Book Shelf Example
|
||||
|
||||
Live version: [https://books-demo.jazz.tools](https://books-demo.jazz.tools)
|
||||
|
||||
## Installing & running the example locally
|
||||
|
||||
(this requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
||||
@@ -38,6 +36,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.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 the `<Jazz.Provider>` provider component in [./src/components/JazzAndAuth.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "example-bookShelf$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-example-book-shelf",
|
||||
"version": "0.1.8",
|
||||
"version": "0.1.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
@@ -11,9 +11,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-browser-media-images": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-browser-media-images": "workspace:0.8.5",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"next": "14.2.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function Home() {
|
||||
<input
|
||||
type="text"
|
||||
className="w-full rounded border p-1"
|
||||
value={`${window.location.origin}/user/${me?.id}`}
|
||||
value={`http://localhost:3000/user/${me?.id}`}
|
||||
readOnly
|
||||
/>
|
||||
</label>
|
||||
|
||||
@@ -17,7 +17,7 @@ export function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
// replace `you@example.com` with your email as a temporary API key
|
||||
peer="wss://cloud.jazz.tools/?key=you@example.com"
|
||||
peer="wss://mesh.jazz.tools/?key=you@example.com"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -1,68 +1,5 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- Updated dependencies [221c58f]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react-auth-clerk@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
- jazz-react-auth-clerk@0.8.14
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
- jazz-react-auth-clerk@0.8.13
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6ed75eb]
|
||||
- Updated dependencies [3cc6aee]
|
||||
- cojson@0.8.12
|
||||
- jazz-react@0.8.12
|
||||
- jazz-react-auth-clerk@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1ed4ab5]
|
||||
- cojson@0.8.11
|
||||
- jazz-react@0.8.11
|
||||
- jazz-react-auth-clerk@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
- jazz-react-auth-clerk@0.8.7
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
- jazz-react-auth-clerk@0.8.6
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Jazz Chat Example (with Clerk auth)
|
||||
|
||||
Live version: [https://chat-clerk-demo.jazz.tools](https://chat-clerk-demo.jazz.tools)
|
||||
<!-- Live version: [https://chat-clerk.jazz.tools](https://chat-clerk.jazz.tools) -->
|
||||
|
||||
## Installing & running the example locally
|
||||
|
||||
@@ -37,6 +37,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "chat$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat-clerk",
|
||||
"private": true,
|
||||
"version": "0.0.92",
|
||||
"version": "0.0.85",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -21,11 +21,11 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.8.12",
|
||||
"cojson": "workspace:0.8.5",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-react-auth-clerk": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-react-auth-clerk": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.2.0",
|
||||
|
||||
@@ -21,7 +21,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
{auth ? (
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://cloud.jazz.tools/?key=chat-example-jazz-clerk@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=chat-example-jazz-clerk@gcmp.io"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
# chat-rn-clerk
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- Updated dependencies [221c58f]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react-auth-clerk@0.8.15
|
||||
- jazz-react-native@0.8.15
|
||||
- jazz-react-native-media-images@0.8.11
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react-auth-clerk@0.8.14
|
||||
- jazz-react-native@0.8.14
|
||||
- jazz-react-native-media-images@0.8.10
|
||||
|
||||
## 1.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react-auth-clerk@0.8.13
|
||||
- jazz-react-native@0.8.13
|
||||
- jazz-react-native-media-images@0.8.9
|
||||
|
||||
## 1.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-auth-clerk@0.8.12
|
||||
- jazz-react-native@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
- jazz-react-native-media-images@0.8.8
|
||||
|
||||
## 1.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-auth-clerk@0.8.11
|
||||
- jazz-react-native@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
- jazz-react-native-media-images@0.8.7
|
||||
|
||||
## 1.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b7639cf: feat(react-native): replaced react-native-mmkv with expo-secure-store and initialize it by default as kvStore in createJazzRNApp() (BREAKING)
|
||||
- Updated dependencies [b7639cf]
|
||||
- jazz-react-native@0.8.8
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [32b05b6]
|
||||
- jazz-react-native-media-images@0.8.6
|
||||
- jazz-react-native@0.8.7
|
||||
- jazz-react-auth-clerk@0.8.7
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.6
|
||||
- jazz-react-auth-clerk@0.8.6
|
||||
@@ -1,24 +1,76 @@
|
||||
# 🎷 Jazz + Expo + `expo-router` + Clerk Auth
|
||||
<p align="center">
|
||||
<a href="https://clerk.com?utm_source=github&utm_medium=clerk_docs" target="_blank" rel="noopener noreferrer">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="./assets/images/light-logo.png">
|
||||
<img alt="Clerk Logo for light background" src="./assets/images/dark-logo.png" height="64">
|
||||
</picture>
|
||||
</a>
|
||||
<br />
|
||||
</p>
|
||||
<div align="center">
|
||||
<h1>
|
||||
Clerk and Expo Quickstart
|
||||
</h1>
|
||||
<a href="https://www.npmjs.com/package/@clerk/clerk-js">
|
||||
<img alt="Downloads" src="https://img.shields.io/npm/dm/@clerk/clerk-js" />
|
||||
</a>
|
||||
<a href="https://discord.com/invite/b5rXHjAg7A">
|
||||
<img alt="Discord" src="https://img.shields.io/discord/856971667393609759?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
||||
</a>
|
||||
<a href="https://twitter.com/clerkdev">
|
||||
<img alt="Twitter" src="https://img.shields.io/twitter/url.svg?label=%40clerkdev&style=social&url=https%3A%2F%2Ftwitter.com%2Fclerkdev" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
<img alt="Clerk Hero Image" src="./assets/images/hero.png">
|
||||
</div>
|
||||
|
||||
## 🚀 How to Run
|
||||
## Introduction
|
||||
|
||||
### 1. Inside the Workspace Root
|
||||
Clerk is a developer-first authentication and user management solution. It provides pre-built React components and hooks for sign-in, sign-up, user profile, and organization management. Clerk is designed to be easy to use and customize, and can be dropped into any React or Next.js application.
|
||||
|
||||
First, install dependencies and build the project:
|
||||
After following the quickstart you'll have learned how to:
|
||||
|
||||
- Install `@clerk/clerk-expo`
|
||||
- Setup your environment key
|
||||
- Wrap your Expo app in `<ClerkProvider />` and supply your `tokenCache`
|
||||
- Conditionally show content based on your auth state
|
||||
- Build your sign-in and sign-up pages
|
||||
|
||||
## Running the template
|
||||
|
||||
```bash
|
||||
pnpm i
|
||||
pnpm run build
|
||||
git clone https://github.com/clerk/clerk-expo-quickstart
|
||||
```
|
||||
|
||||
### 2. Inside the `examples/chat-rn-clerk` Directory
|
||||
To run the example locally, you'll need to make sure you have XCode installed and configured properly, then:
|
||||
|
||||
Next, navigate to the specific example project and run the following commands:
|
||||
1. Sign up for a Clerk account at [https://clerk.com](https://dashboard.clerk.com/sign-up?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=10-24-2023&utm_term=clerk-expo-quickstart).
|
||||
|
||||
```bash
|
||||
pnpm expo prebuild
|
||||
npx pod-install
|
||||
pnpm expo run:ios
|
||||
```
|
||||
2. Go to the [Clerk dashboard](https://dashboard.clerk.com?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=10-24-2023&utm_term=clerk-expo-quickstart) and create an application.
|
||||
|
||||
This will set up and launch the app on iOS. For Android, you can replace the last command with `pnpm expo run:android`.
|
||||
3. Set the required Clerk environment variable as shown in [the example `env` file](./.env.example).
|
||||
|
||||
4. `npm install` the required dependencies.
|
||||
|
||||
5. `npm run start` to launch the development server.
|
||||
|
||||
## Learn more
|
||||
|
||||
To learn more about Clerk and Expo, check out the following resources:
|
||||
|
||||
- [Quickstart: Get started with Expo and Clerk](https://clerk.com/docs/quickstarts/expo?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=10-24-2023&utm_term=clerk-expo-quickstart)
|
||||
|
||||
- [Clerk Documentation](https://clerk.com/docs/references/expo/overview?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=10-24-2023&utm_term=clerk-expo-quickstart)
|
||||
|
||||
- [Expo Documentation](https://docs.expo.dev/)
|
||||
|
||||
## Found an issue or want to leave feedback
|
||||
|
||||
Feel free to create a support thread on our [Discord](https://clerk.com/discord). Our support team will be happy to assist you in the `#support` channel.
|
||||
|
||||
## Connect with us
|
||||
|
||||
You can discuss ideas, ask questions, and meet others from the community in our [Discord](https://discord.com/invite/b5rXHjAg7A).
|
||||
|
||||
If you prefer, you can also find support through our [Twitter](https://twitter.com/ClerkDev), or you can [email](mailto:support@clerk.dev) us!
|
||||
|
||||
@@ -1,46 +1,45 @@
|
||||
{
|
||||
"expo": {
|
||||
"name": "jazz-chat-rn-clerk",
|
||||
"scheme": "jazz-chat-rn-clerk",
|
||||
"slug": "jazz-chat-rn-clerk",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/images/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/images/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.jazz.chatrnclerk"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/images/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"package": "com.jazz.chatrnclerk"
|
||||
},
|
||||
"plugins": [
|
||||
[
|
||||
"expo-build-properties",
|
||||
{
|
||||
"ios": {
|
||||
"newArchEnabled": true
|
||||
},
|
||||
"android": {
|
||||
"newArchEnabled": true
|
||||
}
|
||||
"expo": {
|
||||
"name": "jazz-chat-rn-clerk",
|
||||
"scheme": "jazz-chat-rn-clerk",
|
||||
"slug": "jazz-chat-rn-clerk",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/images/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/images/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.jazz.chatrnclerk"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/images/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"package": "com.jazz.chatrnclerk"
|
||||
},
|
||||
"plugins": [
|
||||
[
|
||||
"expo-build-properties",
|
||||
{
|
||||
"ios": {
|
||||
"newArchEnabled": true
|
||||
},
|
||||
"android": {
|
||||
"newArchEnabled": true
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"eas": {
|
||||
"projectId": "ca3d46e5-a10a-47ec-9d77-3b841e1c62d4"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expo-secure-store"
|
||||
],
|
||||
"extra": {
|
||||
"eas": {
|
||||
"projectId": "ca3d46e5-a10a-47ec-9d77-3b841e1c62d4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
@@ -16,14 +16,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/core-asynciterator-polyfill": "^1.0.2",
|
||||
"@bam.tech/react-native-image-resizer": "^3.0.10",
|
||||
"@clerk/clerk-expo": "^2.2.21",
|
||||
"@expo/vector-icons": "^14.0.2",
|
||||
"@react-native-community/netinfo": "^11.3.1",
|
||||
"@react-navigation/native": "^6.1.18",
|
||||
"@react-navigation/native-stack": "^6.11.0",
|
||||
"base-64": "^1.0.0",
|
||||
"buffer": "^6.0.3",
|
||||
"clsx": "^2.0.0",
|
||||
"expo": "~51.0.37",
|
||||
"expo-build-properties": "~0.12.5",
|
||||
@@ -31,7 +29,6 @@
|
||||
"expo-constants": "~16.0.2",
|
||||
"expo-crypto": "~13.0.2",
|
||||
"expo-dev-client": "~4.0.28",
|
||||
"expo-file-system": "^17.0.1",
|
||||
"expo-font": "~12.0.4",
|
||||
"expo-linking": "~6.3.1",
|
||||
"expo-router": "~3.5.23",
|
||||
@@ -42,7 +39,6 @@
|
||||
"expo-web-browser": "~13.0.3",
|
||||
"jazz-react-auth-clerk": "workspace:*",
|
||||
"jazz-react-native": "workspace:*",
|
||||
"jazz-react-native-media-images": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"nativewind": "^2.0.11",
|
||||
"react": "^18.2.0",
|
||||
@@ -53,7 +49,6 @@
|
||||
"react-native-get-random-values": "^1.11.0",
|
||||
"react-native-mmkv": "3.0.1",
|
||||
"react-native-polyfill-globals": "^3.1.0",
|
||||
"react-native-quick-base64": "^2.1.2",
|
||||
"react-native-reanimated": "~3.10.1",
|
||||
"react-native-safe-area-context": "4.10.5",
|
||||
"react-native-screens": "3.31.1",
|
||||
|
||||
@@ -2,7 +2,5 @@ import "react-native-polyfill-globals/auto";
|
||||
import "@azure/core-asynciterator-polyfill";
|
||||
import { ReadableStream } from "web-streams-polyfill/ponyfill/es6";
|
||||
import { polyfillGlobal } from "react-native/Libraries/Utilities/PolyfillFunctions";
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
polyfillGlobal("Buffer", () => Buffer);
|
||||
polyfillGlobal("ReadableStream", () => ReadableStream);
|
||||
|
||||
@@ -49,7 +49,7 @@ export function JazzAndAuth({ children }: PropsWithChildren) {
|
||||
{auth ? (
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://cloud.jazz.tools/?key=chat-rn-clerk-example-jazz@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=chat-rn-clerk-example-jazz@gcmp.io"
|
||||
storage={undefined}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { createJazzRNApp } from "jazz-react-native";
|
||||
import { MMKVStorage } from "./mmkv-storage";
|
||||
|
||||
export const Jazz = createJazzRNApp();
|
||||
const nativeStorage = new MMKVStorage();
|
||||
|
||||
export const Jazz = createJazzRNApp({ nativeStorage });
|
||||
export const { useAccount, useCoState, useAcceptInvite } = Jazz;
|
||||
|
||||
25
examples/chat-rn-clerk/src/mmkv-storage.ts
Normal file
25
examples/chat-rn-clerk/src/mmkv-storage.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
import type { NativeStorage } from "jazz-react-native";
|
||||
|
||||
const storage = new MMKV();
|
||||
|
||||
export class MMKVStorage implements NativeStorage {
|
||||
get(key: string): Promise<string | undefined> {
|
||||
return Promise.resolve(storage.getString(key));
|
||||
}
|
||||
|
||||
set(key: string, value: string): Promise<void> {
|
||||
storage.set(key, value);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
delete(key: string): Promise<void> {
|
||||
storage.delete(key);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
clearAll(): Promise<void> {
|
||||
storage.clearAll();
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
1
examples/chat-rn/.env
Normal file
1
examples/chat-rn/.env
Normal file
@@ -0,0 +1 @@
|
||||
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_ZXZpZGVudC1kYW5lLTg5LmNsZXJrLmFjY291bnRzLmRldiQ
|
||||
@@ -1,64 +1,5 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react-native@0.8.15
|
||||
|
||||
## 1.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react-native@0.8.14
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react-native@0.8.13
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 1.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 1.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- b7639cf: feat(react-native): replaced react-native-mmkv with expo-secure-store and initialize it by default as kvStore in createJazzRNApp() (BREAKING)
|
||||
- Updated dependencies [b7639cf]
|
||||
- jazz-react-native@0.8.8
|
||||
|
||||
## 1.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [32b05b6]
|
||||
- jazz-react-native@0.8.7
|
||||
|
||||
## 1.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.6
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# 🎷 Jazz + Expo + `react-navigation` + Demo Auth
|
||||
|
||||
## 🚀 How to Run
|
||||
|
||||
### 1. Inside the Workspace Root
|
||||
|
||||
First, install dependencies and build the project:
|
||||
|
||||
```bash
|
||||
pnpm i
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
### 2. Inside the `examples/chat-rn` Directory
|
||||
|
||||
Next, navigate to the specific example project and run the following commands:
|
||||
|
||||
```bash
|
||||
pnpm expo prebuild
|
||||
npx pod-install
|
||||
pnpm expo run:ios
|
||||
```
|
||||
|
||||
This will set up and launch the app on iOS. For Android, you can replace the last command with `pnpm expo run:android`.
|
||||
@@ -1,47 +1,46 @@
|
||||
{
|
||||
"expo": {
|
||||
"name": "jazz-chat-rn",
|
||||
"scheme": "jazz-chat-rn",
|
||||
"slug": "jazz-chat-rn",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.jazz.chatrn"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"package": "com.jazz.chatrn"
|
||||
},
|
||||
"plugins": [
|
||||
[
|
||||
"expo-build-properties",
|
||||
{
|
||||
"ios": {
|
||||
"newArchEnabled": true
|
||||
},
|
||||
"android": {
|
||||
"newArchEnabled": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"expo-secure-store"
|
||||
],
|
||||
"extra": {
|
||||
"eas": {
|
||||
"projectId": "e0e61872-1906-4c84-b9d8-9be77355cad0"
|
||||
}
|
||||
},
|
||||
"owner": "paxx"
|
||||
}
|
||||
"expo": {
|
||||
"name": "jazz-chat-rn",
|
||||
"scheme": "jazz-chat-rn",
|
||||
"slug": "jazz-chat-rn",
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"userInterfaceStyle": "light",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"ios": {
|
||||
"supportsTablet": true,
|
||||
"bundleIdentifier": "com.jazz.chatrn"
|
||||
},
|
||||
"android": {
|
||||
"adaptiveIcon": {
|
||||
"foregroundImage": "./assets/adaptive-icon.png",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"package": "com.jazz.chatrn"
|
||||
},
|
||||
"plugins": [
|
||||
[
|
||||
"expo-build-properties",
|
||||
{
|
||||
"ios": {
|
||||
"newArchEnabled": true
|
||||
},
|
||||
"android": {
|
||||
"newArchEnabled": true
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"extra": {
|
||||
"eas": {
|
||||
"projectId": "e0e61872-1906-4c84-b9d8-9be77355cad0"
|
||||
}
|
||||
},
|
||||
"owner": "paxx"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.2",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
@@ -23,7 +23,6 @@
|
||||
"expo-crypto": "~13.0.2",
|
||||
"expo-dev-client": "~4.0.28",
|
||||
"expo-linking": "~6.3.1",
|
||||
"expo-secure-store": "~13.0.2",
|
||||
"expo-status-bar": "~1.12.1",
|
||||
"expo-web-browser": "~13.0.3",
|
||||
"jazz-react-native": "workspace:*",
|
||||
|
||||
@@ -51,7 +51,7 @@ function App() {
|
||||
<StrictMode>
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://cloud.jazz.tools/?key=chat-rn-example-jazz@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=chat-rn-example-jazz@gcmp.io"
|
||||
storage={undefined}
|
||||
>
|
||||
<NavigationContainer linking={linking} ref={navigationRef}>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { createJazzRNApp } from "jazz-react-native";
|
||||
import { MMKVStorage } from "./mmkv-storage";
|
||||
|
||||
export const Jazz = createJazzRNApp();
|
||||
const nativeStorage = new MMKVStorage();
|
||||
|
||||
export const Jazz = createJazzRNApp({ nativeStorage });
|
||||
export const { useAccount, useCoState, useAcceptInvite } = Jazz;
|
||||
|
||||
25
examples/chat-rn/src/mmkv-storage.ts
Normal file
25
examples/chat-rn/src/mmkv-storage.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
import type { NativeStorage } from "jazz-react-native";
|
||||
|
||||
const storage = new MMKV();
|
||||
|
||||
export class MMKVStorage implements NativeStorage {
|
||||
get(key: string): Promise<string | undefined> {
|
||||
return Promise.resolve(storage.getString(key));
|
||||
}
|
||||
|
||||
set(key: string, value: string): Promise<void> {
|
||||
storage.set(key, value);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
delete(key: string): Promise<void> {
|
||||
storage.delete(key);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
clearAll(): Promise<void> {
|
||||
storage.clearAll();
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
@@ -1,60 +1,5 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.94
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.93
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6ed75eb]
|
||||
- Updated dependencies [3cc6aee]
|
||||
- cojson@0.8.12
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1ed4ab5]
|
||||
- cojson@0.8.11
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -37,6 +37,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "chat$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.94",
|
||||
"version": "0.0.87",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -22,10 +22,10 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.8.12",
|
||||
"cojson": "workspace:0.8.5",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.2.0",
|
||||
|
||||
@@ -27,7 +27,7 @@ export default defineConfig({
|
||||
/* 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/",
|
||||
baseURL: isCI ? "http://localhost:4173/" : "http://localhost:5173",
|
||||
|
||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||
trace: "on-first-retry",
|
||||
@@ -43,11 +43,8 @@ export default defineConfig({
|
||||
],
|
||||
|
||||
/* Run your local dev server before starting the tests */
|
||||
webServer: [
|
||||
{
|
||||
command: "pnpm preview --port 5173",
|
||||
url: "http://localhost:5173/",
|
||||
reuseExistingServer: !isCI,
|
||||
},
|
||||
],
|
||||
webServer: isCI ? {
|
||||
command: "pnpm preview",
|
||||
url: "http://localhost:4173/",
|
||||
} : undefined,
|
||||
});
|
||||
|
||||
@@ -13,7 +13,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
<>
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://cloud.jazz.tools/?key=chat-example-jazz@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=chat-example-jazz@gcmp.io"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -1,42 +1,5 @@
|
||||
# jazz-example-inspector
|
||||
|
||||
## 0.0.68
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e0dd006]
|
||||
- cojson-transport-ws@0.8.13
|
||||
|
||||
## 0.0.67
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [6ed75eb]
|
||||
- cojson@0.8.12
|
||||
- cojson-transport-ws@0.8.12
|
||||
|
||||
## 0.0.66
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [1ed4ab5]
|
||||
- cojson@0.8.11
|
||||
- cojson-transport-ws@0.8.11
|
||||
|
||||
## 0.0.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e82cf3d]
|
||||
- cojson-transport-ws@0.8.7
|
||||
|
||||
## 0.0.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5542fdb]
|
||||
- cojson-transport-ws@0.8.6
|
||||
|
||||
## 0.0.63
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -14,7 +14,7 @@ job "inspector$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"private": true,
|
||||
"version": "0.0.68",
|
||||
"version": "0.0.63",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -15,8 +15,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.8.12",
|
||||
"cojson-transport-ws": "workspace:0.8.13",
|
||||
"cojson": "workspace:0.8.5",
|
||||
"cojson-transport-ws": "workspace:0.8.5",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
|
||||
@@ -61,8 +61,8 @@ export default function CoJsonViewerApp() {
|
||||
|
||||
WasmCrypto.create().then(async (crypto) => {
|
||||
const wsPeer = createWebSocketPeer({
|
||||
id: "cloud",
|
||||
websocket: new WebSocket("wss://cloud.jazz.tools"),
|
||||
id: "mesh",
|
||||
websocket: new WebSocket("wss://mesh.jazz.tools"),
|
||||
role: "server",
|
||||
});
|
||||
const node = await LocalNode.withLoadedAccount({
|
||||
|
||||
@@ -9,12 +9,11 @@ module.exports = {
|
||||
],
|
||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['react-refresh', "eslint-plugin-react-compiler"],
|
||||
plugins: ['react-refresh'],
|
||||
rules: {
|
||||
'react-refresh/only-export-components': [
|
||||
'warn',
|
||||
{ allowConstantExport: true },
|
||||
],
|
||||
"react-compiler/react-compiler": "error"
|
||||
},
|
||||
}
|
||||
|
||||
7
examples/music-player/.gitignore
vendored
7
examples/music-player/.gitignore
vendored
@@ -22,10 +22,3 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
/test-results/
|
||||
/playwright-report/
|
||||
/blob-report/
|
||||
/playwright/.cache/
|
||||
|
||||
sync-db/
|
||||
@@ -1,56 +1,5 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3cc6aee]
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -37,6 +37,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.jazz.tools`) - so cross-device use, invites and collaboration should just work.
|
||||
|
||||
You can also run a local sync server by running `npx cojson-simple-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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "example-musicPlayer$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.14",
|
||||
"version": "0.0.7",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
||||
"format": "prettier --write './src/**/*.{ts,tsx}'",
|
||||
"preview": "vite preview",
|
||||
"test": "playwright test",
|
||||
"test:ui": "playwright test --ui"
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,tsx}": "eslint --fix",
|
||||
@@ -22,8 +20,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
@@ -33,7 +31,6 @@
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.46.1",
|
||||
"@types/react": "^18.2.19",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
||||
@@ -41,7 +38,6 @@
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"eslint": "^8.46.0",
|
||||
"eslint-plugin-react-compiler": "0.0.0-experimental-fa06e2c-20241014",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"postcss": "^8.4.27",
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
import isCI from "is-ci";
|
||||
|
||||
/**
|
||||
* Read environment variables from file.
|
||||
* https://github.com/motdotla/dotenv
|
||||
*/
|
||||
// import dotenv from 'dotenv';
|
||||
// dotenv.config({ path: path.resolve(__dirname, '.env') });
|
||||
|
||||
/**
|
||||
* 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,
|
||||
},
|
||||
],
|
||||
});
|
||||
@@ -62,15 +62,12 @@ function Main() {
|
||||
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
const [auth, state] = useDemoAuth();
|
||||
|
||||
const peer =
|
||||
(new URL(window.location.href).searchParams.get(
|
||||
"peer",
|
||||
) as `ws://${string}`) ??
|
||||
"wss://cloud.jazz.tools/?key=music-player-example-jazz@gcmp.io";
|
||||
|
||||
return (
|
||||
<>
|
||||
<Jazz.Provider auth={auth} peer={peer}>
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://mesh.jazz.tools/?key=music-player-example-jazz@gcmp.io"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
<DemoAuthBasicUI appName="Jazz Music Player" state={state} />
|
||||
|
||||
@@ -11,8 +11,6 @@ import { ID } from "jazz-tools";
|
||||
import { Playlist } from "./1_schema";
|
||||
import { createInviteLink } from "jazz-react";
|
||||
import { useToast } from "@/hooks/use-toast"
|
||||
import { PlaylistTitleInput } from "./components/PlaylistTitleInput";
|
||||
import { LogoutButton } from "./components/LogoutButton";
|
||||
|
||||
export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
/**
|
||||
@@ -59,6 +57,14 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
const isPlaylistOwner = playlist?._owner.myRole() === "admin";
|
||||
const isActivePlaylist = playlistId === me?.root.activePlaylist?.id;
|
||||
|
||||
const handlePlaylistTitleChange = (
|
||||
evt: React.ChangeEvent<HTMLInputElement>,
|
||||
) => {
|
||||
if (!playlist) return;
|
||||
|
||||
playlist.title = evt.target.value;
|
||||
};
|
||||
|
||||
const handlePlaylistShareClick = async () => {
|
||||
if (!isPlaylistOwner) return;
|
||||
|
||||
@@ -82,7 +88,12 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
All tracks
|
||||
</h1>
|
||||
) : (
|
||||
<PlaylistTitleInput playlistId={playlistId} />
|
||||
<input
|
||||
value={playlist?.title ?? ""}
|
||||
onChange={handlePlaylistTitleChange}
|
||||
className="text-2xl font-bold text-blue-800 bg-transparent"
|
||||
disabled={!isPlaylistOwner}
|
||||
/>
|
||||
)}
|
||||
<div className="flex items-center space-x-4">
|
||||
{isRootPlaylist && (
|
||||
@@ -93,7 +104,7 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
Add file
|
||||
</FileUploadButton>
|
||||
<Button onClick={handleCreatePlaylist}>
|
||||
New playlist
|
||||
Create new playlist
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
@@ -102,7 +113,6 @@ export function HomePage({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
Share playlist
|
||||
</Button>
|
||||
)}
|
||||
<LogoutButton />
|
||||
</div>
|
||||
</div>
|
||||
<ul className="flex flex-col">
|
||||
|
||||
@@ -128,19 +128,3 @@ export async function addTrackToPlaylist(
|
||||
|
||||
playlist.tracks?.push(trackClone);
|
||||
}
|
||||
|
||||
export async function updatePlaylistTitle(playlist: Playlist, title: string) {
|
||||
playlist.title = title;
|
||||
}
|
||||
|
||||
export async function updateMusicTrackTitle(track: MusicTrack, title: string) {
|
||||
track.title = title;
|
||||
}
|
||||
|
||||
export async function updateActivePlaylist(playlist: Playlist, me: MusicaAccount) {
|
||||
me.root!.activePlaylist = playlist ?? me.root!.rootPlaylist;
|
||||
}
|
||||
|
||||
export async function updateActiveTrack(track: MusicTrack, me: MusicaAccount) {
|
||||
me.root!.activeTrack = track;
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import { MusicTrack, Playlist } from "@/1_schema";
|
||||
import { useRef, useState } from "react";
|
||||
import { getNextTrack, getPrevTrack } from "./lib/getters";
|
||||
import { BinaryCoStream, ID } from "jazz-tools";
|
||||
import { updateActivePlaylist, updateActiveTrack } from "./4_actions";
|
||||
|
||||
export function useMediaPlayer() {
|
||||
const { me } = useAccount();
|
||||
@@ -40,7 +39,7 @@ export function useMediaPlayer() {
|
||||
return;
|
||||
}
|
||||
|
||||
updateActiveTrack(track, me);
|
||||
me.root.activeTrack = track;
|
||||
|
||||
await playMedia(file);
|
||||
|
||||
@@ -53,7 +52,7 @@ export function useMediaPlayer() {
|
||||
const track = await getNextTrack(me);
|
||||
|
||||
if (track) {
|
||||
updateActiveTrack(track, me);
|
||||
me.root.activeTrack = track;
|
||||
await loadTrack(track);
|
||||
}
|
||||
}
|
||||
@@ -79,7 +78,7 @@ export function useMediaPlayer() {
|
||||
return;
|
||||
}
|
||||
|
||||
updateActivePlaylist(playlist!, me);
|
||||
me.root.activePlaylist = playlist ?? me.root.rootPlaylist;
|
||||
|
||||
await loadTrack(track);
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Button } from "./ui/button";
|
||||
import { useAccount } from "@/2_main";
|
||||
|
||||
export function LogoutButton() {
|
||||
const { logOut } = useAccount();
|
||||
|
||||
return (
|
||||
<Button onClick={logOut}>
|
||||
Logout
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -7,11 +7,11 @@ import {
|
||||
DropdownMenuItem,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import { MoreHorizontal } from "lucide-react";
|
||||
import { ChangeEvent } from "react";
|
||||
import { Button } from "./ui/button";
|
||||
import { useAccount, useCoState } from "@/2_main";
|
||||
import { addTrackToPlaylist } from "@/4_actions";
|
||||
import { ID } from "jazz-tools";
|
||||
import { MusicTrackTitleInput } from "./MusicTrackTitleInput";
|
||||
|
||||
export function MusicTrackRow({
|
||||
trackId,
|
||||
@@ -28,6 +28,11 @@ export function MusicTrackRow({
|
||||
}) {
|
||||
const track = useCoState(MusicTrack, trackId);
|
||||
|
||||
function handleTrackTitleChange(evt: ChangeEvent<HTMLInputElement>) {
|
||||
if (!track) return;
|
||||
track.title = evt.target.value;
|
||||
}
|
||||
|
||||
const { me } = useAccount({
|
||||
root: {
|
||||
playlists: [{}],
|
||||
@@ -59,7 +64,6 @@ export function MusicTrackRow({
|
||||
!isPlaying && "group-hover:bg-slate-300 rounded-full",
|
||||
)}
|
||||
onClick={handleTrackClick}
|
||||
aria-label={`${isPlaying ? "Pause" : "Play"} ${track?.title}`}
|
||||
>
|
||||
{isLoading ? (
|
||||
<div className="animate-spin">߷</div>
|
||||
@@ -69,12 +73,25 @@ export function MusicTrackRow({
|
||||
"▶️"
|
||||
)}
|
||||
</button>
|
||||
<MusicTrackTitleInput trackId={trackId} />
|
||||
<div
|
||||
className="relative flex-grow"
|
||||
onClick={(evt) => evt.stopPropagation()}
|
||||
>
|
||||
<input
|
||||
className="absolute w-full h-full left-0 bg-transparent px-1"
|
||||
value={track?.title}
|
||||
onChange={handleTrackTitleChange}
|
||||
spellCheck="false"
|
||||
/>
|
||||
<span className="opacity-0 px-1 w-fit pointer-events-none whitespace-pre">
|
||||
{track?.title}
|
||||
</span>
|
||||
</div>
|
||||
<div onClick={(evt) => evt.stopPropagation()}>
|
||||
{showAddToPlaylist && (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" className="h-8 w-8 p-0" aria-label={`Open ${track?.title} menu`}>
|
||||
<Button variant="ghost" className="h-8 w-8 p-0">
|
||||
<span className="sr-only">Open menu</span>
|
||||
<MoreHorizontal className="h-4 w-4" />
|
||||
</Button>
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import { MusicTrack } from "@/1_schema";
|
||||
import { useCoState } from "@/2_main";
|
||||
import { updateMusicTrackTitle } from "@/4_actions";
|
||||
import { ID } from "jazz-tools";
|
||||
import { ChangeEvent, useState } from "react";
|
||||
|
||||
export function MusicTrackTitleInput({
|
||||
trackId,
|
||||
}: {
|
||||
trackId: ID<MusicTrack> | undefined;
|
||||
}) {
|
||||
const track = useCoState(MusicTrack, trackId);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [localTrackTitle, setLocalTrackTitle] = useState("");
|
||||
|
||||
function handleTitleChange(evt: ChangeEvent<HTMLInputElement>) {
|
||||
setLocalTrackTitle(evt.target.value);
|
||||
}
|
||||
|
||||
function handleFoucsIn() {
|
||||
setIsEditing(true);
|
||||
setLocalTrackTitle(track?.title ?? "");
|
||||
}
|
||||
|
||||
function handleFocusOut() {
|
||||
setIsEditing(false);
|
||||
setLocalTrackTitle("");
|
||||
track && updateMusicTrackTitle(track, localTrackTitle);
|
||||
}
|
||||
|
||||
const inputValue = isEditing ? localTrackTitle : track?.title ?? "";
|
||||
|
||||
return (
|
||||
<div
|
||||
className="relative flex-grow"
|
||||
onClick={(evt) => evt.stopPropagation()}
|
||||
>
|
||||
<input
|
||||
className="absolute w-full h-full left-0 bg-transparent px-1"
|
||||
value={inputValue}
|
||||
onChange={handleTitleChange}
|
||||
spellCheck="false"
|
||||
onFocus={handleFoucsIn}
|
||||
onBlur={handleFocusOut}
|
||||
aria-label={`Edit track title: ${track?.title}`}
|
||||
/>
|
||||
<span className="opacity-0 px-1 w-fit pointer-events-none whitespace-pre">
|
||||
{inputValue}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -39,14 +39,12 @@ export function PlayerControls({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
<button
|
||||
onClick={mediaPlayer.playPrevTrack}
|
||||
className="text-blue-600 hover:text-blue-800"
|
||||
aria-label="Previous track"
|
||||
>
|
||||
<SkipBack size={20} />
|
||||
</button>
|
||||
<button
|
||||
onClick={playState.toggle}
|
||||
className="w-[42px] h-[42px] flex items-center justify-center bg-blue-600 rounded-full text-white hover:bg-blue-700"
|
||||
aria-label={isPlaying ? "Pause active track" : "Play active track"}
|
||||
>
|
||||
{isPlaying ? (
|
||||
<Pause size={24} fill="currentColor" />
|
||||
@@ -57,7 +55,6 @@ export function PlayerControls({ mediaPlayer }: { mediaPlayer: MediaPlayer }) {
|
||||
<button
|
||||
onClick={mediaPlayer.playNextTrack}
|
||||
className="text-blue-600 hover:text-blue-800"
|
||||
aria-label="Next track"
|
||||
>
|
||||
<SkipForward size={20} />
|
||||
</button>
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import { Playlist } from "@/1_schema";
|
||||
import { useCoState } from "@/2_main";
|
||||
import {
|
||||
updatePlaylistTitle
|
||||
} from "@/4_actions";
|
||||
import { ID } from "jazz-tools";
|
||||
import { ChangeEvent, useState } from "react";
|
||||
|
||||
export function PlaylistTitleInput({
|
||||
playlistId,
|
||||
}: {
|
||||
playlistId: ID<Playlist> | undefined;
|
||||
}) {
|
||||
const playlist = useCoState(Playlist, playlistId);
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const [localPlaylistTitle, setLocalPlaylistTitle] = useState("");
|
||||
|
||||
function handleTitleChange(evt: ChangeEvent<HTMLInputElement>) {
|
||||
setLocalPlaylistTitle(evt.target.value);
|
||||
}
|
||||
|
||||
function handleFoucsIn() {
|
||||
setIsEditing(true);
|
||||
setLocalPlaylistTitle(playlist?.title ?? "");
|
||||
}
|
||||
|
||||
function handleFocusOut() {
|
||||
setIsEditing(false);
|
||||
setLocalPlaylistTitle("");
|
||||
playlist && updatePlaylistTitle(playlist, localPlaylistTitle);
|
||||
}
|
||||
|
||||
const inputValue = isEditing ? localPlaylistTitle : playlist?.title ?? "";
|
||||
|
||||
return (
|
||||
<input
|
||||
value={inputValue}
|
||||
onChange={handleTitleChange}
|
||||
className="text-2xl font-bold text-blue-800 bg-transparent"
|
||||
onFocus={handleFoucsIn}
|
||||
onBlur={handleFocusOut}
|
||||
aria-label={`Playlist title`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -53,7 +53,6 @@ export function Waveform(props: { track: MusicTrack; height: number }) {
|
||||
style={{
|
||||
height: height * value,
|
||||
}}
|
||||
aria-label={`Seek to ${(i / barCount) * duration} seconds`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
import { test } from "@playwright/test";
|
||||
import { LoginPage } from "./pages/LoginPage";
|
||||
import { HomePage } from "./pages/HomePage";
|
||||
|
||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
test("create a new playlist and share", async ({ page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
|
||||
await loginPage.goto();
|
||||
await loginPage.fillUsername("S. Mario");
|
||||
await loginPage.signup();
|
||||
|
||||
const homePage = new HomePage(page);
|
||||
|
||||
// The example song should be loaded
|
||||
await homePage.expectMusicTrack("Example song");
|
||||
await homePage.editTrackTitle("Example song", "Super Mario World");
|
||||
|
||||
await homePage.createPlaylist();
|
||||
await homePage.editPlaylistTitle("Save the princess");
|
||||
|
||||
await homePage.navigateToPlaylist("All tracks");
|
||||
await homePage.addTrackToPlaylist("Super Mario World", "Save the princess");
|
||||
|
||||
await homePage.navigateToPlaylist("Save the princess");
|
||||
await homePage.expectMusicTrack("Super Mario World");
|
||||
|
||||
const url = await homePage.getShareLink();
|
||||
|
||||
await sleep(4000); // Wait for the sync to complete
|
||||
|
||||
await homePage.logout();
|
||||
|
||||
await loginPage.goto();
|
||||
await loginPage.fillUsername("Luigi");
|
||||
await loginPage.signup();
|
||||
|
||||
await page.goto(url);
|
||||
|
||||
await homePage.expectMusicTrack("Super Mario World");
|
||||
await homePage.playMusicTrack("Super Mario World");
|
||||
await homePage.expectActiveTrackPlaying();
|
||||
});
|
||||
@@ -1,102 +0,0 @@
|
||||
import { Page, expect } from "@playwright/test";
|
||||
|
||||
export class HomePage {
|
||||
constructor(public page: Page) {}
|
||||
|
||||
newPlaylistButton = this.page.getByRole("button", {
|
||||
name: "New Playlist",
|
||||
});
|
||||
|
||||
playlistTitleInput = this.page.getByRole("textbox", {
|
||||
name: "Playlist title",
|
||||
});
|
||||
|
||||
logoutButton = this.page.getByRole("button", {
|
||||
name: "Logout",
|
||||
});
|
||||
|
||||
async expectActiveTrackPlaying() {
|
||||
await expect(
|
||||
this.page.getByRole("button", {
|
||||
name: `Pause active track`,
|
||||
}),
|
||||
|
||||
).toBeVisible({
|
||||
timeout: 10_000,
|
||||
});
|
||||
}
|
||||
|
||||
async expectMusicTrack(trackName: string) {
|
||||
await expect(
|
||||
this.page.getByRole("button", {
|
||||
name: `Play ${trackName}`,
|
||||
}),
|
||||
).toBeVisible();
|
||||
}
|
||||
|
||||
async playMusicTrack(trackName: string) {
|
||||
await this.page
|
||||
.getByRole("button", {
|
||||
name: `Play ${trackName}`,
|
||||
})
|
||||
.click();
|
||||
}
|
||||
|
||||
async editTrackTitle(trackTitle: string, newTitle: string) {
|
||||
await this.page
|
||||
.getByRole("textbox", {
|
||||
name: `Edit track title: ${trackTitle}`,
|
||||
})
|
||||
.fill(newTitle);
|
||||
}
|
||||
|
||||
async createPlaylist() {
|
||||
await this.newPlaylistButton.click();
|
||||
}
|
||||
|
||||
async editPlaylistTitle(playlistTitle: string) {
|
||||
await this.playlistTitleInput.fill(playlistTitle);
|
||||
}
|
||||
|
||||
async navigateToPlaylist(playlistTitle: string) {
|
||||
await this.page
|
||||
.getByRole("link", {
|
||||
name: playlistTitle,
|
||||
})
|
||||
.click();
|
||||
}
|
||||
|
||||
async getShareLink() {
|
||||
await this.page
|
||||
.getByRole("button", {
|
||||
name: "Share playlist",
|
||||
})
|
||||
.click();
|
||||
|
||||
const inviteUrl = await this.page.evaluate(() =>
|
||||
navigator.clipboard.readText(),
|
||||
);
|
||||
|
||||
expect(inviteUrl).toBeTruthy();
|
||||
|
||||
return inviteUrl;
|
||||
}
|
||||
|
||||
async addTrackToPlaylist(trackTitle: string, playlistTitle: string) {
|
||||
await this.page
|
||||
.getByRole("button", {
|
||||
name: `Open ${trackTitle} menu`,
|
||||
})
|
||||
.click();
|
||||
|
||||
await this.page
|
||||
.getByRole("menuitem", {
|
||||
name: `Add to ${playlistTitle}`,
|
||||
})
|
||||
.click();
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.logoutButton.click();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
import { Page, Locator, expect } from "@playwright/test";
|
||||
|
||||
export class LoginPage {
|
||||
readonly page: Page;
|
||||
readonly usernameInput: Locator;
|
||||
readonly signupButton: Locator;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.usernameInput = page.getByRole("textbox");
|
||||
this.signupButton = page.getByRole("button", {
|
||||
name: "Sign up",
|
||||
});
|
||||
}
|
||||
|
||||
async goto() {
|
||||
this.page.goto("/");
|
||||
}
|
||||
|
||||
async fillUsername(value: string) {
|
||||
await this.usernameInput.clear();
|
||||
await this.usernameInput.fill(value);
|
||||
}
|
||||
|
||||
async loginAs(value: string) {
|
||||
await this.page
|
||||
.getByRole("button", {
|
||||
name: value,
|
||||
})
|
||||
.click();
|
||||
}
|
||||
|
||||
async signup() {
|
||||
await this.signupButton.click();
|
||||
}
|
||||
|
||||
async expectLoaded() {
|
||||
await expect(this.signupButton).toBeVisible();
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,5 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3cc6aee]
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -62,6 +62,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.jazz.tools`) - so cross-device use, invites and collaboration should just work.
|
||||
|
||||
You can also run a local sync server by running `npx cojson-simple-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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.6",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -11,8 +11,8 @@
|
||||
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-hook-form": "^7.41.5",
|
||||
|
||||
@@ -24,7 +24,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
<>
|
||||
<Jazz.Provider
|
||||
auth={auth}
|
||||
peer="wss://cloud.jazz.tools/?key=password-manager-example-jazz@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=password-manager-example-jazz@gcmp.io"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -5,13 +5,9 @@ import Table from "./components/table";
|
||||
import NewItemModal from "./components/new-item-modal";
|
||||
import InviteModal from "./components/invite-modal";
|
||||
|
||||
import { saveItem, deleteItem, createFolder, updateItem, addSharedFolder } from "./4_actions";
|
||||
import { saveItem, deleteItem, createFolder, updateItem } from "./4_actions";
|
||||
import { Alert, AlertDescription } from "./components/alert";
|
||||
import {
|
||||
Folder,
|
||||
FolderList,
|
||||
PasswordItem,
|
||||
} from "./1_schema";
|
||||
import { Folder, FolderList, PasswordItem } from "./1_schema";
|
||||
import { useAccount, useCoState } from "./2_main";
|
||||
import { CoMapInit, Group, ID } from "jazz-tools";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
@@ -21,19 +17,20 @@ const VaultPage: React.FC = () => {
|
||||
const { me, logOut } = useAccount();
|
||||
const sharedFolderId = useParams<{ sharedFolderId: ID<Folder> }>()
|
||||
.sharedFolderId;
|
||||
|
||||
const sharedFolder = useCoState(Folder, sharedFolderId);
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
if (!sharedFolderId) return;
|
||||
|
||||
addSharedFolder(sharedFolderId, me).then(() => {
|
||||
navigate("/vault");
|
||||
});
|
||||
|
||||
// We want to trigger this only on mount
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
if (!sharedFolderId || !sharedFolder || !me.root?.folders) return;
|
||||
const existsIndex = me.root?.folders.findIndex(
|
||||
(f) => f?.id === sharedFolder.id
|
||||
);
|
||||
if (existsIndex > -1) {
|
||||
me.root?.folders?.splice(existsIndex, 1);
|
||||
}
|
||||
me.root?.folders?.push(sharedFolder);
|
||||
navigate("/vault");
|
||||
}, [sharedFolder, me.root?.folders, sharedFolderId, navigate]);
|
||||
|
||||
const items = me.root?.folders?.flatMap(
|
||||
(folder) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Group, ID } from "jazz-tools";
|
||||
import { Group } from "jazz-tools";
|
||||
import {
|
||||
Folder,
|
||||
PasswordItem,
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
import { CoMapInit } from "jazz-tools";
|
||||
import { createInviteLink } from "jazz-react";
|
||||
import { PasswordItemFormValues } from "./types";
|
||||
import { waitForCoValue } from "./lib/waitForCoValue";
|
||||
|
||||
export const saveItem = (item: CoMapInit<PasswordItem>): PasswordItem => {
|
||||
const passwordItem = PasswordItem.create(item, {
|
||||
@@ -55,24 +54,3 @@ export const shareFolder = (
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
export async function addSharedFolder(
|
||||
sharedFolderId: ID<Folder>,
|
||||
me: PasswordManagerAccount) {
|
||||
const [sharedFolder, account] = await Promise.all([
|
||||
await waitForCoValue(Folder, sharedFolderId, me, Boolean, {}),
|
||||
await waitForCoValue(PasswordManagerAccount, me.id, me, Boolean, {
|
||||
root: {
|
||||
folders: [],
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
||||
if (!account.root?.folders) return;
|
||||
|
||||
const found = account.root.folders.some((f) => f?.id === sharedFolder.id);
|
||||
|
||||
if (!found) {
|
||||
account.root.folders.push(sharedFolder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import {
|
||||
Account,
|
||||
CoValue,
|
||||
CoValueClass,
|
||||
DepthsIn,
|
||||
ID,
|
||||
subscribeToCoValue,
|
||||
} from "jazz-tools";
|
||||
|
||||
export function waitForCoValue<T extends CoValue>(
|
||||
coMap: CoValueClass<T>,
|
||||
valueId: ID<T>,
|
||||
account: Account,
|
||||
predicate: (value: T) => boolean,
|
||||
depth: DepthsIn<T>
|
||||
) {
|
||||
return new Promise<T>((resolve) => {
|
||||
function subscribe() {
|
||||
const unsubscribe = subscribeToCoValue(
|
||||
coMap,
|
||||
valueId,
|
||||
account,
|
||||
depth,
|
||||
(value) => {
|
||||
if (predicate(value)) {
|
||||
resolve(value);
|
||||
unsubscribe();
|
||||
}
|
||||
},
|
||||
() => {
|
||||
unsubscribe();
|
||||
setTimeout(subscribe, 100);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
subscribe();
|
||||
});
|
||||
}
|
||||
@@ -1,63 +1,5 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-browser-media-images@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-browser-media-images@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-browser-media-images@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3cc6aee]
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
- jazz-browser-media-images@0.8.12
|
||||
|
||||
## 0.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
- jazz-browser-media-images@0.8.11
|
||||
|
||||
## 0.0.106
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.8.7
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.105
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser-media-images@0.8.6
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.104
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -37,6 +37,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "example-pets$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.111",
|
||||
"version": "0.0.104",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -23,9 +23,9 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-browser-media-images": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-browser-media-images": "workspace:0.8.5",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.2.0",
|
||||
@@ -50,7 +50,7 @@
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.3",
|
||||
"is-ci": "^3.0.1",
|
||||
"jazz-run": "workspace:0.8.15",
|
||||
"jazz-run": "workspace:0.8.5",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "3.3.2",
|
||||
"typescript": "^5.3.3",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 820 B |
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom/client";
|
||||
import { Link, RouterProvider, createHashRouter, useNavigate } from "react-router-dom";
|
||||
import { Link, RouterProvider, createHashRouter } from "react-router-dom";
|
||||
import "./index.css";
|
||||
|
||||
import { createJazzReactApp, DemoAuthBasicUI, useDemoAuth } from "jazz-react";
|
||||
@@ -18,7 +18,7 @@ const peer =
|
||||
(new URL(window.location.href).searchParams.get(
|
||||
"peer",
|
||||
) as `ws://${string}`) ??
|
||||
"wss://cloud.jazz.tools/?key=pets-example-jazz@gcmp.io";
|
||||
"wss://mesh.jazz.tools/?key=music-player-example-jazz@gcmp.io";
|
||||
|
||||
/** Walkthrough: The top-level provider `<Jazz.Provider/>`
|
||||
*
|
||||
@@ -87,10 +87,15 @@ export default function App() {
|
||||
},
|
||||
{
|
||||
path: "/invite/*",
|
||||
element: <AcceptInvite />,
|
||||
element: <p>Accepting invite...</p>,
|
||||
},
|
||||
]);
|
||||
|
||||
useAcceptInvite({
|
||||
invitedObjectSchema: PetPost,
|
||||
onAccept: (petPostID) => router.navigate("/pet/" + petPostID),
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<RouterProvider router={router} />
|
||||
@@ -107,16 +112,6 @@ export default function App() {
|
||||
);
|
||||
}
|
||||
|
||||
function AcceptInvite() {
|
||||
const navigate = useNavigate();
|
||||
useAcceptInvite({
|
||||
invitedObjectSchema: PetPost,
|
||||
onAccept: (petPostID) => navigate("/pet/" + petPostID),
|
||||
});
|
||||
|
||||
return <p>Accepting invite...</p>
|
||||
}
|
||||
|
||||
export function PostOverview() {
|
||||
const { me } = useAccount();
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import { HomePage } from "./pages/HomePage";
|
||||
import { NewPostPage } from "./pages/NewPostPage";
|
||||
import { PostPage } from "./pages/PostPage";
|
||||
|
||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
test("create a new post and share", async ({ page }) => {
|
||||
const loginPage = new LoginPage(page);
|
||||
|
||||
@@ -20,7 +18,7 @@ test("create a new post and share", async ({ page }) => {
|
||||
const newPostPage = new NewPostPage(page);
|
||||
|
||||
await newPostPage.fillPetName("Yoshi");
|
||||
await newPostPage.uploadFile("./public/jazz-logo-low-res.jpg");
|
||||
await newPostPage.uploadFile("./public/jazz-logo.png");
|
||||
await newPostPage.submit();
|
||||
|
||||
const postPage = new PostPage(page);
|
||||
@@ -29,8 +27,6 @@ test("create a new post and share", async ({ page }) => {
|
||||
|
||||
const invitation = await postPage.getShareLink();
|
||||
|
||||
await sleep(1000);
|
||||
|
||||
await postPage.logout();
|
||||
|
||||
await loginPage.expectLoaded();
|
||||
@@ -39,6 +35,7 @@ test("create a new post and share", async ({ page }) => {
|
||||
await loginPage.signup();
|
||||
|
||||
await page.goto(invitation);
|
||||
await page.reload();
|
||||
|
||||
await postPage.expectPetName("Yoshi");
|
||||
await postPage.expectReactionSelectedByCurrentUser("😍", false);
|
||||
|
||||
@@ -1,56 +1,5 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [cce679b]
|
||||
- jazz-tools@0.8.15
|
||||
- jazz-react@0.8.15
|
||||
|
||||
## 0.0.109
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [36273b3]
|
||||
- jazz-tools@0.8.14
|
||||
- jazz-react@0.8.14
|
||||
|
||||
## 0.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [fd011d7]
|
||||
- jazz-tools@0.8.13
|
||||
- jazz-react@0.8.13
|
||||
|
||||
## 0.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [3cc6aee]
|
||||
- jazz-react@0.8.12
|
||||
- jazz-tools@0.8.12
|
||||
|
||||
## 0.0.106
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.11
|
||||
- jazz-tools@0.8.11
|
||||
|
||||
## 0.0.105
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.7
|
||||
|
||||
## 0.0.104
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.6
|
||||
|
||||
## 0.0.103
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -64,6 +64,6 @@ If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or
|
||||
|
||||
## 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.
|
||||
By default, the example app uses [Jazz Global Mesh](https://jazz.tools/mesh) (`wss://sync.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 the `<Jazz.Provider>` provider component in [./src/2_main.tsx](./src/2_main.tsx).
|
||||
|
||||
@@ -14,7 +14,7 @@ job "example-todo$BRANCH_SUFFIX" {
|
||||
constraint {
|
||||
attribute = "${node.class}"
|
||||
operator = "="
|
||||
value = "cloud"
|
||||
value = "mesh"
|
||||
}
|
||||
|
||||
spread {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.110",
|
||||
"version": "0.0.103",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -20,8 +20,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-react": "workspace:0.8.15",
|
||||
"jazz-tools": "workspace:0.8.15",
|
||||
"jazz-react": "workspace:0.8.5",
|
||||
"jazz-tools": "workspace:0.8.5",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.2.0",
|
||||
|
||||
@@ -44,7 +44,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
<>
|
||||
<Jazz.Provider
|
||||
auth={passkeyAuth}
|
||||
peer="wss://cloud.jazz.tools/?key=todo-example-jazz@gcmp.io"
|
||||
peer="wss://mesh.jazz.tools/?key=todo-example-jazz@gcmp.io"
|
||||
>
|
||||
{children}
|
||||
</Jazz.Provider>
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint",
|
||||
"format": "prettier --write './**/*.{ts,tsx,json}'"
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@evilmartians/harmony": "^1.0.0",
|
||||
@@ -15,7 +14,6 @@
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.436.0",
|
||||
"next": "14.2.7",
|
||||
"next-themes": "^0.2.1",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
@@ -30,7 +28,6 @@
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.2.7",
|
||||
"postcss": "^8",
|
||||
"prettier": "^3.2.5",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
|
||||
@@ -6,10 +6,12 @@ export function CodeRef({ children }: { children: React.ReactNode }) {
|
||||
className={clsx(
|
||||
"font-mono",
|
||||
"text-[0.9em]",
|
||||
"px-2 py-1",
|
||||
"rounded",
|
||||
"text-stone-900 dark:text-stone-200",
|
||||
"px-1 py-0.5",
|
||||
"rounded-sm",
|
||||
"border",
|
||||
"text-stone-800 dark:text-stone-200",
|
||||
"bg-stone-100 dark:bg-stone-800",
|
||||
"border-stone-200 dark:border-stone-900"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -10,7 +10,7 @@ export function ComingSoonBadge({ when = "soon" }: { when?: string }) {
|
||||
"text-[0.6rem]",
|
||||
"px-1 py-0.5",
|
||||
"rounded-xl",
|
||||
"align-text-top",
|
||||
"align-text-top"
|
||||
)}
|
||||
>
|
||||
Coming {when}
|
||||
|
||||
@@ -6,8 +6,8 @@ export function GridCard(props: { children: ReactNode; className?: string }) {
|
||||
<div
|
||||
className={clsx(
|
||||
"col-span-2 p-4 [&>h4]:mt-0 [&>h3]:mt-0 [&>:last-child]:mb-0",
|
||||
"border rounded-xl shadow-sm",
|
||||
props.className,
|
||||
"border border-stone-200 dark:border-stone-900 rounded-xl shadow-sm",
|
||||
props.className
|
||||
)}
|
||||
>
|
||||
{props.children}
|
||||
|
||||
@@ -15,7 +15,7 @@ export function H1({ children, className }: HeadingProps) {
|
||||
"text-5xl lg:text-6xl",
|
||||
"mb-3",
|
||||
"font-medium",
|
||||
"tracking-tighter",
|
||||
"tracking-tighter"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
@@ -30,10 +30,10 @@ export function H2({ children, className }: HeadingProps) {
|
||||
className,
|
||||
"font-display",
|
||||
"text-stone-950 dark:text-white",
|
||||
"text-2xl md:text-4xl",
|
||||
"text-2xl",
|
||||
"mb-2",
|
||||
"font-semibold",
|
||||
"tracking-tight",
|
||||
"tracking-tight"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
@@ -48,10 +48,10 @@ export function H3({ children, className }: HeadingProps) {
|
||||
className,
|
||||
"font-display",
|
||||
"text-stone-950 dark:text-white",
|
||||
"text-xl md:text-2xl",
|
||||
"text-xl",
|
||||
"mb-2",
|
||||
"font-semibold",
|
||||
"tracking-tight",
|
||||
"tracking-tight"
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export function LI({ children }: { children: React.ReactNode }) {
|
||||
return <li className="marker:text-stone-500 marker:text-lg">{children}</li>;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,3 @@
|
||||
import clsx from "clsx";
|
||||
|
||||
export function P({
|
||||
children,
|
||||
className,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}) {
|
||||
return <p className={clsx(className, "mb-4")}>{children}</p>;
|
||||
export function P({ children }: { children: React.ReactNode }) {
|
||||
return <p className="mb-4">{children}</p>;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user