Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #235

Closed
wants to merge 353 commits into from
Closed

Test #235

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
353 commits
Select commit Hold shift + click to select a range
618eb91
clean
Kluskey Oct 2, 2024
bced4b4
auth fixes
Kluskey Oct 2, 2024
980b145
clean inner control bar
Kluskey Oct 2, 2024
4bb0d07
control bar, hierarchy
Kluskey Oct 2, 2024
66191ae
rm boilerplate from rtk
Kluskey Oct 2, 2024
1a88dba
rename
Kluskey Oct 2, 2024
4709f67
clean
Kluskey Oct 2, 2024
a0c1aa0
layout
Kluskey Oct 2, 2024
daccf59
fix build layout!
Kluskey Oct 2, 2024
59e40aa
control bar adjustments
Kluskey Oct 2, 2024
b285458
license update
Kluskey Oct 4, 2024
fff0c7c
update LICENSE
Kluskey Oct 4, 2024
faba9c4
license
Kluskey Oct 4, 2024
d1ff26e
add asset search + throttle
Kluskey Oct 4, 2024
5018245
redux-undo add
Kluskey Oct 5, 2024
575f355
fix build layout
Kluskey Oct 5, 2024
c9abaa1
add engine
Kluskey Oct 5, 2024
0d903f9
layout clean
Kluskey Oct 5, 2024
a591e51
search asset fix
Kluskey Oct 5, 2024
c0ec839
break out assets migration into separate file
Kluskey Oct 5, 2024
65c9972
home fix
Kluskey Oct 5, 2024
c0b0da9
text search assets
Kluskey Oct 5, 2024
3aa1544
add description, computed columns
Kluskey Oct 5, 2024
7646e71
name prefix search assets spaces
Kluskey Oct 5, 2024
d039d25
fix display
Kluskey Oct 5, 2024
abc791d
same
Kluskey Oct 5, 2024
e70bf12
asset search fixes
Kluskey Oct 5, 2024
da3157b
real time text search
Kluskey Oct 5, 2024
6af9f71
asset search
Kluskey Oct 5, 2024
dc9635b
add recent assets
Kluskey Oct 5, 2024
cf7d726
storage thumb
Kluskey Oct 5, 2024
64c191f
sidebar optimize
Kluskey Oct 5, 2024
9ed4918
basic file upload!
Kluskey Oct 5, 2024
019b1ea
lift dropzone
Kluskey Oct 5, 2024
eb48c35
update asset url to be id not name
Kluskey Oct 5, 2024
756a279
dropzone
Kluskey Oct 5, 2024
5b78ca8
copy
Kluskey Oct 5, 2024
8c983a9
border
Kluskey Oct 5, 2024
bfbc000
asset tags
Kluskey Oct 5, 2024
ceb84ff
key prop
Kluskey Oct 5, 2024
1ea0024
add right click download asset
Kluskey Oct 5, 2024
2d9e312
x toggle
Kluskey Oct 5, 2024
9b2b5c8
basic scene ui
Kluskey Oct 5, 2024
84ba467
del scene
Kluskey Oct 5, 2024
5dddcfd
scene name edit
Kluskey Oct 5, 2024
1aabeaa
hover on scene
Kluskey Oct 5, 2024
46ae5d8
clean
Kluskey Oct 5, 2024
2b07c11
two way input polish
Kluskey Oct 5, 2024
1055da3
add entities crud
Kluskey Oct 5, 2024
c2dfea3
change from hover to click sidebar
Kluskey Oct 5, 2024
1807ffd
local
Kluskey Oct 5, 2024
dcb8697
near bsic tree
Kluskey Oct 5, 2024
60c5012
formatting
Kluskey Oct 5, 2024
fe20af6
clean format
Kluskey Oct 5, 2024
05137ea
depth fix + dragdrop
Kluskey Oct 5, 2024
55b798e
node key dragdrop clea
Kluskey Oct 6, 2024
a22c73f
drag drop keep parent open
Kluskey Oct 6, 2024
dbcc8e8
clean
Kluskey Oct 6, 2024
2132376
WIP
Kluskey Oct 6, 2024
9924a8a
boilerplate working
Kluskey Oct 6, 2024
dd15f8b
import
Kluskey Oct 6, 2024
bf14ac3
working bg
Kluskey Oct 6, 2024
9bd9354
clean
Kluskey Oct 6, 2024
d2d14c4
hide action menu tree item
Kluskey Oct 6, 2024
5095423
child type rm
Kluskey Oct 6, 2024
1653717
rm movedialog
Kluskey Oct 6, 2024
18c798d
clean
Kluskey Oct 6, 2024
bd38fac
clean
Kluskey Oct 6, 2024
a45000e
clean
Kluskey Oct 6, 2024
3e61b50
clean
Kluskey Oct 6, 2024
4983af3
basic scene crud
Kluskey Oct 6, 2024
4153466
add currentscene
Kluskey Oct 6, 2024
639428c
entity work
Kluskey Oct 6, 2024
831ea27
working entities crud
Kluskey Oct 7, 2024
076f5fd
break slices into different files
Kluskey Oct 7, 2024
2db7c9c
cache polish
Kluskey Oct 7, 2024
8252dd5
add component CRUD
Kluskey Oct 7, 2024
c194b52
clean
Kluskey Oct 7, 2024
9b10f04
component entities updates
Kluskey Oct 7, 2024
b2528fd
rm component name
Kluskey Oct 7, 2024
c954a3f
entities
Kluskey Oct 7, 2024
008ef65
create scene upon space creation
Kluskey Oct 7, 2024
dae06b1
entity children setup
Kluskey Oct 7, 2024
ca8569f
updatable entity name hierarchy
Kluskey Oct 7, 2024
724d574
basic parent update setup
Kluskey Oct 7, 2024
105ebb5
working child tree item saving
Kluskey Oct 7, 2024
7113627
optional children add
Kluskey Oct 7, 2024
0c6a2ce
clean
Kluskey Oct 7, 2024
ec7fde6
bug fixes for cachcing
Kluskey Oct 7, 2024
3e0409f
working reordering of entities!
Kluskey Oct 7, 2024
d2bd909
optimize entity queries
Kluskey Oct 8, 2024
7b0ceda
working .children refactor pt 1
Kluskey Oct 8, 2024
bcb2979
clean the junk
Kluskey Oct 8, 2024
4d83fd0
clean more atlassian junk
Kluskey Oct 8, 2024
f974c59
packages
Kluskey Oct 8, 2024
8787011
progress
Kluskey Oct 8, 2024
26fa74a
hook up entities
Kluskey Oct 8, 2024
fab88cd
cleaning tree
Kluskey Oct 8, 2024
4f0447d
root entity
Kluskey Oct 8, 2024
13deafa
sidebar size fix
Kluskey Oct 8, 2024
402df2a
fix for input firing w/o change
Kluskey Oct 8, 2024
0f5937d
progress on saving entity
Kluskey Oct 8, 2024
4404ea7
tree mostly working
Kluskey Oct 8, 2024
690d947
clean query
Kluskey Oct 8, 2024
c5c3626
clean query
Kluskey Oct 8, 2024
f50dd5b
clean query
Kluskey Oct 8, 2024
38b3b3e
add constraint that parent_id can't be entity_id
Kluskey Oct 8, 2024
ba237a2
fix circular tree references
Kluskey Oct 8, 2024
52f2e58
clean
Kluskey Oct 8, 2024
cf65de8
scene switching
Kluskey Oct 9, 2024
bf5677d
viewport spacing fixes
Kluskey Oct 9, 2024
c7ce45a
fix entity API errors
Kluskey Oct 9, 2024
2042751
motion duration
Kluskey Oct 9, 2024
d776e65
persist entity expanded/collapsed across renders
Kluskey Oct 9, 2024
736b704
persist scene open closed across renders
Kluskey Oct 9, 2024
933b96f
boilerplate playcanvas add
Kluskey Oct 9, 2024
e4d5ddb
play button
Kluskey Oct 9, 2024
a43dc5b
play build working
Kluskey Oct 9, 2024
f78b6cb
typo
Kluskey Oct 9, 2024
75e1a35
clean
Kluskey Oct 9, 2024
7cd5498
new scene creates 2 entities
Kluskey Oct 9, 2024
d7ba791
scene creation updates anf cies
Kluskey Oct 9, 2024
3322712
polish buttons
Kluskey Oct 9, 2024
8d1feef
fix auto expanded entities
Kluskey Oct 9, 2024
081b64d
more fixes
Kluskey Oct 9, 2024
116e8bf
font fixes
Kluskey Oct 9, 2024
12c0c1f
entity tree clean
Kluskey Oct 10, 2024
4a49d1a
add focus color entity
Kluskey Oct 10, 2024
8783825
fix sidebar spacing
Kluskey Oct 10, 2024
1f8af5b
add analytics base
Kluskey Oct 10, 2024
a449b95
add ga
Kluskey Oct 10, 2024
93c63cf
analytics update
Kluskey Oct 10, 2024
55663f0
analytics fixes
Kluskey Oct 10, 2024
7b0826f
clean
Kluskey Oct 10, 2024
a983da7
clean
Kluskey Oct 10, 2024
c500a81
effects for pc update 1
Kluskey Oct 10, 2024
797f426
inspector v0
Kluskey Oct 10, 2024
bd2748a
update input styling
Kluskey Oct 10, 2024
ad51925
clean autocomplete
Kluskey Oct 10, 2024
af3940e
separator
Kluskey Oct 10, 2024
428d79e
two way input polish
Kluskey Oct 10, 2024
b6a87d4
fix space viewport
Kluskey Oct 11, 2024
4d85d42
clean + home redirects
Kluskey Oct 11, 2024
62826b4
home redir
Kluskey Oct 11, 2024
6e384f6
license text updaet
Kluskey Oct 11, 2024
debe00b
license
Kluskey Oct 11, 2024
7d2a4dc
upgrade deps + pin node 22
Kluskey Oct 11, 2024
dea03a6
fix window undefined
Kluskey Oct 11, 2024
8611618
fix window is not defined error, remove ga
Kluskey Oct 11, 2024
94dba55
clean
Kluskey Oct 11, 2024
94ac340
fix canvas fill mode
Kluskey Oct 11, 2024
895dc79
fix entity font
Kluskey Oct 11, 2024
acbe2af
polish entity tree
Kluskey Oct 11, 2024
c99372d
entity polish
Kluskey Oct 11, 2024
98d8bd7
fix entity selection
Kluskey Oct 11, 2024
8a1c3b8
fix switcher css
Kluskey Oct 11, 2024
76d3aab
polish
Kluskey Oct 11, 2024
f4b2627
polish
Kluskey Oct 11, 2024
36fb142
abstract entity formgroup
Kluskey Oct 11, 2024
9628a6c
entity form group design
Kluskey Oct 11, 2024
b273ca3
working vec3 entity update
Kluskey Oct 11, 2024
0fb4fb7
vec3 inputs working nicely
Kluskey Oct 11, 2024
867a5dc
clean
Kluskey Oct 11, 2024
df10cf2
fix generic entity
Kluskey Oct 11, 2024
7f58f9e
prevent default on enter key
Kluskey Oct 11, 2024
af88a24
inspector entity name
Kluskey Oct 11, 2024
3e29db5
rename synced text input
Kluskey Oct 11, 2024
8e22a17
rename vec3 input
Kluskey Oct 11, 2024
fc821e7
text input polish
Kluskey Oct 11, 2024
616387e
add enabled checkbox
Kluskey Oct 12, 2024
01f2efc
rename synced text input
Kluskey Oct 12, 2024
8d87c45
fix issue with entity batch update; add unique check
Kluskey Oct 12, 2024
ce03a93
boilerplate viewport
Kluskey Oct 12, 2024
809f2ca
add vscode debugging
Kluskey Oct 12, 2024
c306515
clean
Kluskey Oct 12, 2024
d144e5a
add in engine defaults
Kluskey Oct 12, 2024
7839023
basic proj import working
Kluskey Oct 12, 2024
77e67ba
build and play
Kluskey Oct 12, 2024
d3d0470
play fix
Kluskey Oct 12, 2024
067b31a
build view
Kluskey Oct 12, 2024
f00827c
its beautiful
Kluskey Oct 12, 2024
e30b17c
note
Kluskey Oct 12, 2024
d9df474
clean
Kluskey Oct 12, 2024
79eb20d
fix loading errors
Kluskey Oct 12, 2024
02ed3e4
fix z index
Kluskey Oct 12, 2024
2f25884
fix loading bug
Kluskey Oct 12, 2024
50b5129
add appearance transition
Kluskey Oct 12, 2024
9fc22c9
note
Kluskey Oct 12, 2024
22a3c07
clean
Kluskey Oct 12, 2024
4f4368a
fix build mode script
Kluskey Oct 12, 2024
98c1ede
clean start scripts
Kluskey Oct 12, 2024
468d542
change to start custom
Kluskey Oct 12, 2024
ef69be6
move start script
Kluskey Oct 12, 2024
4a95830
rename for space viewport v2
Kluskey Oct 12, 2024
1c59e1c
comment
Kluskey Oct 12, 2024
232d3c5
file upload initial working
Kluskey Oct 12, 2024
b866553
supabase upload working
Kluskey Oct 12, 2024
fa6f85d
abstract
Kluskey Oct 12, 2024
bcb4ec5
nearly working; WIP. About to change to runtime import
Kluskey Oct 12, 2024
cd4e0c4
WORKING IMPORT!
Kluskey Oct 12, 2024
01384d2
fix play mode
Kluskey Oct 12, 2024
17e457e
comment
Kluskey Oct 12, 2024
99caa5b
add prettier
Kluskey Oct 13, 2024
d9695ce
prettier ignore
Kluskey Oct 13, 2024
c7e05fc
run prettier on ts/tsx
Kluskey Oct 13, 2024
15b044b
fix spacing of inspector, sidebar
Kluskey Oct 13, 2024
b63078c
rm components
Kluskey Oct 13, 2024
c3bd696
change asset, scene, space id to bigint unique
Kluskey Oct 13, 2024
f2e3c50
add space_packs
Kluskey Oct 13, 2024
908500d
update ids to numbers where appropriate
Kluskey Oct 13, 2024
d232258
node version fix
Kluskey Oct 13, 2024
ea67c29
node 20 restrict
Kluskey Oct 13, 2024
bd03c4a
rm ga
Kluskey Oct 13, 2024
ebee8a9
type scenesApi
Kluskey Oct 13, 2024
e98e577
add spacepacks api
Kluskey Oct 13, 2024
f8eb12a
space packs replace pc import
Kluskey Oct 13, 2024
540b64e
rm pcimports
Kluskey Oct 13, 2024
ca6c36d
rename
Kluskey Oct 13, 2024
dd3fa33
type analytics events
Kluskey Oct 14, 2024
975951b
analytics types + api types
Kluskey Oct 14, 2024
f344269
rm engine manager old code
Kluskey Oct 14, 2024
d83f41d
rename local state, add space-packs.state
Kluskey Oct 14, 2024
e07b892
create base spacePacks slice
Kluskey Oct 14, 2024
91bf99a
typing, space packs, settings jsonb
Kluskey Oct 14, 2024
7e8f4ed
manifest file
Kluskey Oct 14, 2024
277c9d8
numerous fixes + work toward spackpack slice
Kluskey Oct 14, 2024
6346657
commen
Kluskey Oct 14, 2024
d8fcd7a
start script progress
Kluskey Oct 14, 2024
bc56d6d
analytics updates
Kluskey Oct 14, 2024
0df444f
clean spaceviewport + anims
Kluskey Oct 15, 2024
4ea31ba
clean
Kluskey Oct 15, 2024
3c74118
comment
Kluskey Oct 15, 2024
e143365
engine/viewport clean
Kluskey Oct 15, 2024
c3396a6
db types
Kluskey Oct 15, 2024
e571bf6
start fix
Kluskey Oct 15, 2024
1a94444
it appeared!
Kluskey Oct 15, 2024
4c26fc1
clean
Kluskey Oct 15, 2024
40818af
transition speed
Kluskey Oct 15, 2024
9a7d72a
fix scene creation not creating root entity
Kluskey Oct 15, 2024
fb1540a
fix get entity
Kluskey Oct 15, 2024
3ac0839
fix entities
Kluskey Oct 15, 2024
8fc6bfe
add redux subscribers for pc updates
Kluskey Oct 15, 2024
9f3e4ad
clean
Kluskey Oct 15, 2024
c5d0de2
add components, data jsonb
Kluskey Oct 15, 2024
778f373
update db types
Kluskey Oct 15, 2024
e3ce597
control bar gap
Kluskey Oct 15, 2024
46637dd
add create component button
Kluskey Oct 15, 2024
7feef88
add c
Kluskey Oct 15, 2024
3c82b2a
add components crud on entity
Kluskey Oct 15, 2024
9e23ee2
update crud component
Kluskey Oct 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/mirror-2-dev-db.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deploy Migrations to Dev

on:
push:
branches: [dev]
paths:
- 'mirror-2/**'
pull_request:
branches: [dev]
paths:
- 'mirror-2/**'
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest

env:
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
SUPABASE_DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }}
SUPABASE_PROJECT_ID: ${{ secrets.DEV_PROJECT_ID }}

steps:
- uses: actions/checkout@v3

- uses: supabase/setup-cli@v1
with:
version: latest

- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- run: supabase db push
2 changes: 2 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
The below licenses apply to everything in this repository with the exception of the /mirror-2 folder; for the mirror-2 folder, see /mirror-2/LICENSE.txt.

MIT License

Copyright (c) 2022-present The Mirror Megaverse Inc.
Expand Down
8 changes: 8 additions & 0 deletions mirror-2/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Update these with your Supabase details from your project settings > API
# https://app.supabase.com/project/_/settings/api
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=SUPABASE_CLIENT_API_KEY
NEXT_PUBLIC_APP_NAME="The Mirror" # only use The Mirror or Reflekt
NEXT_PUBLIC_DISCORD_INVITE_URL=https://themirror.space/discord
NEXT_PUBLIC_VERSION_NAME="JavaScript"
NEXT_PUBLIC_AMPLITUDE_PUBLIC_KEY=
37 changes: 37 additions & 0 deletions mirror-2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
6 changes: 6 additions & 0 deletions mirror-2/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ignore artifacts:
build
coverage
dist
# ignore JS for now because of vanilla JS file imports might mess up some text replacement. Can revisit in the future but not high priority
*.js
6 changes: 6 additions & 0 deletions mirror-2/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"endOfLine": "auto"
}
16 changes: 16 additions & 0 deletions mirror-2/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug full stack",
"type": "node-terminal",
"request": "launch",
"command": "yarn dev",
"serverReadyAction": {
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"action": "debugWithChrome"
}
}
]
}
23 changes: 23 additions & 0 deletions mirror-2/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"deno.enablePaths": ["supabase/functions"],
"deno.lint": true,
"deno.unstable": [
"bare-node-builtins",
"byonm",
"sloppy-imports",
"unsafe-proto",
"webgpu",
"broadcast-channel",
"worker-options",
"cron",
"kv",
"ffi",
"fs",
"http",
"net"
],
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
46 changes: 46 additions & 0 deletions mirror-2/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
RevShare: A Source Available License

