Skip to content

updates, add some gmaes, features and analytics#335

Merged
ingoau merged 62 commits intoprodfrom
main
Jun 8, 2025
Merged

updates, add some gmaes, features and analytics#335
ingoau merged 62 commits intoprodfrom
main

Conversation

@ingoau
Copy link
Member

@ingoau ingoau commented Jun 6, 2025

Summary by CodeRabbit

  • New Features
    • Added seven new games, including "Scratch Nextbots," "Mine sweeper (scratch edition)," "Run 3," "Dadish," "Dadish 2," and "Subway surfers."
    • Introduced new sprite and animation data for multiple "Run 3" game characters.
    • Added "Dadish" and "Dadish 2" games with integrated advertising SDKs and analytics.
  • Improvements
    • Enhanced sidebar menu UI with gradient overlays and improved hover effects.
    • Enabled experimental features and analytics tracking via PostHog.
  • Bug Fixes
    • Improved error handling by reporting non-404 client errors to analytics.
  • Chores
    • Updated and added configuration files for automation, code review, and CI/CD workflows.
    • Updated development dependencies and added PostHog analytics library.
    • Adjusted Dependabot update frequency and assignment settings.
  • Documentation
    • Added comprehensive documentation for CI/CD scripts and workflows.

dependabot bot and others added 14 commits May 16, 2025 12:49
Bumps [svelte-check](https://github.com/sveltejs/language-tools) from 4.1.6 to 4.2.1.
- [Release notes](https://github.com/sveltejs/language-tools/releases)
- [Commits](sveltejs/language-tools@svelte-check-4.1.6...svelte-check-4.2.1)

---
updated-dependencies:
- dependency-name: svelte-check
  dependency-version: 4.2.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [bits-ui](https://github.com/huntabyte/bits-ui) from 1.4.6 to 1.8.0.
- [Release notes](https://github.com/huntabyte/bits-ui/releases)
- [Commits](https://github.com/huntabyte/bits-ui/compare/bits-ui@1.4.6...bits-ui@1.8.0)

---
updated-dependencies:
- dependency-name: bits-ui
  dependency-version: 1.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [lucide-svelte](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-svelte) from 0.503.0 to 0.512.0.
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/0.512.0/packages/lucide-svelte)

---
updated-dependencies:
- dependency-name: lucide-svelte
  dependency-version: 0.512.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@lucide/svelte](https://github.com/lucide-icons/lucide/tree/HEAD/packages/svelte) from 0.508.0 to 0.512.0.
- [Release notes](https://github.com/lucide-icons/lucide/releases)
- [Commits](https://github.com/lucide-icons/lucide/commits/0.512.0/packages/svelte)

---
updated-dependencies:
- dependency-name: "@lucide/svelte"
  dependency-version: 0.512.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
…weeper-at-jerry-edition

add mine sweeper
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 6, 2025

Deploying edutools-testing with  Cloudflare Pages  Cloudflare Pages

Latest commit: 23ab04c
Status: ✅  Deploy successful!
Preview URL: https://e1fba608.edutools-testing.pages.dev
Branch Preview URL: https://main.edutools-testing.pages.dev

View logs

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 6, 2025

Warning

Rate limit exceeded

@Inglan has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 320286f and 23ab04c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • components.json (1 hunks)
  • package.json (2 hunks)
  • src/app.css (1 hunks)
  • src/lib/components/app-sidebar.svelte (1 hunks)
  • src/lib/components/ui/dialog/dialog-content.svelte (1 hunks)
  • src/lib/gmaes.ts (1 hunks)
  • src/routes/+layout.svelte (1 hunks)

Walkthrough

This update introduces several new games and their associated assets, including "Dadish," "Dadish 2," "Run 3," and "Subway Surfers." It adds supporting character sprite JSON files, ad SDKs, and HTML entry points for these games. The update also enhances analytics integration, error handling, and CI/CD automation scripts.

Changes

Files/Groups Change Summary
.coderabbit.yaml Added CodeRabbit configuration file for review and auto-review settings.
.github/dependabot.yml Changed npm update frequency to weekly; removed assignees.
.github/workflows/production_deploy.yml Added GitHub Actions workflow for moving project items to production on prod branch push.
package.json Bumped dev dependencies and added posthog-js runtime dependency.
src/lib/gmaes.ts Appended seven new game entries with URLs and descriptions.
src/lib/components/app-sidebar.svelte Enhanced sidebar menu link styling and added a right-aligned gradient overlay.
src/routes/+layout.svelte Added onMount hook to set experimental feature flags and initialize PostHog analytics.
src/hooks.client.ts Introduced client error handler that reports non-404 errors to PostHog.
ci/README.md Added documentation for CI/CD automation scripts and workflows.
ci/scripts/move_to_production.py, ci/scripts/test_production_move.py Added scripts to automate and test moving GitHub project items from "Done" to "In Production."
static/_app/tools/dadish-2/index.html, static/_app/tools/dadish/index.html Added HTML entry points for "Dadish" and "Dadish 2" games with mobile optimizations and game embedding.
static/_app/tools/dadish-2/doodoo-sdk-2.1.0.js, static/_app/tools/dadish-2/pk-sdk.js Added ad SDK modules for "Dadish 2" with ad management, analytics, and share functionality.
static/_app/tools/dadish-2/gamebridge.js Added loader for gamebridge SDK with stub methods and dynamic script injection.
static/_app/tools/dadish/game-cdn.poki.com/scripts/v2/poki-sdk.js Added PokiSDK loader with queue-based method stubs and dynamic SDK loading.
static/_app/tools/run3/img/character/*.json Added multiple JSON files containing sprite frame data for "Run 3" game characters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SvelteApp
    participant PostHog
    participant preferencesStore

    User->>SvelteApp: Load app (layout)
    SvelteApp->>SvelteApp: onMount()
    SvelteApp->>preferencesStore: Set experimentalFeatures if query param
    SvelteApp->>SvelteApp: Navigate to root if experimental enabled
    SvelteApp->>PostHog: Initialize analytics (if in browser)
Loading
sequenceDiagram
    participant GitHub Actions
    participant move_to_production.py
    participant GitHub API

    GitHub Actions->>move_to_production.py: Run on prod branch push
    move_to_production.py->>GitHub API: Query project data (GraphQL)
    move_to_production.py->>GitHub API: Find "Done" items
    move_to_production.py->>GitHub API: Update item status to "In Production"
Loading
sequenceDiagram
    participant Game (Dadish 2)
    participant DooDooSDK / pk-sdk.js
    participant AdSystem (Adsense/IMA)
    participant Analytics

    Game->>DooDooSDK: Request interstitial/rewarded ad
    DooDooSDK->>AdSystem: Initialize/load ad
    AdSystem-->>DooDooSDK: Ad event (start, complete, error)
    DooDooSDK->>Game: Invoke callback (success/fail)
    DooDooSDK->>Analytics: Track ad event
Loading

Possibly related PRs

  • EducationalTools/src#339: Adds "Dadish" and "Dadish 2" games and related SDK/game files, directly overlapping with the new games and assets introduced in this PR.
  • EducationalTools/src#337: Adds "Run 3" and related character sprite JSON files, which are further expanded in this PR with additional assets.
  • EducationalTools/src#342: Modifies sidebar submenu links by adding classes and a gradient overlay, matching the sidebar enhancements in this PR.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/routes/+layout.svelte (1)

23-29: Consider improving user experience and adding error handling.

The experimental features toggle works correctly, but there are a few areas for improvement:

  1. Immediate redirect might confuse users - Users navigating to a specific URL with ?experimental=true get redirected to /, losing their intended destination.

  2. Missing error handling - No error handling for potential issues with window.location.search or URLSearchParams.

Consider this approach to preserve user intent:

 onMount(() => {
+	try {
 		const urlParams = new URLSearchParams(window.location.search);
 		if (urlParams.get('experimental') === 'true') {
 			$preferencesStore.experimentalFeatures = true;
-			goto('/');
+			// Only redirect if we're specifically on a URL meant for this purpose
+			// or remove the parameter while staying on the same page
+			const newUrl = new URL(window.location.href);
+			newUrl.searchParams.delete('experimental');
+			window.history.replaceState({}, '', newUrl.toString());
 		}
+	} catch (error) {
+		console.warn('Failed to parse URL parameters:', error);
+	}
 });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 499796b and d080a6a.

📒 Files selected for processing (4)
  • .coderabbit.yaml (1 hunks)
  • .github/dependabot.yml (1 hunks)
  • src/lib/gmaes.ts (1 hunks)
  • src/routes/+layout.svelte (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.*`: Do not correct spelling errors or grammar mistakes.

**/*.*: Do not correct spelling errors or grammar mistakes.

  • src/lib/gmaes.ts
  • src/routes/+layout.svelte
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
.github/dependabot.yml (1)

11-11: LGTM: Sensible update frequency adjustment.

Changing from daily to weekly updates is a good practice to reduce notification noise while maintaining reasonable dependency update cadence.

.coderabbit.yaml (1)

1-16: LGTM: Well-structured CodeRabbit configuration.

The configuration file is properly formatted and all settings are valid according to the schema:

  • Schema validation URL is correct
  • All boolean and enum values are valid
  • Path instructions and auto-review settings follow the proper structure
  • Base branches configuration correctly targets main and prod branches

This provides a good foundation for automated code review with appropriate settings.

src/lib/gmaes.ts (1)

142-152: LGTM: Consistent game entries added.

Both new game entries follow the established structure and URL pattern. The implementations are consistent with existing games in the array.

@ingoau ingoau enabled auto-merge June 6, 2025 04:21
@ingoau ingoau requested a review from nathblade16 June 6, 2025 04:21
@ingoau ingoau disabled auto-merge June 7, 2025 11:50
…/mode-watcher-1.0.7

Bump mode-watcher from 1.0.6 to 1.0.7
@ingoau ingoau changed the title add some gmaes and features updates, add some gmaes and features Jun 7, 2025
@ingoau ingoau changed the title updates, add some gmaes and features updates, add some gmaes, features and analytics Jun 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/components/app-sidebar.svelte (1)

222-224: Consider reducing the z-index value.

The z-50 value is quite high and might cause stacking context issues with other UI elements. Consider using a lower value unless there's a specific need for this high priority.

-																		class="absolute right-0 h-full w-[25%] bg-gradient-to-r from-transparent to-sidebar group-hover/link:opacity-0"
+																		class="absolute right-0 h-full w-[25%] bg-gradient-to-r from-transparent to-sidebar group-hover/link:opacity-0 z-10"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f039873 and 320286f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .coderabbit.yaml (1 hunks)
  • package.json (2 hunks)
  • src/hooks.client.ts (1 hunks)
  • src/lib/components/app-sidebar.svelte (2 hunks)
  • src/routes/+layout.svelte (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • .coderabbit.yaml
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.*`: Do not correct spelling errors or grammar mistakes.

**/*.*: Do not correct spelling errors or grammar mistakes.

  • src/lib/components/app-sidebar.svelte
  • src/routes/+layout.svelte
  • src/hooks.client.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
src/hooks.client.ts (1)

4-8: LGTM! Error filtering logic is appropriate.

The implementation correctly filters out 404 errors to avoid noise in analytics while capturing other client-side errors. The HandleClientError type ensures proper SvelteKit integration.

src/routes/+layout.svelte (2)

20-24: LGTM! Import additions are well-organized.

The new imports are properly grouped and include necessary components for the enhanced functionality.


26-31: LGTM! Experimental feature handling is well-implemented.

The URL parameter check and automatic navigation to clean up the URL is a good user experience pattern.

src/lib/components/app-sidebar.svelte (2)

115-115: LGTM! Fixed width class improves layout consistency.

Adding the explicit w-72 class ensures consistent sidebar width across different screen sizes.


212-216: LGTM! Class merging implementation is correct.

The clsx usage properly combines the new utility classes with existing props classes, maintaining component flexibility.

Comment on lines +1 to +2
import posthog from 'posthog-js';
import type { HandleClientError } from '@sveltejs/kit';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify PostHog initialization timing.

The error handler imports and uses PostHog directly, but PostHog is initialized asynchronously in the layout file's onMount hook. This could lead to errors being lost if they occur before PostHog is ready.


🏁 Script executed:

#!/bin/bash
# Description: Check if PostHog has defensive initialization or if there are other initialization points
# Expected: Find initialization patterns or defensive coding

rg -A 3 -B 3 "posthog\.init|posthog\.captureException"

Length of output: 703


Ensure PostHog is initialized before capturing errors

The posthog.init(…) call in src/routes/+layout.svelte lives inside an onMount block, but your client‐side handleError may run before that initialization completes—resulting in no‐ops or lost error events.

Key locations to update:

  • src/routes/+layout.svelte: Move or duplicate the PostHog init to an earlier client entry point, or expose a promise/flag once initialization is done.
  • src/hooks.client.ts: Guard calls to posthog.captureException so they only execute after PostHog is ready.

Suggested change in src/hooks.client.ts:

 export const handleError: HandleClientError = ({ error, status }) => {
   if (status !== 404) {
-    posthog.captureException(error);
+    // Only send once PostHog has finished initializing
+    if ((posthog as any).__loaded) {
+      posthog.captureException(error);
+    } else {
+      console.warn('PostHog not initialized—error not tracked:', error);
+    }
   }
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import posthog from 'posthog-js';
import type { HandleClientError } from '@sveltejs/kit';
import posthog from 'posthog-js';
import type { HandleClientError } from '@sveltejs/kit';
export const handleError: HandleClientError = ({ error, status }) => {
if (status !== 404) {
// Only send once PostHog has finished initializing
if ((posthog as any).__loaded) {
posthog.captureException(error);
} else {
console.warn('PostHog not initialized—error not tracked:', error);
}
}
};
🤖 Prompt for AI Agents
In src/hooks.client.ts at lines 1-2, the issue is that posthog.captureException
may be called before PostHog is initialized asynchronously in the layout's
onMount, causing lost error events. To fix this, add a guard around
posthog.captureException calls to check if PostHog is fully initialized before
capturing errors. Additionally, coordinate with src/routes/+layout.svelte to
expose a promise or flag indicating when PostHog initialization completes, and
use that in src/hooks.client.ts to ensure error capturing only happens after
initialization.

Comment on lines +32 to +38
if (browser) {
posthog.init('phc_jg4gOdigfHQD4MSgrSaO883dp2LjNJbJO7azv61UtI0', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'always',
capture_exceptions: true
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security concern: API key should be moved to environment variables.

The PostHog API key is hardcoded in the source code, which poses a security risk and makes it difficult to manage different keys across environments.

Move the API key to an environment variable:

-			posthog.init('phc_jg4gOdigfHQD4MSgrSaO883dp2LjNJbJO7azv61UtI0', {
+			posthog.init(import.meta.env.VITE_POSTHOG_API_KEY, {

And add the key to your .env file:

VITE_POSTHOG_API_KEY=phc_jg4gOdigfHQD4MSgrSaO883dp2LjNJbJO7azv61UtI0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (browser) {
posthog.init('phc_jg4gOdigfHQD4MSgrSaO883dp2LjNJbJO7azv61UtI0', {
api_host: 'https://us.i.posthog.com',
person_profiles: 'always',
capture_exceptions: true
});
}
if (browser) {
posthog.init(import.meta.env.VITE_POSTHOG_API_KEY, {
api_host: 'https://us.i.posthog.com',
person_profiles: 'always',
capture_exceptions: true
});
}
🤖 Prompt for AI Agents
In src/routes/+layout.svelte around lines 32 to 38, the PostHog API key is
hardcoded, which is a security risk. To fix this, move the API key to an
environment variable by replacing the hardcoded string with a reference to the
environment variable (e.g., import it using
import.meta.env.VITE_POSTHOG_API_KEY). Also, add the key to the .env file as
VITE_POSTHOG_API_KEY=phc_jg4gOdigfHQD4MSgrSaO883dp2LjNJbJO7azv61UtI0 to manage
it securely and support different environments.

Copy link
Contributor

@nathblade16 nathblade16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works

@ingoau ingoau merged commit 041f372 into prod Jun 8, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants