diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..26e61e9
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,50 @@
+name: Deploy Vite app to GitHub Pages
+
+on:
+ push:
+ branches: [ master ]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: "pages"
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+
+ - name: Setup Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: yarn
+
+ - name: Install dependencies
+ run: yarn install --frozen-lockfile
+
+ - name: Build Vite app
+ run: yarn build
+
+ - name: Upload build artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: dist
+
+ deploy:
+ needs: build
+ runs-on: ubuntu-latest
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/src/App.tsx b/src/App.tsx
index 21cde67..9f43aad 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -24,6 +24,13 @@ import { action } from 'mobx';
import { createContext, useContext, useState } from 'react';
import { InfoDialog } from './components/dialogs/InfoDialog';
+const PUSH_DIR: Record<0 | 1 | 2 | 3, boolean> = {
+ 0: true,
+ 1: false, // 왼쪽 위 코너: 우클릭이 안쪽이었으니 반대로!
+ 2: true,
+ 3: true, // 오른쪽 위 코너: 우클릭이 이미 바깥쪽이므로 그대로
+};
+
const graph = genGraph();
export enum Mode {
@@ -41,6 +48,7 @@ export enum ExplodingState {
export class AppViewModel extends BaseViewModel {
state = State.solved();
mode = Mode.Play;
+ view: 'front' | 'corner' = 'front';
// this is possibly the sloppiest code I've ever written but this
// was the easiest hack I could come up with to fix the stupid turning bug
@@ -154,15 +162,20 @@ export class AppViewModel extends BaseViewModel {
_side: 0 | 1 | 2 | undefined,
rightClick: boolean,
) {
- if (this.mode === Mode.Solve) return;
+ // if (this.mode === Mode.Solve) return;
+
+ // 우클릭 = push(바깥쪽), 좌클릭 = pull(안쪽)
+ const isPush = rightClick;
+
+ // 이 코너에서 push(우클릭)가 어느 방향인지
+ const pushIsClockwise = PUSH_DIR[corner];
- const clockwise = !rightClick;
+ // push는 그 방향, pull은 반대 방향
+ const clockwise = isPush ? pushIsClockwise : !pushIsClockwise;
if (this.mode === Mode.Play) {
this.state = this.state.rotate(corner, clockwise);
- }
-
- if (this.mode === Mode.Edit) {
+ } else if (this.mode === Mode.Edit) {
this.state = this.state.rotateCorner(corner, clockwise);
}
}
@@ -288,6 +301,8 @@ export const App = observer(() => {
icon={IconNames.InfoSign}
onClick={() => setShowDialog((p) => !p)}
/>
+
+
{
@@ -305,31 +320,36 @@ export const App = observer(() => {
]}
gap={5}
>
+ // trigger pages deploy
{vm.mode === Mode.Play && (
-
-
-
-
-
- )}
+
+ {/* 처음 상태로 리셋 */}
+
+
+ {/* 랜덤 섞기(셔플) */}
+
+
+)}
+
{vm.mode === Mode.Edit && (
<>
{
{cubeColorKeys
.map((key) => ({ key, color: cubeColors[key] }))
.map(({ key, color }) => (
+
)}
-
+
+
+
);