Copyright (c) 2024-Present The Mirror Megaverse Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, subject to the following conditions:

1. Revenue Sharing Requirement
If any revenue is generated through the use of the Software, including but not limited to sales, in-game transactions, or any other form of monetization, the user agrees to pay a fee to the owner of the Software (“Company”). The fee structure and payment requirements are detailed on the Company’s website, and users are responsible for staying updated on any changes to these terms. The fee is 15% as of Sept 2024 and subject to change (the website is the source of truth for this fee if the amount in this license differs).

2. Payment in Fiat Currency
If revenue is generated in fiat currency (e.g., USD, EUR), the user agrees to remit payments to the Company based on the fee structure listed on the Company’s website. Failure to comply with these payment terms will result in the revocation of the license.

3. Payment in Cryptocurrency and Royalties for Non-Fungible Tokens
Cryptocurrency integrations are exclusive to the Reflekt version of the Software, a separate fork of The Mirror. In contrast, The Mirror version of the Software does not support cryptocurrency usage. This structure is designed to give developers the flexibility to choose between traditional web2 approaches and blockchain-integrated games.

Direct Cryptocurrency Transactions: If revenue is generated directly through the Software in the form of cryptocurrency (e.g., in-game transactions, purchases, or other forms of monetization), the user agrees to pay a 10% fee on all such transactions. Payments must be made to the Company’s wallet address as specified on its website. Users are responsible for ensuring accurate and timely payments to the listed address.

