Skip to content

Commit

Permalink
Quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
PuruVJ committed Jul 16, 2024
1 parent 2418583 commit 76bf8d2
Show file tree
Hide file tree
Showing 30 changed files with 662 additions and 659 deletions.
18 changes: 18 additions & 0 deletions examples/quickstart/client/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
42 changes: 23 additions & 19 deletions examples/quickstart/client/.gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# production
/build
node_modules
dist
dist-ssr
*.local

# misc
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

npm-debug.log*
yarn-debug.log*
yarn-error.log*
server
module_bindings
48 changes: 5 additions & 43 deletions examples/quickstart/client/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,8 @@
# Getting Started with Create React App
# React + TypeScript + Vite

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

## Available Scripts
Currently, two official plugins are available:

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
13 changes: 13 additions & 0 deletions examples/quickstart/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
56 changes: 20 additions & 36 deletions examples/quickstart/client/package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,27 @@
{
"name": "quickstart",
"version": "0.1.0",
"name": "client-vite",
"private": true,
"dependencies": {
"@clockworklabs/spacetimedb-sdk": "workspace:*",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.38",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"typescript": "^4.9.5",
"web-vitals": "^2.1.4"
},
"version": "0.0.0",
"type": "module",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"eject": "react-scripts eject"
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"spacetime:generate-bindings": "spacetime generate --lang typescript --out-dir src/module_bindings --project-path ../server",
"spacetime:start": "spacetime start server",
"spacetime:publish:local": "spacetime publish chat --project-path ../server --server local",
"spacetime:publish": "spacetime publish chat --project-path ../server --server testnet"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"@clockworklabs/spacetimedb-sdk": "workspace:*"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"typescript": "^5.2.2",
"vite": "^5.3.4"
}
}
Binary file removed examples/quickstart/client/public/favicon.ico
Binary file not shown.
43 changes: 0 additions & 43 deletions examples/quickstart/client/public/index.html

This file was deleted.

Binary file removed examples/quickstart/client/public/logo192.png
Binary file not shown.
Binary file removed examples/quickstart/client/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions examples/quickstart/client/public/manifest.json

This file was deleted.

3 changes: 0 additions & 3 deletions examples/quickstart/client/public/robots.txt

This file was deleted.

104 changes: 79 additions & 25 deletions examples/quickstart/client/src/App.css
Original file line number Diff line number Diff line change
@@ -1,39 +1,93 @@
.App {
text-align: center;
padding: 2rem;
display: grid;
grid-template-rows: auto 1fr;
gap: 2rem;

height: 100%;
}

.App-logo {
height: 40vmin;
pointer-events: none;
.profile {
display: flex;
align-items: center;
flex-direction: row;
gap: 1rem;
justify-content: center;
width: 100%;
margin-top: 20px;
padding: 1rem 0;
border-bottom: 1px solid var(--theme-color);
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
h2 {
flex: 1 1 auto;
margin-bottom: 1em;
}

form {
display: contents;
}

.chatbox {
display: grid;
grid-template-rows: 1fr auto;

padding: 1rem 0;
}

.system {
position: fixed;
top: 5%;
right: 2%;

font-family: monospace;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
.new-message {
position: relative;

display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
gap: 1rem;

width: 100%;
}

.App-link {
color: #61dafb;
.new-message input {
--shadow: 0px 2.9px 10px rgba(0, 0, 0, 0.095),
0px 23px 80px rgba(0, 0, 0, 0.19);
min-width: 0;
flex: 1 1 auto;

padding: 1.7rem;
padding-right: 5rem;

border: none;
border-radius: 3rem;
background-color: var(--textbox-color);
caret-color: var(--theme-color);
font-family: monospace;
font-weight: 400;
font-size: 1rem;
resize: none;
box-shadow: var(--shadow);
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
.new-message input:focus {
outline: none;
box-shadow: var(--shadow), 0 0 0 2px var(--theme-color);
}

@media (prefers-color-scheme: dark) {
.new-message input {
--shadow: 0 0 0 1px #17492b;
}
}

.new-message button {
position: absolute;
right: 0.75rem;
top: 50%;

border-radius: 2rem;

translate: 0 -50%;
}
Loading

0 comments on commit 76bf8d2

Please sign in to comment.