Skip to content

Commit 6e456e6

Browse files
authored
Merge pull request #216 from TrashPandaCode/fixes
fixes
2 parents 847dc01 + 0d0b971 commit 6e456e6

22 files changed

Lines changed: 589 additions & 462 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
uses: peaceiris/actions-gh-pages@v4
3030
with:
3131
github_token: ${{ secrets.GITHUB_TOKEN }}
32-
publish_dir: ./build/client
32+
publish_dir: ./build/client
Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons"
4-
import classnames from "classnames"
1+
import { ChevronRightIcon, DotsHorizontalIcon } from "@radix-ui/react-icons";
2+
import { Slot } from "@radix-ui/react-slot";
3+
import classnames from "classnames";
4+
import * as React from "react";
55

66
const Breadcrumb = React.forwardRef<
77
HTMLElement,
88
React.ComponentPropsWithoutRef<"nav"> & {
9-
separator?: React.ReactNode
9+
separator?: React.ReactNode;
1010
}
11-
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
12-
Breadcrumb.displayName = "Breadcrumb"
11+
>(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
12+
Breadcrumb.displayName = "Breadcrumb";
1313

1414
const BreadcrumbList = React.forwardRef<
1515
HTMLOListElement,
@@ -18,13 +18,13 @@ const BreadcrumbList = React.forwardRef<
1818
<ol
1919
ref={ref}
2020
className={classnames(
21-
"flex flex-wrap items-center gap-1.5 break-words text-sm text-slate-500 sm:gap-2.5",
21+
"flex flex-wrap items-center gap-1.5 text-sm break-words text-slate-500 sm:gap-2.5",
2222
className
2323
)}
2424
{...props}
2525
/>
26-
))
27-
BreadcrumbList.displayName = "BreadcrumbList"
26+
));
27+
BreadcrumbList.displayName = "BreadcrumbList";
2828

2929
const BreadcrumbItem = React.forwardRef<
3030
HTMLLIElement,
@@ -35,26 +35,29 @@ const BreadcrumbItem = React.forwardRef<
3535
className={classnames("inline-flex items-center gap-1.5", className)}
3636
{...props}
3737
/>
38-
))
39-
BreadcrumbItem.displayName = "BreadcrumbItem"
38+
));
39+
BreadcrumbItem.displayName = "BreadcrumbItem";
4040

4141
const BreadcrumbLink = React.forwardRef<
4242
HTMLAnchorElement,
4343
React.ComponentPropsWithoutRef<"a"> & {
44-
asChild?: boolean
44+
asChild?: boolean;
4545
}
4646
>(({ asChild, className, ...props }, ref) => {
47-
const Comp = asChild ? Slot : "a"
47+
const Comp = asChild ? Slot : "a";
4848

4949
return (
5050
<Comp
5151
ref={ref}
52-
className={classnames("transition-colors hover:text-foreground", className)}
52+
className={classnames(
53+
"hover:text-foreground transition-colors",
54+
className
55+
)}
5356
{...props}
5457
/>
55-
)
56-
})
57-
BreadcrumbLink.displayName = "BreadcrumbLink"
58+
);
59+
});
60+
BreadcrumbLink.displayName = "BreadcrumbLink";
5861

5962
const BreadcrumbPage = React.forwardRef<
6063
HTMLSpanElement,
@@ -68,8 +71,8 @@ const BreadcrumbPage = React.forwardRef<
6871
className={classnames("font-normal text-slate-950", className)}
6972
{...props}
7073
/>
71-
))
72-
BreadcrumbPage.displayName = "BreadcrumbPage"
74+
));
75+
BreadcrumbPage.displayName = "BreadcrumbPage";
7376

7477
const BreadcrumbSeparator = ({
7578
children,
@@ -79,13 +82,13 @@ const BreadcrumbSeparator = ({
7982
<li
8083
role="presentation"
8184
aria-hidden="true"
82-
className={classnames("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
85+
className={classnames("[&>svg]:h-3.5 [&>svg]:w-3.5", className)}
8386
{...props}
8487
>
8588
{children ?? <ChevronRightIcon />}
8689
</li>
87-
)
88-
BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
90+
);
91+
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
8992

9093
const BreadcrumbEllipsis = ({
9194
className,
@@ -94,14 +97,17 @@ const BreadcrumbEllipsis = ({
9497
<span
9598
role="presentation"
9699
aria-hidden="true"
97-
className={classnames("flex h-9 w-9 items-center justify-center", className)}
100+
className={classnames(
101+
"flex h-9 w-9 items-center justify-center",
102+
className
103+
)}
98104
{...props}
99105
>
100106
<DotsHorizontalIcon className="h-4 w-4" />
101107
<span className="sr-only">More</span>
102108
</span>
103-
)
104-
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
109+
);
110+
BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
105111

106112
export {
107113
Breadcrumb,
@@ -111,4 +117,4 @@ export {
111117
BreadcrumbPage,
112118
BreadcrumbSeparator,
113119
BreadcrumbEllipsis,
114-
}
120+
};

app/lib/core/docs/search-utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ export const cleanMarkdownContent = (content: string): string => {
6161
* @returns A short description string.
6262
*/
6363
export const extractDescription = (content: string): string => {
64-
if (!content) return '';
65-
const firstParagraph = content.split('\n\n')[0] || content.split('.')[0];
66-
return firstParagraph.length > 150
67-
? firstParagraph.substring(0, 150) + '...'
64+
if (!content) return "";
65+
const firstParagraph = content.split("\n\n")[0] || content.split(".")[0];
66+
return firstParagraph.length > 150
67+
? firstParagraph.substring(0, 150) + "..."
6868
: firstParagraph;
6969
};
7070

@@ -79,4 +79,4 @@ export const createSearchIndex = () => {
7979
cache: true,
8080
resolution: 9,
8181
});
82-
};
82+
};

app/lib/core/home/components/Carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Button = React.forwardRef<
3838
<button
3939
ref={ref}
4040
className={classNames(
41-
"flex items-center cursor-pointer transition-all duration-200 justify-center bg-white text-slate-800 hover:bg-slate-200 focus:ring-2 focus:ring-slate-500 focus:outline-none",
41+
"flex cursor-pointer items-center justify-center bg-white text-slate-800 transition-all duration-200 hover:bg-slate-200 focus:ring-2 focus:ring-slate-500 focus:outline-none",
4242
className
4343
)}
4444
{...props}

app/lib/game/components/GoalsDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export default function GoalsDialog({ open }: { open: boolean }) {
8888
<Dialog open={open} modal={false}>
8989
<DialogPortal>
9090
<DialogContent
91-
ref={dialogRef}
91+
ref={dialogRef}
9292
style={{
9393
left: pos.x,
9494
top: pos.y,

app/lib/game/components/Tutorial.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Checkbox, CheckboxIndicator } from "@radix-ui/react-checkbox";
22
import { CheckIcon } from "@radix-ui/react-icons";
3+
import { useEffect } from "react";
34
import Joyride, {
45
type CallBackProps,
56
type Step,
@@ -107,6 +108,10 @@ export default function Tutorial({ onClose }: { onClose: () => void }) {
107108
}
108109
};
109110

111+
useEffect(() => {
112+
return () => onClose();
113+
}, []);
114+
110115
return (
111116
<Joyride
112117
steps={steps}

app/lib/game/core/levels.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { v4 as uuidv4 } from "uuid";
33

44
import bounceCard from "~/assets/home-cards/bounce_card.png";
55
import calcCard from "~/assets/home-cards/calc_card.png";
6-
import sittingCard from "~/assets/home-cards/sitting_card.png";
76
import forwardCard from "~/assets/home-cards/forward_card.png";
87
import gravityCard from "~/assets/home-cards/gravity_card.png";
98
import inverseCard from "~/assets/home-cards/inverse_card.png";
@@ -12,6 +11,7 @@ import loopingCard from "~/assets/home-cards/looping_card.png";
1211
import moveCard from "~/assets/home-cards/move_card.png";
1312
import parentingCard from "~/assets/home-cards/parenting_card.png";
1413
import playgroundCard from "~/assets/home-cards/playground_card.png";
14+
import sittingCard from "~/assets/home-cards/sitting_card.png";
1515
import type { NodeType } from "~/lib/node-editor/nodes/node-types";
1616
import { type GameObject } from "../game-objects";
1717
import { initializeBounce } from "../levels/bounce";

app/lib/game/levels/gravity.ts

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,84 @@ import { createLevelDataHelpers } from "~/lib/zustand/data";
22
import { useGameStore } from "~/lib/zustand/game";
33
import { getKaplayCtx } from "../core/kaplay-ctx";
44
import {
5-
addBackgrounds,
6-
addGameobjects,
7-
animPlayer,
8-
handleReset,
5+
addBackgrounds,
6+
addGameobjects,
7+
animPlayer,
8+
handleReset,
99
} from "../utils/game-helper";
1010

1111
export const initializeGravity = () => {
12-
const { k, game } = getKaplayCtx();
13-
const dataHelper = createLevelDataHelpers("gravity");
14-
15-
addBackgrounds(["default"]);
16-
17-
const { raccoon, trashcanFilled } = addGameobjects([
18-
"raccoon",
19-
"trashcanFilled",
20-
]);
21-
22-
const floor = k.add([
23-
k.rect(50, 10),
24-
k.anchor("top"),
25-
k.pos(0, 0),
26-
k.area(),
27-
k.body({ isStatic: true }),
28-
k.opacity(0),
29-
]);
30-
31-
trashcanFilled.use(k.body());
32-
trashcanFilled.use(k.area({
33-
shape: new k.Rect(k.vec2(0, 0), 16, 16),
34-
offset: k.vec2(0, 0),
35-
}));
36-
37-
trashcanFilled.pos.x = 5;
38-
trashcanFilled.pos.y = -10;
39-
40-
let trashcanVely = 0;
41-
42-
game.onUpdate(() => {
43-
if (useGameStore.getState().isPaused) return;
44-
45-
animPlayer(raccoon, k, {
46-
movementMode: "keyboard",
47-
updateStoreData: false,
48-
camClampX: {
49-
min: -8,
50-
max: 12,
51-
},
52-
playerClampX: {
53-
min: -12,
54-
max: 20,
55-
},
56-
});
57-
58-
trashcanVely = dataHelper.getData("trashcanFilled", "y vel");
59-
60-
if(trashcanFilled.pos.y < 0){
61-
trashcanFilled.pos.y = trashcanFilled.pos.y + trashcanVely;
62-
}
63-
else{
64-
trashcanFilled.use(k.body({ isStatic: true }));
65-
}
66-
67-
raccoon.pos.y = dataHelper.getData("raccoon", "y pos");
68-
69-
dataHelper.setData("trashcanFilled", "y vel", () => trashcanVely);
70-
dataHelper.setData("raccoon", "y pos", () => raccoon.pos.y);
71-
72-
73-
const trashcanTop = trashcanFilled.pos.sub(k.vec2(0, 2));
74-
75-
if(raccoon.pos.dist(trashcanTop) <= 1){
76-
useGameStore.getState().setLevelCompleted(true);
77-
}
78-
79-
if (dataHelper.initData()) {
80-
handleReset(raccoon, 1);
81-
trashcanFilled.pos.x = 5;
82-
trashcanFilled.pos.y = -10;
83-
}
12+
const { k, game } = getKaplayCtx();
13+
const dataHelper = createLevelDataHelpers("gravity");
14+
15+
addBackgrounds(["default"]);
16+
17+
const { raccoon, trashcanFilled } = addGameobjects([
18+
"raccoon",
19+
"trashcanFilled",
20+
]);
21+
22+
const floor = k.add([
23+
k.rect(50, 10),
24+
k.anchor("top"),
25+
k.pos(0, 0),
26+
k.area(),
27+
k.body({ isStatic: true }),
28+
k.opacity(0),
29+
]);
30+
31+
trashcanFilled.use(k.body());
32+
trashcanFilled.use(
33+
k.area({
34+
shape: new k.Rect(k.vec2(0, 0), 16, 16),
35+
offset: k.vec2(0, 0),
36+
})
37+
);
38+
39+
trashcanFilled.pos.x = 5;
40+
trashcanFilled.pos.y = -10;
41+
42+
let trashcanVely = 0;
43+
44+
game.onUpdate(() => {
45+
if (useGameStore.getState().isPaused) return;
46+
47+
animPlayer(raccoon, k, {
48+
movementMode: "keyboard",
49+
updateStoreData: false,
50+
camClampX: {
51+
min: -8,
52+
max: 12,
53+
},
54+
playerClampX: {
55+
min: -12,
56+
max: 20,
57+
},
8458
});
59+
60+
trashcanVely = dataHelper.getData("trashcanFilled", "y vel");
61+
62+
if (trashcanFilled.pos.y < 0) {
63+
trashcanFilled.pos.y = trashcanFilled.pos.y + trashcanVely;
64+
} else {
65+
trashcanFilled.use(k.body({ isStatic: true }));
66+
}
67+
68+
raccoon.pos.y = dataHelper.getData("raccoon", "y pos");
69+
70+
dataHelper.setData("trashcanFilled", "y vel", () => trashcanVely);
71+
dataHelper.setData("raccoon", "y pos", () => raccoon.pos.y);
72+
73+
const trashcanTop = trashcanFilled.pos.sub(k.vec2(0, 2));
74+
75+
if (raccoon.pos.dist(trashcanTop) <= 1) {
76+
useGameStore.getState().setLevelCompleted(true);
77+
}
78+
79+
if (dataHelper.initData()) {
80+
handleReset(raccoon, 1);
81+
trashcanFilled.pos.x = 5;
82+
trashcanFilled.pos.y = -10;
83+
}
84+
});
8585
};

app/lib/node-editor/editor-components/IconButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const IconButton = React.forwardRef<
2626
</TooltipTrigger>
2727

2828
<TooltipContent side={side}>
29-
{ typeof tooltip === "string" ? <p>{tooltip}</p> : tooltip }
29+
{typeof tooltip === "string" ? <p>{tooltip}</p> : tooltip}
3030
</TooltipContent>
3131
</Tooltip>
3232
);

app/lib/node-editor/editor-components/LeftPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import { Panel } from "@xyflow/react";
1717
import LevelDialog from "~/lib/game/components/LevelDialog";
1818
import { useDataStore } from "~/lib/zustand/data";
1919
import { useGameStore } from "~/lib/zustand/game";
20+
import useIsMac from "../hooks/useMac";
2021
import { useFlowStore } from "../node-store/flow-store";
2122
import { useLoopStore } from "../node-store/loop-store";
2223
import { useNodeStore } from "../node-store/node-store";
2324
import { redo, undo } from "../utils/undo";
2425
import { IconButton } from "./IconButton";
25-
import useIsMac from "../hooks/useMac";
2626

2727
const LeftPanel = () => {
2828
const currentLevel = useGameStore((state) => state.currentLevel);

0 commit comments

Comments
 (0)