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

Platform part 2 #1049

Merged
merged 505 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
505 commits
Select commit Hold shift + click to select a range
9894284
logo
k2xl Dec 22, 2023
c39e16d
gamelogo component useabsoluteurl param
k2xl Dec 22, 2023
e9266ed
fix bug in leaderboard
k2xl Dec 22, 2023
94cf49c
use hidden
k2xl Dec 22, 2023
d93f120
more cleanup
k2xl Dec 22, 2023
11cbfb1
parallax placeholder
k2xl Dec 22, 2023
786354a
slightly less crappy
k2xl Dec 22, 2023
3a8c73e
nav/logo tweaks
sspenst Dec 22, 2023
7ac58b0
share link
sspenst Dec 22, 2023
72892d6
zoomed in logo
k2xl Dec 22, 2023
2e6bf43
increase size
k2xl Dec 22, 2023
c461df6
alt logo ideas
k2xl Dec 22, 2023
beba231
rename salt rounds
k2xl Dec 22, 2023
12be988
useAbsoluteUrl since emails need to enable that
k2xl Dec 22, 2023
f7112fa
small tweaks
sspenst Dec 22, 2023
70a2d80
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Dec 23, 2023
bfe6fcf
admin component. not great but slightly cleaner
k2xl Dec 23, 2023
c7b571f
major refactor for emails. simplify tests
k2xl Dec 23, 2023
32ab950
email tweaks
k2xl Dec 23, 2023
1e64a5f
more refactoring and fixing tests
k2xl Dec 23, 2023
4e7d489
email tweak
k2xl Dec 23, 2023
733ddcf
font
k2xl Dec 23, 2023
cea6d45
fbuild
k2xl Dec 23, 2023
40059b9
logo updates
sspenst Dec 24, 2023
3d7d741
editor updates
sspenst Dec 24, 2023
839fc2f
putting stuff back
k2xl Dec 24, 2023
f7acc09
trying. but doesnt look right on mobile yet
k2xl Dec 24, 2023
b62c456
tweaks
k2xl Dec 24, 2023
f4b8b78
generic
k2xl Dec 24, 2023
e7f3f3b
calcLevelsCompletedCount
k2xl Dec 24, 2023
62a4a43
tweak tests
k2xl Dec 24, 2023
994ee9d
dont use initialize db with stat.test to make it a bit easier to follow
k2xl Dec 24, 2023
b3bbe40
fix test
k2xl Dec 24, 2023
dcfc0d5
mobile
k2xl Dec 25, 2023
765aa59
tweak
k2xl Dec 25, 2023
d6217cd
make mobile work look less bad
k2xl Dec 25, 2023
ca2a984
tweaks
k2xl Dec 25, 2023
3654f50
trying to retrigger build to see why it is failing
k2xl Dec 25, 2023
701ee28
try another approach
k2xl Dec 25, 2023
1ed9db9
speed up initializedb
k2xl Dec 25, 2023
dbf9486
try to increase pool size
k2xl Dec 25, 2023
1de15b3
try another way...
k2xl Dec 25, 2023
db6544a
logging
k2xl Dec 26, 2023
23890cc
more logging to debug
k2xl Dec 26, 2023
53faaab
hopefully fixes issues
k2xl Dec 26, 2023
bcb065e
try another approach
k2xl Dec 26, 2023
ac4379f
could it be some weirdness like this
k2xl Dec 26, 2023
6568a10
ridic
k2xl Dec 26, 2023
35d6abb
more stuff
k2xl Dec 26, 2023
647fa58
cleanup
k2xl Dec 26, 2023
9e071ed
lets trace
k2xl Dec 26, 2023
279f992
more logging to figure out wtf
k2xl Dec 26, 2023
cf19d26
i think i fixed it
k2xl Dec 26, 2023
9cbb24b
moment of truth
k2xl Dec 26, 2023
159590a
sort users based on gametype
k2xl Dec 26, 2023
9f14227
cleanuser
k2xl Dec 26, 2023
0ab75eb
remove text from image gen
k2xl Dec 26, 2023
19f40a2
refactor migration platform script
k2xl Dec 26, 2023
02b28ad
dont use emitter in tests
k2xl Dec 26, 2023
16ae1f4
use global setup and teardown... also upgraded mongodbmemoryserver
k2xl Dec 26, 2023
db1f778
fix
k2xl Dec 26, 2023
3c1b249
cleanup
k2xl Dec 26, 2023
5ddcee8
homepage tweaks
k2xl Dec 26, 2023
0e7db16
homepage coming together
k2xl Dec 26, 2023
2da8988
more tweaks
k2xl Dec 26, 2023
63a9360
more test coverage for gift
k2xl Dec 27, 2023
99abc57
more tests for play as guest and guest convert
k2xl Dec 27, 2023
f0a1bcb
istanbul ignore
k2xl Dec 27, 2023
305ffa0
more coverage
k2xl Dec 27, 2023
bfd3f31
try to build
k2xl Dec 27, 2023
3972388
yml syntax
k2xl Dec 27, 2023
812ab92
remove on push
k2xl Dec 27, 2023
34b8de3
fix subdomain issue
k2xl Dec 27, 2023
3bac3d0
better data struct
k2xl Dec 27, 2023
f961e92
add line back
k2xl Dec 27, 2023
486d2c7
utilize app domain env var
k2xl Dec 28, 2023
da0e7cf
rename prod action
k2xl Dec 28, 2023
18384a0
try some speedup for puppet
k2xl Dec 28, 2023
bce248f
arguably faster
k2xl Dec 28, 2023
e91d7aa
other updates
k2xl Dec 28, 2023
01c46f3
try other args from stackoverflow post
k2xl Dec 28, 2023
2991c84
load it up shim page
k2xl Dec 28, 2023
7313bf9
forgot to commit levelshim
k2xl Dec 28, 2023
fb468e2
remove some other params
k2xl Dec 28, 2023
56ed2dc
less data
k2xl Dec 28, 2023
47fe1c9
more optimizations
k2xl Dec 28, 2023
eb4cd5a
reuse puppet page
k2xl Dec 28, 2023
2b340b2
fix build
k2xl Dec 28, 2023
c692fc7
share pages to prevent overwriting
k2xl Dec 28, 2023
f3bd580
failure scenario
k2xl Dec 28, 2023
b8b487c
more logging
k2xl Dec 28, 2023
3c4eb1d
try to avoid strange linux only issue via networkidle
k2xl Dec 28, 2023
09e49df
may be related to 0 height?
k2xl Dec 28, 2023
22698ab
going back to basic
k2xl Dec 29, 2023
429bb3c
hopefully resolves all the issues
k2xl Dec 29, 2023
e06e6bc
cleanup and add back args
k2xl Dec 29, 2023
e289f0a
level shim hideText
k2xl Dec 29, 2023
baf6ee7
remove puppet. doing alternative route
k2xl Dec 29, 2023
7782561
syntax
k2xl Dec 29, 2023
56281ad
use baseurl
k2xl Dec 29, 2023
4a863ad
calcLevelsCompletedCount cleanup
sspenst Dec 30, 2023
3b4f6b7
rename to NEXT_PUBLIC
k2xl Dec 30, 2023
58ebb69
cleanup
k2xl Dec 30, 2023
da155c0
trying to set NEXT_PUBLIC vars correct in dockerfile
k2xl Dec 30, 2023
cc47445
next config
k2xl Dec 30, 2023
d7c166a
Optimize dockerfiles... dont use node user to possibly allow NEXT_PUB…
k2xl Dec 30, 2023
29643fb
commented out line i need i believe
k2xl Dec 30, 2023
0fda1ca
using different method for useUrl
k2xl Dec 30, 2023
86f40f3
put back node user for Dockerfile
k2xl Dec 30, 2023
e2054af
hosttld
k2xl Dec 30, 2023
c41338f
admin page / misc cleanup
sspenst Dec 30, 2023
bdec820
profile comment css tweak
sspenst Dec 30, 2023
a00071f
gen_img checkin
k2xl Dec 30, 2023
22db4fb
coverage fixes
k2xl Dec 30, 2023
08e1a60
more coverage fixes
k2xl Dec 30, 2023
634bbc8
trying to get istanbul ignore next but not sure if it works everywhere
k2xl Dec 30, 2023
37e67ee
last attempt
k2xl Dec 30, 2023
a98891b
remove swc plugin coverage instrument
k2xl Dec 31, 2023
0f021ea
go back to what we had
k2xl Dec 31, 2023
2f543cf
best solution. mix and match ts and tsx
k2xl Dec 31, 2023
8e6ca8e
cleanup
k2xl Dec 31, 2023
d16211f
min width for search page user column on mobile when logged on
k2xl Dec 31, 2023
29d310d
matchstatus and matchresults mobile formatting to make names appear b…
k2xl Dec 31, 2023
0b6a3dd
more tightening for multiplayer matchresult and matchstatus
k2xl Dec 31, 2023
54d63eb
homepage tweak
k2xl Dec 31, 2023
c4084e2
useUrl hopefully fix on homepage
k2xl Dec 31, 2023
41557f0
more url fixes
k2xl Dec 31, 2023
ea8ef07
add logging
k2xl Jan 1, 2024
8a24f4c
better logs
k2xl Jan 1, 2024
7d20401
should fix redirect issue
k2xl Jan 1, 2024
7756703
helper for parsing stuff
k2xl Jan 1, 2024
28cb0c7
should no longer need to redirect to thinky login
k2xl Jan 1, 2024
d8ddad6
tests
k2xl Jan 1, 2024
20c5aee
fix migration script
k2xl Jan 1, 2024
6de5aca
nav search profile
k2xl Jan 2, 2024
e4c2468
tutorial
k2xl Jan 2, 2024
f307a0a
stripe updates
k2xl Jan 2, 2024
95da5db
search users ux
sspenst Jan 2, 2024
3fb5bfe
nav tweaks
k2xl Jan 2, 2024
3a66f1b
hover
k2xl Jan 2, 2024
6165822
gating
k2xl Jan 2, 2024
c0d7dd1
misc cleanup
sspenst Jan 2, 2024
1950a70
fix useUrl for development
sspenst Jan 2, 2024
d60cbb1
regen img secret.
k2xl Jan 2, 2024
afaf80b
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Jan 2, 2024
3cac6fb
game.disableRanked
sspenst Jan 2, 2024
7db7c67
turn off bail since it causes vscode test to not show
k2xl Jan 2, 2024
3ea3d80
tour updates
sspenst Jan 2, 2024
95bcfcd
fix tests
k2xl Jan 2, 2024
110b5c3
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Jan 2, 2024
ac9bed5
fix mp issue
k2xl Jan 2, 2024
f29a172
fix redirect
k2xl Jan 2, 2024
629d73c
tutorial tweaks
sspenst Jan 2, 2024
0412968
collections gameid
k2xl Jan 3, 2024
0b62f54
better error messages for guest account
k2xl Jan 3, 2024
82b5b0b
validation functions for games and better messaging in level editor
k2xl Jan 3, 2024
c9de9b3
editor start fix (untested)
sspenst Jan 3, 2024
c86ecf4
fix test
k2xl Jan 3, 2024
74c91a3
misc tweaks
sspenst Jan 3, 2024
640bf4e
fix modal to never have width bigger than screen
k2xl Jan 3, 2024
74cf721
some margin
k2xl Jan 3, 2024
d52cfa1
migrate customerid
k2xl Jan 3, 2024
664d8de
mobiledevicetoken move
k2xl Jan 3, 2024
468309e
config test fix
k2xl Jan 3, 2024
b8ba762
better modal max width fix
sspenst Jan 3, 2024
6826961
fix build / lint
sspenst Jan 3, 2024
981be8f
api subscription with existing customerid
k2xl Jan 4, 2024
998ad02
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Jan 4, 2024
a0babf7
levelcard image background
sspenst Jan 4, 2024
0852a84
url wrap
k2xl Jan 4, 2024
77bfd54
cache improve
k2xl Jan 4, 2024
ade6758
timestamps
k2xl Jan 4, 2024
9ecad05
sokoban editor + grid ux
sspenst Jan 4, 2024
5202f08
fix tests
sspenst Jan 4, 2024
115c966
sokoban canvas previews
sspenst Jan 4, 2024
d0f8486
subscription updates
k2xl Jan 5, 2024
c20a6f4
cleanup
k2xl Jan 5, 2024
945335b
new logo?
sspenst Jan 5, 2024
4337331
fix tests
k2xl Jan 5, 2024
b148680
some gameplay styling tweaks
sspenst Jan 5, 2024
6a73f4c
refactor grid to pass down theme and game
k2xl Jan 5, 2024
df172c1
merge conflict
k2xl Jan 5, 2024
cd537e3
more fix test
k2xl Jan 5, 2024
b0c4bc4
fix last tests
k2xl Jan 5, 2024
d549ad7
animatedgrid working
k2xl Jan 5, 2024
af8db33
more realistic movements
k2xl Jan 5, 2024
9ca38e5
fix build
k2xl Jan 5, 2024
0cd1250
get rid of parallax
k2xl Jan 5, 2024
b1ae6df
Completioncalc (#1062)
k2xl Jan 6, 2024
585c3e5
invalid direction test
k2xl Jan 6, 2024
7ba09d5
fix tests for real
k2xl Jan 6, 2024
0bd0a5a
tutorial completion-oriented fixes
sspenst Jan 6, 2024
55f0828
hasPro
sspenst Jan 6, 2024
b1f2487
remove react-scroll-parallax
k2xl Jan 6, 2024
bbd4a95
kingoreo text updates
sspenst Jan 6, 2024
23f8af3
maybe this works
k2xl Jan 6, 2024
07ef8dc
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Jan 6, 2024
e64ac7a
Go back to pngServer
k2xl Jan 6, 2024
8a1e8fb
force reload on logout
k2xl Jan 6, 2024
48eddb3
mobile icons and json update
k2xl Jan 6, 2024
cddff11
icons
k2xl Jan 6, 2024
3bce1c8
icons checkin
k2xl Jan 6, 2024
1560cb9
fix test
sspenst Jan 6, 2024
efa8504
app tweaks for build
sspenst Jan 7, 2024
8a8614d
logos
sspenst Jan 7, 2024
ab9e176
Merge branch 'main' into platform_part_2
sspenst Jan 7, 2024
1cdb715
revert mobile changes
sspenst Jan 7, 2024
e10cfbd
more suble background image
k2xl Jan 7, 2024
c9064e6
more videos on homepage
k2xl Jan 7, 2024
2002ff2
moving new level notification to post gen image
k2xl Jan 7, 2024
8dd59aa
forgot to commit
k2xl Jan 7, 2024
31b4363
process queue messages to fix test
k2xl Jan 7, 2024
8590a63
use a pool of mongomemoryservers to make tests less flaky
k2xl Jan 7, 2024
2da336c
fix font error
sspenst Jan 7, 2024
84f75b8
Merge branch 'main' into platform_part_2
sspenst Jan 7, 2024
e563373
sokoban logo ideas
sspenst Jan 8, 2024
d8cb7dd
fix dbConnect bug
sspenst Jan 8, 2024
7577cd4
nav improvements on thinky; page gating
sspenst Jan 8, 2024
c0757ec
more page gating
sspenst Jan 8, 2024
e3b1c90
fix userconfig gameId bugs
sspenst Jan 8, 2024
95019a2
fix minor zindex ux bug
sspenst Jan 8, 2024
fa4c64e
thinky email
k2xl Jan 8, 2024
017ddee
email names
k2xl Jan 8, 2024
7270430
Merge branch 'platform_part_2' of github.com:sspenst/pathology into p…
k2xl Jan 8, 2024
f06228d
Email title & return tweaks and redirectToLogin
k2xl Jan 8, 2024
f984cf7
fix issues with redirectToLogin. should work now
k2xl Jan 8, 2024
fd6692c
encode
k2xl Jan 8, 2024
f3e3436
lint errors
k2xl Jan 8, 2024
beb5c00
as any
k2xl Jan 8, 2024
767265b
reload listener
k2xl Jan 8, 2024
5a2cabd
reload command
k2xl Jan 8, 2024
f59a437
remove guest from pulling from roles
k2xl Jan 8, 2024
a388bc1
curator
k2xl Jan 8, 2024
29767f1
more renaming
k2xl Jan 8, 2024
5dabe8a
cleaning up pathology things
sspenst Jan 8, 2024
266f4f9
need-mobile-update page
sspenst Jan 8, 2024
b718247
consistent font for now - can update later if we want
sspenst Jan 8, 2024
274c2fa
fix block on exit rotate bugs
sspenst Jan 8, 2024
6d4d827
homepage updates
sspenst Jan 8, 2024
ec7d40d
fix some home page issues
sspenst Jan 8, 2024
692bcb5
tutorial tweaks
sspenst Jan 8, 2024
9b1e90b
home page tweaks for mobile
sspenst Jan 8, 2024
48645c2
revert api/level/image changes
sspenst Jan 8, 2024
2fcdfa6
forgot Content-Length header
sspenst Jan 8, 2024
5e023ad
FormattedDifficulty refactor
sspenst Jan 8, 2024
7c1987a
complete color refactor
sspenst Jan 8, 2024
b76028b
minor migration cleanup
sspenst Jan 9, 2024
62e9f0c
minor gameId
sspenst Jan 9, 2024
6204bbe
need-mobile-update.html
sspenst Jan 9, 2024
8bf3427
redirect_type
k2xl Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.js
25 changes: 15 additions & 10 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ name: Build and Publish
on:
push:
paths-ignore:
- 'tests/**'
branches: [main]
- 'tests/**'
branches:
- main
- platform_part_2 # Add this line
Duceswild99 marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
paths-ignore:
- 'tests/**'
- 'tests/**'
branches:
- main
- platform_part_2 # Add this line

jobs:
build-and-push-docker-image:
Expand All @@ -31,7 +36,7 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/platform_part_2'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
Expand All @@ -57,25 +62,25 @@ jobs:
${{ secrets.DOCKERHUB_USERNAME }}/pathology-socket:latest
${{ secrets.DOCKERHUB_USERNAME }}/pathology-socket:${{ steps.vars.outputs.sha_short }}
${{ secrets.DOCKERHUB_USERNAME }}/pathology-socket:${{ steps.docker_build_version.outputs.version }}
push: ${{ github.ref == 'refs/heads/main' }}
push: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/platform_part_2' }}

config:
name: Config
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/platform_part_2'
runs-on: ubuntu-latest
outputs:
get-server-ip-list: ${{ steps.get-server-ip-list.outputs.get-server-ip-list }}
steps:
- id: get-server-ip-list
name: Get Server IP List
run: echo "get-server-ip-list=$(dig +short app-servers.pathology.gg TXT | jq -cr 'split(",")')" >> $GITHUB_OUTPUT
run: echo "get-server-ip-list=$(dig +short app-servers.pathology.gg TXT | jq -cr 'split(\",\")')" >> $GITHUB_OUTPUT
- name: print output
run: |
echo "${{ steps.get-server-ip-list.outputs.get-server-ip-list }}"
echo "${{ steps.get-server-ip-list.outputs.get-server-ip-list }}"

deploy-to-staging:
name: Deploy to Staging
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/platform_part_2'
runs-on: ubuntu-latest
needs: [build-and-push-docker-image, config]
strategy:
Expand All @@ -98,4 +103,4 @@ jobs:
SSH_KEY: ${{ secrets.SERVER_SSH_KEY }}

- name: Update Environments with New Containers
run: ssh ${{ matrix.server }} 'bash /opt/pathology/scripts/update-Environments.sh -e stage -v ${{ needs.build-and-push-docker-image.outputs.sha_version }}'
run: ssh ${{ matrix.server }} 'bash /opt/pathology/scripts/update-Environments.sh -e stage -v ${{ needs.build-and-push-docker-image.outputs.sha_version }}'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Production
name: Update Env

on:
workflow_dispatch:
Expand All @@ -9,23 +9,23 @@ on:
default: 'prod'
type: choice
options:
- stage
- prod
- stage
- prod
action:
description: 'Desired action against env'
required: true
default: 'update'
type: choice
options:
- update
- revert
- update
- revert
desired_sha:
description: "[Optional] Target Short SHA"
description: '[Optional] Target Short SHA'
required: false
default: ''
type: string
deployment_description:
description: "A brief description of what changed in this deployment"
description: 'A brief description of what changed in this deployment'
required: false
default: 'Production Update/Revert via Github Action'
type: string
Expand All @@ -41,7 +41,7 @@ jobs:
run: echo "get-server-ip-list=$(dig +short app-servers.pathology.gg TXT | jq -cr 'split(",")')" >> $GITHUB_OUTPUT
- name: print output
run: |
echo "${{ steps.get-server-ip-list.outputs.get-server-ip-list }}"
echo "${{ steps.get-server-ip-list.outputs.get-server-ip-list }}"
deploy-new-containers:
name: Update Production
runs-on: ubuntu-latest
Expand Down Expand Up @@ -72,4 +72,4 @@ jobs:

- name: Update Environments with New Containers - With SHA
if: github.event.inputs.desired_sha != ''
run: ssh ${{ matrix.server }} 'bash /opt/pathology/scripts/update-Environments.sh -e ${{ inputs.environment }} -a ${{ inputs.action }} -c "${{ inputs.deployment_description }}" -v "${{ inputs.desired_sha }}"'
run: ssh ${{ matrix.server }} 'bash /opt/pathology/scripts/update-Environments.sh -e ${{ inputs.environment }} -a ${{ inputs.action }} -c "${{ inputs.deployment_description }}" -v "${{ inputs.desired_sha }}"'
20 changes: 20 additions & 0 deletions .swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true,
"dynamicImport": true,
"preserveAllComments": true
},
"preserveAllComments": true,
"minify": {},
"target": "es2022",
"transform": {
"react": {
"runtime": "automatic"
}
},
},

}

7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ ARG OFFLINE_BUILD=true

RUN npm config set fund false

WORKDIR /pathology_app

# ts-node / tspath is needed for other scripts right now. module-alias is used for socket server production
# ideally all would use package module alias and we would not need ts-node / tspath. but that's a TODO
RUN npm install -g ts-node typescript module-alias

COPY --chown=node:node package*.json ./

RUN npm install --platform=linux --arch=x64 sharp
RUN npm install --platform=linuxmusl
RUN chown -R node:node node_modules/
#RUN chown -R node:node node_modules/

COPY --chown=node:node . .

# for web app
RUN npm run build --omit=dev
RUN chown -R node:node .next/
#RUN chown -R node:node .next/

# for socket server
RUN tsc -p tsconfig-socket.json
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM node:20
FROM node:20

ENV NEXT_TELEMETRY_DISABLED=1

WORKDIR /pathology_app

COPY --chown=node:node package*.json tsconfig-socket.json ./


RUN npm install

# ts-node / tspath is needed for other scripts right now. module-alias is used for socket server production
Expand All @@ -18,7 +20,6 @@ COPY --chown=node:node . .

# for dev you don't need to run tsc


# Uncomment the following line if you want to run the app as a non-root user
# USER node

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# <img src="public/logo.svg"> [Pathology](https://pathology.gg)
# <img src="public/logos/thinky/thinky.svg"> [Thinky.gg](https://thinky.gg)

