Skip to content

Commit 1b2fe48

Browse files
authored
Merge pull request #42 from metaversecloud-com/update/refactor-typescript
EXP-608: Convert sdk-race from JavaScript to TypeScript
2 parents cbc9d38 + a3ef7e5 commit 1b2fe48

File tree

97 files changed

+9317
-4200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+9317
-4200
lines changed

client/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
</head>
2020
<body class="rtsdk">
2121
<div id="root"></div>
22-
<script type="module" src="/src/main.jsx"></script>
22+
<script type="module" src="/src/main.tsx"></script>
2323
</body>
2424
</html>

client/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"version": "0.0.0",
55
"type": "module",
66
"scripts": {
7+
"dev": "vite",
78
"start": "vite",
89
"build": "vite build",
9-
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
10+
"build:check-ts": "tsc && vite build",
11+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1012
"preview": "vite preview"
1113
},
1214
"dependencies": {
@@ -27,6 +29,7 @@
2729
"postcss": "^8.4.35",
2830
"sass": "^1.71.1",
2931
"tailwindcss": "^3.4.1",
32+
"typescript": "^5.9.2",
3033
"vite": "^5.1.4"
3134
}
3235
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ const App = () => {
2121

2222
const interactiveParams = useMemo(() => {
2323
return {
24-
assetId: searchParams.get("assetId"),
25-
displayName: searchParams.get("displayName"),
26-
interactiveNonce: searchParams.get("interactiveNonce"),
27-
interactivePublicKey: searchParams.get("interactivePublicKey"),
28-
profileId: searchParams.get("profileId"),
29-
sceneDropId: searchParams.get("sceneDropId"),
30-
uniqueName: searchParams.get("uniqueName"),
31-
urlSlug: searchParams.get("urlSlug"),
32-
username: searchParams.get("username"),
33-
visitorId: searchParams.get("visitorId"),
34-
identityId: searchParams.get("identityId"),
24+
assetId: searchParams.get("assetId") || "",
25+
displayName: searchParams.get("displayName") || "",
26+
interactiveNonce: searchParams.get("interactiveNonce") || "",
27+
interactivePublicKey: searchParams.get("interactivePublicKey") || "",
28+
profileId: searchParams.get("profileId") || "",
29+
sceneDropId: searchParams.get("sceneDropId") || "",
30+
uniqueName: searchParams.get("uniqueName") || "",
31+
urlSlug: searchParams.get("urlSlug") || "",
32+
username: searchParams.get("username") || "",
33+
visitorId: Number(searchParams.get("visitorId")) || 0,
34+
identityId: searchParams.get("identityId") || "",
3535
};
3636
}, [searchParams]);
3737

@@ -48,7 +48,7 @@ const App = () => {
4848
username,
4949
visitorId,
5050
identityId,
51-
}) => {
51+
}: typeof interactiveParams) => {
5252
const isInteractiveIframe = visitorId && interactiveNonce && interactivePublicKey && assetId;
5353
dispatch({
5454
type: SET_INTERACTIVE_PARAMS,
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
import PropTypes from "prop-types";
1+
interface AdminIconButtonProps {
2+
setShowSettings: (show: boolean) => void;
3+
showSettings: boolean;
4+
}
25

3-
export const AdminIconButton = ({ setShowSettings, showSettings }) => {
6+
export const AdminIconButton = ({ setShowSettings, showSettings }: AdminIconButtonProps) => {
47
return (
58
<div className="icon-btn mb-4 text-right" onClick={() => setShowSettings(showSettings)}>
69
{showSettings ? "←" : "⛭"}
710
</div>
811
);
912
};
1013

11-
AdminIconButton.propTypes = {
12-
setShowSettings: PropTypes.func,
13-
showSettings: PropTypes.bool,
14-
};
15-
1614
export default AdminIconButton;
File renamed without changes.
File renamed without changes.

client/src/components/Leaderboard/LeaderboardScreen.jsx renamed to client/src/components/Leaderboard/LeaderboardScreen.tsx

File renamed without changes.
File renamed without changes.

client/src/components/OnYourMarkScreen/OnYourMarkScreen.jsx renamed to client/src/components/OnYourMarkScreen/OnYourMarkScreen.tsx

File renamed without changes.

0 commit comments

Comments
 (0)