Skip to content

Gameplay models#276

Merged
okhaimie-dev merged 7 commits intodevelopfrom
gameplay-models
Feb 22, 2025
Merged

Gameplay models#276
okhaimie-dev merged 7 commits intodevelopfrom
gameplay-models

Conversation

@supreme2580
Copy link
Collaborator

@supreme2580 supreme2580 commented Feb 22, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a dedicated boards page that lets users browse and view detailed game board options.
    • Enhanced the wallet connection interface with real-time account status, balance checks, and responsive warning dialogs for small screens or insufficient funds.
    • Added a new in-game outcome display that provides clear win/loss feedback for an improved gameplay experience.
  • Chores

    • Upgraded underlying libraries and updated configurations to boost overall platform stability and performance.

@vercel
Copy link

vercel bot commented Feb 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mancala-pkco ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 22, 2025 11:22pm

@coderabbitai
Copy link

coderabbitai bot commented Feb 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update dependency versions in the client package, revise configuration and routing logic, and introduce new UI components (e.g., Boards, Checks, NotEnough, BoardBlock) with updated data model references from mancalaAlpha to mancalaSalt. In addition, the contracts codebase undergoes extensive refactoring: configuration files and manifests now reference updated namespaces, tool versions, and addresses, while many internal modules, types, and functions are changed from private to public. Two generated binding files were removed, and various comments and minor formatting adjustments were applied.

Changes

Files Change Summary
client/package.json Dependency versions updated: @cartridge/connector changed from ^0.5.5 to ^0.6.0 and @cartridge/controller updated from ^0.5.8 to ^0.6.0.
client/src/App.tsx, client/src/pages/{Boards,Home,Lobby,Tutorial,games/Gameplay}.tsx Routing and configuration updates in the App and page components; addition of new routes and outcome dialog; updated options and state management; data source references changed from mancalaAlpha to mancalaSalt.
client/src/{Checks.tsx,components/boards/board-block.tsx,components/not-enough.tsx} New React components added: Checks (manages wallet connection, balance and screen size checks), BoardBlock (renders board info with conditional button), and NotEnough (displays a notification dialog).
client/src/components/{gameplay/,message-area.tsx,profile/user-section.tsx,tutorial/} Updated internal references from mancalaAlpha* to mancalaSalt* in gameplay, messaging, profile, and tutorial components; minor formatting and readability improvements.
client/src/lib/{config.ts,constants.ts,utils.ts} Introduced new constant PROFILE_ADDRESS, added normalizeAddress helper, updated GraphQL query names, and improved comment formatting.
contracts/{.tool-versions,Scarb.toml,dojo_dev.toml,dojo_sepolia.toml,dojo_slot.toml,manifest_{dev,sepolia}.json,torii_dev.toml} Updated tool versions, Cairo version, package version, dependency tags, namespace, world addresses, and event tags (from mancala_alpha to mancala_salt).
contracts/bindings/typescript/{contracts.gen.ts,models.gen.ts} Deleted autogenerated binding and type definition files.
contracts/src/{components/,constants.cairo,elems/tasks/,elems/trophies/,events/,lib.cairo,models/,store.cairo,systems/,tests/,types/,utils/board.cairo} Extensive refactoring to change module, function, and type visibility from private to public; updates to internal naming and formatting; adjustments in trait implementations and imports (e.g., namespace shift from mancala_alpha to mancala_salt).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant HomePage
    participant Connector
    participant LobbyPage
    participant GameplayPage

    User->>HomePage: Load Home Page
    HomePage->>Connector: Check wallet connection (via useAccount/useConnect)
    alt User is connected
        HomePage->>User: Display "Go to Lobby" link
        User->>LobbyPage: Navigate to Lobby
        LobbyPage->>GameplayPage: Start game (using mancalaSalt models)
        GameplayPage->>User: Show game outcome dialog
    else User is not connected
        HomePage->>Connector: Prompt wallet connection
        Connector->>User: Initiate connection process
    end
Loading
sequenceDiagram
    participant Checks as Checks Component
    participant Account as User Account
    participant Connector as Wallet Connector
    participant UI as Rendered UI

    Checks->>Account: Verify account connection
    alt Not Connected
        Checks->>Connector: Attempt connection using first connector
    end
    Checks->>UI: Retrieve balance and screen size
    alt Conditions unmet
        UI-->>Checks: Render warning or NotEnough component
    else Conditions met
        UI-->>Checks: Render child components
    end
Loading

Possibly related PRs

  • fixed winner and loser #207: Involves changes in the GameBoard component and player model handling similar to the current modifications.
  • Boards page #275: Updates the dependency versions in client/package.json for @cartridge/connector and @cartridge/controller, directly related to these changes.
  • Controller patch fix #170: Contains similar dependency version increments in client/package.json, reflecting a direct code-level connection.

Suggested reviewers

  • okhaimie-dev

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@supreme2580 supreme2580 changed the base branch from main to develop February 22, 2025 22:30
Copy link

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 6

🧹 Nitpick comments (17)
client/src/pages/Tutorial.tsx (1)

36-50: Consider using useReducer for complex state management.

The component manages multiple related state variables (moveMessage, step, state, message, action) for the tutorial flow. Consider using useReducer to centralize this logic and make it more maintainable.

Here's a suggested approach:

type TutorialState = {
  moveMessage: string | undefined;
  step: number;
  state: string;
  message: string;
  action: { action: any; message: string };
  isOverlayVisible: boolean;
};

type TutorialAction =
  | { type: 'NEXT_STEP' }
  | { type: 'RESET' }
  | { type: 'SET_MESSAGE'; payload: string }
  | { type: 'SET_ACTION'; payload: { action: any; message: string } }
  | { type: 'TOGGLE_OVERLAY' };

function tutorialReducer(state: TutorialState, action: TutorialAction): TutorialState {
  switch (action.type) {
    case 'NEXT_STEP':
      return { ...state, step: state.step + 1 };
    case 'RESET':
      return {
        ...state,
        step: 1,
        state: 'initial',
        message: 'SEED DISTRIBUTION BASICS',
        moveMessage: 'Great! Now watch how seeds are distributed: Pick up all seeds from your pit and sow them one by one counter-clockwise',
        action: { action: undefined, message: '' }
      };
    // Add other cases...
  }
}

This would make the tutorial flow logic more maintainable and easier to test.

contracts/src/elements/tasks/reigning.cairo (1)

3-13: LGTM! Consider adding documentation to clarify task differences.

Making the implementation public aligns with the public trait. The implementation is clean and follows the trait contract.

Consider adding documentation to clarify the difference between "dominating" and "reigning" tasks, as both relate to winning games but appear to serve different purposes.

client/src/components/boards/board-block.tsx (1)

3-13: Add prop validation and improve type safety.

Consider these improvements:

  1. Add prop validation for required fields.
  2. Consider using a type alias or interface for props.
  3. Add onClick handlers for interactivity.
+type BoardBlockProps = {
+  image: string;
+  name: string;
+  description: string;
+  owned: boolean;
+  onClick?: () => void;
+};