Non-Fungible Token Royalties: If the Software is used to issue or mint Non-Fungible Tokens (NFTs), the user agrees to pay a 10% royalty on all subsequent sales or transfers of the NFT, regardless of the marketplace or platform where the transaction occurs. If the NFT was minted outside of the platform and a transaction takes place using the Software, the user agrees to pay the same percent fee via direct cryptocurrency transfer to the company's wallet.

4. Warranty Disclaimer
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

By using the Software, you agree to the terms outlined above. These terms are subject to change due to early versions of the Software and the team is open to feedback!

---
The below copyright notice and MIT license is included for compliance with the MIT license of the PlayCanvas Engine: https://github.com/playcanvas/engine

Copyright (c) 2011-2024 PlayCanvas Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 1 addition & 0 deletions mirror-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Alea iacta est.
124 changes: 124 additions & 0 deletions mirror-2/actions/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
'use server'

import { createServerClient } from '@/utils/supabase/server'
import { encodedRedirect } from '@/utils/utils'
import { headers } from 'next/headers'
import { redirect } from 'next/navigation'

export const createAccountAction = async (formData: FormData) => {
const email = formData.get('email')?.toString()
const password = formData.get('password')?.toString()
const supabase = createServerClient()
const origin = headers().get('origin')

if (!email || !password) {
return { error: 'Email and password are required' }
}

const { error } = await supabase.auth.signUp({
email,
password,
options: {
emailRedirectTo: `${origin}/auth/callback`
}
})

if (error) {
console.error(error.code + ' ' + error.message)
return encodedRedirect('error', '/create-account', error.message)
} else {
return encodedRedirect(
'success',
'/create-account',
'Thanks for signing up! Please check your email for a verification link.'
)
}
}