[![codecov](https://codecov.io/gh/sspenst/pathology/branch/main/graph/badge.svg?token=BX0RSQ9R57)](https://codecov.io/gh/sspenst/pathology)
![Tests](https://github.com/sspenst/pathology/actions/workflows/node.js.yml/badge.svg)
[![](https://dcbadge.vercel.app/api/server/j6RxRdqq4A?style=flat&theme=default-inverted)](https://discord.gg/j6RxRdqq4A)

Shortest path puzzle game. Get to the exit in the least number of moves.
Thinky is a platform dedicated to high-quality puzzle games. Solve and optimize puzzles, or create your own for everyone to play!

## Dev Environment

Expand Down
146 changes: 146 additions & 0 deletions components/admin/sendAdminMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
import { Menu, Transition } from '@headlessui/react';
import AdminCommand from '@root/constants/adminCommand';
import Role from '@root/constants/role';
import { IAdminCommand } from '@root/pages/[subdomain]/admin';
import React, { Fragment, useState } from 'react';
import toast from 'react-hot-toast';
import ReactTextareaAutosize from 'react-textarea-autosize';

interface SendAdminMessageProps {
runningCommand: boolean;
selectedUserCommand?: IAdminCommand;
setRunningCommand: (running: boolean) => void;
}

export default function SendAdminMessage({ runningCommand, selectedUserCommand, setRunningCommand }: SendAdminMessageProps) {
const [adminHref, setAdminHref] = useState('');
const [adminMessage, setAdminMessage] = useState('');
const [adminMessageRole, setAdminMessageRole] = useState<Role | null>(Role.ADMIN);

async function runCommandAdmin() {
if (selectedUserCommand?.confirm && !window.confirm('Are you sure you want to proceed?')) return;

setRunningCommand(true);
toast.dismiss();
toast.loading('Running command...');

const payload = JSON.stringify({
href: adminHref,
message: adminMessage,
});

const resp = await fetch('/api/admin', {
method: 'POST',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
command: AdminCommand.SendAdminMessage,
role: adminMessageRole,
payload: payload,
}),
});

setRunningCommand(false);
const json = await resp.json();

toast.dismiss();

if (json.error) {
toast.error(json.error);
} else {
toast.success('Command ran successfully');
}
}

return (
<div className='flex flex-col gap-2'>
<h2 className='text-2xl font-medium'>
Send Admin Message
</h2>
<ReactTextareaAutosize
className='bg-inherit block py-1 -mt-2 w-96 max-w-full border-b border-neutral-500 disabled:text-neutral-500 transition resize-none placeholder:text-neutral-500 focus:outline-0 rounded-none focus:border-black focus:dark:border-white'
onChange={(e) => setAdminMessage(e.currentTarget.value)}
placeholder='Admin message...'
value={adminMessage}
/>
<ReactTextareaAutosize
className='bg-inherit block py-1 -mt-2 w-96 max-w-full border-b border-neutral-500 disabled:text-neutral-500 transition resize-none placeholder:text-neutral-500 focus:outline-0 rounded-none focus:border-black focus:dark:border-white'
onChange={(e) => setAdminHref(e.currentTarget.value)}
placeholder='Href (eg: "/settings/pro")...'
value={adminHref}
/>
<div className='flex gap-2 items-center'>
<span>To:</span>
<Menu as='div' className='relative inline-block text-left'>
<Menu.Button
aria-expanded='true'
aria-haspopup='true'
className='flex items-center w-full justify-center rounded-md bg-white pl-2 p-1 text-sm font-medium text-black gap-1 h-8 shadow-md border hover:opacity-70'
id='menu-button'
style={{
borderColor: 'var(--bg-color-3)',
}}
>
{adminMessageRole ?? 'All'}
<svg className='h-5 w-5' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='currentColor' aria-hidden='true'>
<path fillRule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clipRule='evenodd' />
</svg>
</Menu.Button>
<Transition
as={Fragment}
enter='transition ease-out duration-100'
enterFrom='transform opacity-0 scale-95'
enterTo='transform opacity-100 scale-100'
leave='transition ease-in duration-75'
leaveFrom='transform opacity-100 scale-100'
leaveTo='transform opacity-0 scale-95'
>
<Menu.Items className='absolute right-0 z-10 mt-1 rounded-md overflow-hidden border bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border-color-1'>
<div>
{Object.values(Role).map(role => (
<Menu.Item key={`role-${role}`}>
{({ active }) => (
<button
className='text-black block p-1 text-sm w-28 flex items-center gap-1 justify-center'
onClick={() => setAdminMessageRole(role)}
role='menuitem'
style= {{
backgroundColor: active ? 'rgb(200, 200, 200)' : '',
}}
>
{role}
</button>
)}
</Menu.Item>
))}
<Menu.Item key='role-all'>
{({ active }) => (
<button
className='text-black block p-1 text-sm w-28 flex items-center gap-1 justify-center'
onClick={() => setAdminMessageRole(null)}
role='menuitem'
style= {{
backgroundColor: active ? 'rgb(200, 200, 200)' : '',
}}
>
All
</button>
)}
</Menu.Item>
</div>
</Menu.Items>
</Transition>
</Menu>
</div>
<button
className={`bg-blue-500 hover:enabled:bg-blue-700 text-white font-bold py-2 px-4 rounded ${runningCommand ? 'bg-gray-500 cursor-not-allowed' : ''}`}
disabled={runningCommand}
onClick={runCommandAdmin}
>
Run
</button>
</div>
);
}
4 changes: 2 additions & 2 deletions components/buttons/filterButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface FilterButtonProps {
}

export default function FilterButton({ element, first, last, onClick, proRequired, selected, transparent, value }: FilterButtonProps) {
const { user } = useContext(AppContext);
const { game, user } = useContext(AppContext);
const proDisabled = !isPro(user) && proRequired;

return (
Expand All @@ -36,7 +36,7 @@ export default function FilterButton({ element, first, last, onClick, proRequire
toast.dismiss();
toast.error(
<div className='text-lg'>
Requires <Link href='/settings/pro' className='text-blue-500'>Pathology Pro</Link>
Requires <Link href='/settings/pro' className='text-blue-500'>{game.displayName} Pro</Link>
</div>,
{
duration: 3000,
Expand Down
8 changes: 2 additions & 6 deletions components/cards/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ export default function Card({ children, id, title, tooltip }: CardProps) {
const tooltipId = `card-tooltip-${id}`;

return (
<div className='flex flex-col justify-center rounded-lg border max-w-full'
<div className='flex flex-col items-center max-w-full h-fit gap-4'
id={id}
style={{
backgroundColor: 'var(--bg-color-2)',
borderColor: 'var(--bg-color-3)',
}}
>
<h2 className='self-center px-4 pt-3 text-lg font-bold text-center' data-tooltip-id={tooltipId} data-tooltip-content={tooltip}>
<h2 className='text-xl font-bold' data-tooltip-id={tooltipId} data-tooltip-content={tooltip}>
{title}
</h2>
<StyledTooltip id={tooltipId} />
Expand Down
Loading
Loading