-export default function BoardBlock({
+export default function BoardBlock({
+    onClick,
     image,
     name,
     description,
     owned
-}: {
-    image: string;
-    name: string;
-    description: string;
-    owned: boolean;
-}) {
+}: BoardBlockProps) {
contracts/src/tests/utils.cairo (1)

7-39: Consider optimizing seed movement logic.

The current implementation processes seeds individually, which could be inefficient for large numbers of seeds. Consider batch processing seeds or using a more efficient data structure.

 pub fn move_player_seeds_to_store(world: WorldStorage, player: @Player) {
     let mut store: Store = StoreTrait::new(world);
     let mut player_store = store.get_pit(*player.game_id, *player.address, 7);
-    let store_start_count = player_store.seed_count;
-    let mut total_moved_seeds = 0;
+    let mut total_seeds = 0;
 
     let mut idx = 1;
     loop {
         if idx > *player.len_pits {
             break;
         }
         let mut pit = store.get_pit(*player.game_id, *player.address, idx);
-        let pit_seed_count = pit.seed_count;
-        let mut seeds_idx = 1;
-        loop {
-            if seeds_idx > pit_seed_count {
-                break;
-            }
-            let mut seed = store.get_seed(*player.game_id, *player.address, idx, seeds_idx);
-            seed.pit_number = 7;
-            seed.seed_number = store_start_count + total_moved_seeds + seeds_idx;
-            store.set_seed(seed);
-            seeds_idx += 1;
-        };
-        total_moved_seeds += pit_seed_count;
+        total_seeds += pit.seed_count;
         pit.seed_count = 0;
         store.set_pit(pit);
         idx += 1;
     };
-    // Update store pit count once at the end
-    player_store.seed_count += total_moved_seeds;
+    // Batch update seeds in store
+    let store_start_count = player_store.seed_count;
+    let mut seed_idx = 1;
+    loop {
+        if seed_idx > total_seeds {
+            break;
+        }
+        let mut seed = store.get_seed(*player.game_id, *player.address, 1, seed_idx);
+        seed.pit_number = 7;
+        seed.seed_number = store_start_count + seed_idx;
+        store.set_seed(seed);
+        seed_idx += 1;
+    };
+    player_store.seed_count += total_seeds;
     store.set_pit(player_store);
 }
client/src/Checks.tsx (2)

6-14: Consider enhancing the small screen warning message.

The warning message could be more informative by suggesting a minimum screen size requirement.

-          This game is not optimized for this device screen!
+          This game requires a screen width of at least 1280px for optimal gameplay. Please use a larger device.

38-45: Consider adding loading and error states.

The component should handle loading and error states for better user experience.

 return(
     <div>
+        {!isConnected && <div>Connecting to wallet...</div>}
+        {data === undefined && <div>Loading balance...</div>}
         {isConnected && !isEnough && <NotEnough isEnough={isEnough} />}
         {isSmallScreen && <SmallScreenWarning />}
         {children}
     </div>
 )
contracts/src/systems/profile.cairo (1)

12-14: Clean up commented imports.

Remove the commented imports if they are no longer needed. If they might be needed in the future, add a TODO comment explaining why they are kept.

-    //use starknet::ContractAddress;
-    //use mancala::models::profile::Profile;
+    // TODO: These imports might be needed when implementing feature X
+    // use starknet::ContractAddress;
+    // use mancala::models::profile::Profile;
client/src/components/message-area.tsx (1)

35-35: Remove or enhance console.log statement.

The console.log statement appears to be for debugging purposes and lacks context.

-    console.log("clicked: ");
+    // TODO: Remove debug log or enhance with meaningful information
+    console.log(`Restart game requested for game ${gameId}`);
client/src/pages/Home.tsx (1)

17-28: Consider adding loading and error states for better UX.

While the conditional rendering works correctly, consider handling loading and error states during wallet connection for a better user experience.

 {
-  isConnected ? <Link to="/lobby">
+  isConnected ? (
+    <Link to="/lobby">
     <button className="bg-[#1A1D25] text-[#F58229] py-2.5 px-7 rounded-full flex flex-row items-center justify-center space-x-1">
       <Bubble />
       <p>Go to lobby</p>
     </button>
-  </Link> : <Button className="bg-[#F58229] hover:bg-[#F58229] font-medium hover:cursor-pointer rounded-3xl" onClick={() => connect({ connector: connectors[0] })}>
+    </Link>
+  ) : (
+    <>
+      {error && <p className="text-red-500">{error.message}</p>}
+      <Button
+        className="bg-[#F58229] hover:bg-[#F58229] font-medium hover:cursor-pointer rounded-3xl"
+        onClick={() => connect({ connector: connectors[0] })}
+        disabled={isLoading}
+      >
       <div className="flex flex-row items-center space-x-1">
-        <p className="text-[#FCE3AA] font-medium">Connect Wallet</p>
+        <p className="text-[#FCE3AA] font-medium">
+          {isLoading ? 'Connecting...' : 'Connect Wallet'}
+        </p>
       </div>
-    </Button>
+      </Button>
+    </>
+  )
 }
client/src/App.tsx (1)

57-57: Consider removing type assertions.

The double type assertion (as never as Connector) is a code smell and might hide type-related issues.

Consider updating the ControllerConnector type definitions or finding a more type-safe approach.

client/src/pages/Boards.tsx (2)

8-23: Consider moving board data to a configuration file.

The hardcoded board data should be moved to a separate configuration file for better maintainability and easier updates.

-    const boards = [
-        {
-            id: 1,
-            image: default_board_image,
-            name: 'Default Board',
-            description: 'Story about it that you can make mention of to have like a description',
-            owned: true
-        },
-        {
-            id: 2,
-            image: starknet_board_image,
-            name: 'Starknet Board',
-            description: 'Story about it that you can make mention of to have like a description',
-            owned: false
-        }
-    ]
+    import { boards } from '@/config/boards';

60-60: Consider using dynamic height calculation.

The grid height calculation uses a fixed value which might not work well across different screen sizes.

-    <div className="grid grid-cols-2 gap-5 overflow-y-scroll h-[calc(100vh-250px)] scrollbar-hidden">
+    <div className="grid grid-cols-2 gap-5 overflow-y-auto min-h-0 flex-1 scrollbar-hidden">
client/src/pages/games/Gameplay.tsx (1)

44-49: Simplify the boolean logic.

The boolean expression can be simplified by removing the unnecessary ternary operator.

-  const involved =
-    game_players?.mancalaSaltPlayerModels.edges.filter(
-      (item: any) => item?.node.address === account.address,
-    ).length > 0
-      ? true
-      : false;
+  const involved = game_players?.mancalaSaltPlayerModels.edges.filter(
+    (item: any) => item?.node.address === account.address,
+  ).length > 0;
🧰 Tools
🪛 Biome (1.9.4)

[error] 45-49: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

contracts/src/utils/board.cairo (1)

9-9: Consider the implications of making board utility functions public.

The change from private to public visibility for these functions significantly alters the module's API surface. While this increases flexibility, it also:

  1. Expands the attack surface by potentially exposing internal game mechanics
  2. Makes it harder to refactor internal implementation details in the future
  3. May violate encapsulation principles

Consider:

  • Keeping functions private unless there's a specific need for external access
  • Using a facade pattern to expose only necessary functionality
  • Adding access control if these functions must remain public

Also applies to: 28-28, 45-45, 135-135, 178-178, 214-214, 246-246, 280-280, 335-335

client/src/components/gameplay/game-board.tsx (1)

163-196: Consider memoizing the simulation calculation.

The simulation logic could benefit from memoization to prevent unnecessary recalculations when dependencies haven't changed.

-const simulatedMove = calculateMancalaMove(
+const simulatedMove = useMemo(() => calculateMancalaMove(
  formattedSeeds,
  selectedPit,
  player,
  opponent,
-);
+), [formattedSeeds, selectedPit, player, opponent]);
contracts/src/components/playable.cairo (1)

2-2: Review the necessity of exposing internal component details.

Making the entire PlayableComponent module and its internals public significantly increases the API surface. Consider:

  1. The implications for future maintenance and backwards compatibility
  2. Whether all these elements need to be public
  3. The potential for misuse of internal game mechanics

Recommendation: Document the rationale for making these public and consider using a more restrictive visibility model.

Also applies to: 21-25, 29-29, 33-33, 36-36

client/src/components/header.tsx (1)

293-296: Remove debug console log.

This console.log statement appears to be used for debugging and should be removed before production.

-console.log({
-  profile,
-  address: account?.address,
-});
🛑 Comments failed to post (6)
client/src/components/boards/board-block.tsx (1)

15-25: 🛠️ Refactor suggestion

Improve accessibility and component interactivity.

The component needs accessibility improvements and consistent button states:

  1. Add alt text for the image.
  2. Add onClick handler to the div since it has hover effects.
  3. Make button states consistent.
-        <div className="w-[630px] h-[400px] bg-[#0F111680] rounded-xl hover:border-2 hover:border-[#F58229] hover:cursor-pointer">
+        <div 
+            onClick={onClick}
+            className="w-[630px] h-[400px] bg-[#0F111680] rounded-xl hover:border-2 hover:border-[#F58229] hover:cursor-pointer"
+        >
             <div className="w-full h-full p-4 space-y-1">
-                <img src={image} className="w-full h-64" draggable={false} />
+                <img 
+                    src={image} 
+                    alt={`${name} board`} 
+                    className="w-full h-64" 
+                    draggable={false} 
+                />
                 <h3 className="text-white text-2xl font-semibold">{name}</h3>
                 <p className="text-[#C7CAD4] text-lg">{description}</p>
                 {
-                    owned ? <Button className="p-5 rounded-3xl bg-[#171922]">Owned</Button> : 
-                    <Button className="p-5 rounded-3xl bg-[#F58229] hover:bg-[#F58229] active:bg-[#F58229]">Buy Board</Button>
+                    owned ? (
+                        <Button 
+                            disabled 
+                            className="p-5 rounded-3xl bg-[#171922] hover:bg-[#171922] active:bg-[#171922]"
+                        >
+                            Owned
+                        </Button>
+                    ) : (
+                        <Button 
+                            onClick={onClick}
+                            className="p-5 rounded-3xl bg-[#F58229] hover:bg-[#F58229] active:bg-[#F58229]"
+                        >
+                            Buy Board
+                        </Button>
+                    )
                 }
📝 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.

        <div 
            onClick={onClick}
            className="w-[630px] h-[400px] bg-[#0F111680] rounded-xl hover:border-2 hover:border-[#F58229] hover:cursor-pointer"
        >
            <div className="w-full h-full p-4 space-y-1">
                <img 
                    src={image} 
                    alt={`${name} board`} 
                    className="w-full h-64" 
                    draggable={false} 
                />
                <h3 className="text-white text-2xl font-semibold">{name}</h3>
                <p className="text-[#C7CAD4] text-lg">{description}</p>
                {
                    owned ? (
                        <Button 
                            disabled 
                            className="p-5 rounded-3xl bg-[#171922] hover:bg-[#171922] active:bg-[#171922]"
                        >
                            Owned
                        </Button>
                    ) : (
                        <Button 
                            onClick={onClick}
                            className="p-5 rounded-3xl bg-[#F58229] hover:bg-[#F58229] active:bg-[#F58229]"
                        >
                            Buy Board
                        </Button>
                    )
                }
            </div>
        </div>
client/src/Checks.tsx (1)

25-37: ⚠️ Potential issue

Add dependency array to useEffect hook.

The useEffect hook is missing isConnected and connect in its dependency array, which could lead to stale closures.

-  }, []);
+  }, [isConnected, connect, connectors]);
📝 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.

    useEffect(() => {
        if (!isConnected) {
            connect({ connector: connectors[0] })
        }
      const handleResize = () => {
        setIsSmallScreen(window.innerWidth < 1280);
      };
      handleResize();
      window.addEventListener("resize", handleResize);
      return () => {
        window.removeEventListener("resize", handleResize);
      };
    }, [isConnected, connect, connectors]);
client/src/components/not-enough.tsx (4)

7-8: ⚠️ Potential issue

Fix dialog state management logic.

The handleOpen function doesn't correctly toggle the dialog state as it just sets it to the current value.

-const handleOpen = () => setOpen(open);
+const handleOpen = () => setOpen(!open);
📝 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.

    const [open, setOpen] = useState(!isEnough);
    const handleOpen = () => setOpen(!open);

20-20: 🛠️ Refactor suggestion

Add email validation and error handling.

The email input lacks validation and error handling.

-<input placeholder="Input Email Address" className="w-full p-3.5 bg-[#1A1E25] rounded-lg outline-none text-white" />
+<input 
+  type="email"
+  placeholder="Input Email Address"
+  className="w-full p-3.5 bg-[#1A1E25] rounded-lg outline-none text-white"
+  required
+  pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
+  aria-label="Email Address"
+/>
📝 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.

                        <input 
                          type="email"
                          placeholder="Input Email Address"
                          className="w-full p-3.5 bg-[#1A1E25] rounded-lg outline-none text-white"
                          required
                          pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
                          aria-label="Email Address"
                        />

11-14: ⚠️ Potential issue

Dialog is always closed due to hardcoded false value.

The dialog's open prop is hardcoded to false, making it permanently closed regardless of the state.

-open={false}
+open={open}
📝 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.

            <Dialog
                open={open}
                handler={handleOpen}
                className="flex flex-col items-center justify-center bg-transparent"

21-28: ⚠️ Potential issue

Fix window location assignment and redundant state update.

The window location assignment syntax is incorrect, and there's a redundant state update.

-setOpen(true)
-if (window.location.pathname === "/") {
-    setOpen(true)
-} else {
-    window.location.href === "/"
-}
+if (window.location.pathname !== "/") {
+    window.location.href = "/"
+}
📝 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.

                        <Button className="bg-[#F58229] hover:bg-[#F58229] font-medium hover:cursor-pointer rounded-3xl" onClick={() => {
                            if (window.location.pathname !== "/") {
                                window.location.href = "/";
                            }
                        }}>

@okhaimie-dev okhaimie-dev merged commit 9a38a2f into develop Feb 22, 2025
3 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