export const loginAction = async (formData: FormData) => {
const email = formData.get('email') as string
const password = formData.get('password') as string
const supabase = createServerClient()

const { error } = await supabase.auth.signInWithPassword({
email,
password
})

if (error) {
return encodedRedirect('error', '/login', error.message)
}

return redirect('/home')
}

export const forgotPasswordAction = async (formData: FormData) => {
const email = formData.get('email')?.toString()
const supabase = createServerClient()
const origin = headers().get('origin')
const callbackUrl = formData.get('callbackUrl')?.toString()

if (!email) {
return encodedRedirect('error', '/forgot-password', 'Email is required')
}

const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: `${origin}/auth/callback?redirect_to=/protected/reset-password`
})

if (error) {
console.error(error.message)
return encodedRedirect(
'error',
'/forgot-password',
'Could not reset password'
)
}

if (callbackUrl) {
return redirect(callbackUrl)
}

return encodedRedirect(
'success',
'/forgot-password',
'Check your email for a link to reset your password.'
)
}

export const resetPasswordAction = async (formData: FormData) => {
const supabase = createServerClient()

const password = formData.get('password') as string
const confirmPassword = formData.get('confirmPassword') as string

if (!password || !confirmPassword) {
encodedRedirect(
'error',
'/protected/reset-password',
'Password and confirm password are required'
)
}

if (password !== confirmPassword) {
encodedRedirect(
'error',
'/protected/reset-password',
'Passwords do not match'
)
}

const { error } = await supabase.auth.updateUser({
password: password
})

if (error) {
encodedRedirect(
'error',
'/protected/reset-password',
'Password update failed'
)
}

encodedRedirect('success', '/protected/reset-password', 'Password updated')
}
34 changes: 34 additions & 0 deletions mirror-2/actions/name-generator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'use server'
import {
uniqueNamesGenerator,
Config,
adjectives,
colors,
animals
} from 'unique-names-generator'

const randomName: string = uniqueNamesGenerator({
dictionaries: [adjectives, animals]
})

export async function generateSpaceName() {
const customConfig: Config = {
dictionaries: [adjectives, animals],
separator: ' ',
length: 2,
style: 'capital'
}

return uniqueNamesGenerator(customConfig)
}

export async function generateSceneName() {
const customConfig: Config = {
dictionaries: [adjectives],
separator: ' ',
length: 1,
style: 'capital'
}

return uniqueNamesGenerator(customConfig)
}
14 changes: 14 additions & 0 deletions mirror-2/ampli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"Zone": "us",
"OrgId": "308710",
"WorkspaceId": "a2da908b-27c1-4013-b214-f7ce5531bbe7",
"SourceId": "b077387d-b743-4f18-bd57-94effffd3ad1",
"Runtime": "browser:typescript-ampli-v2",
"Platform": "Browser",
"Language": "TypeScript",
"SDK": "@amplitude/analytics-browser@^1.0",
"Branch": "main",
"Version": "1.0.0",
"VersionId": "84e8930d-d0e7-4c92-b6c6-629ff838c9a6",
"Path": "./src/ampli"
}
Loading
Loading