Skip to content

Conversation

@theartcher
Copy link
Contributor

This PR proposes to;

  • Add PR template.
  • Update README for ease of use.
  • Restructured 'navigator' component, moving models and interfaces to their own directory.
  • Fixed 'yes and no' buttons on the navigator component.

…their own directory. Improved code readability. Removed unused baseURL variable.
@theartcher theartcher self-assigned this Dec 18, 2025
Copilot AI review requested due to automatic review settings December 18, 2025 09:17
@theartcher theartcher added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request labels Dec 18, 2025
@theartcher theartcher merged commit d53c97b into main Dec 18, 2025
5 checks passed
@theartcher theartcher deleted the bugfix/#34/buttons-not-centered-correctly branch December 18, 2025 09:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restructures the navigator component by extracting models and interfaces into a dedicated models directory, adds a pull request template, updates README guidelines for clarity, and fixes the responsive button layout on mobile devices.

Key Changes:

  • Extracted type definitions (YesOrNo, NodeType, DecisionNode, DecisionTree, Answer) into separate files under src/models/
  • Moved helper functions from src/data/decision-tree.ts to new src/utils/decision-tree-helper.ts utility file
  • Fixed mobile button layout by adjusting CSS min-width from 100% to 30vw and removing vertical stacking

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/models/yes-or-no.ts New file defining the YesOrNo type (previously in QuestionCard.tsx)
src/models/node-type.ts New file defining the NodeType type (previously in decision-tree.ts)
src/models/decision-tree.ts New file defining the DecisionTree interface (previously in decision-tree.ts)
src/models/decision-node.ts New file defining the DecisionNode interface (previously in decision-tree.ts)
src/models/answer.ts New file defining the Answer interface (previously in NavigatorContainer.tsx)
src/utils/decision-tree-helper.ts New utility file with helper functions moved from decision-tree.ts, but contains incorrect import paths
src/data/decision-tree.ts Removed type definitions and helper functions, now only exports decisionTree data
src/components/navigator/QuestionCard.tsx Updated to import YesOrNo from models directory instead of exporting it
src/components/navigator/NavigatorContainer.tsx Updated imports to use new model and utility file locations
src/components/navigator/AnsweredQuestion.tsx Updated imports and added logic to prevent redundant answer changes
src/components/navigator/PatternResult.tsx Removed unused baseURL constant
src/components/navigator/navigator.module.css Fixed button layout for mobile by adjusting min-width and removing flex-direction override
README.md Clarified coding standards: corrected "Queens" to "Queen's", specified pattern pages for template, and clarified "source code" for TODO guideline
.github/pull_request_template.md Added new PR template with sections for description, type of change, validation, checklist, and screenshots

@@ -0,0 +1,36 @@
import { YesOrNo } from "../components/navigator/QuestionCard";
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The import path is incorrect. YesOrNo has been moved to the models directory and should be imported from "@site/src/models/yes-or-no" instead of from QuestionCard.

Suggested change
import { YesOrNo } from "../components/navigator/QuestionCard";
import { YesOrNo } from "@site/src/models/yes-or-no";

Copilot uses AI. Check for mistakes.
<AnsweredQuestion
key={index}
question={node.question || ""}
question={node.question}
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The question property is optional in the DecisionNode interface (can be undefined), but here it's passed directly without a fallback. This creates an inconsistency with line 85 where the same property is safely handled with "|| ''". For type safety and consistency, this should also use a fallback.

Suggested change
question={node.question}
question={node.question || ""}

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +32
//Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
//Only call if the answer changed
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Comments should have a space after the double slashes for better readability. Change "//Only" to "// Only".

Suggested change
//Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
//Only call if the answer changed
// Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
// Only call if the answer changed

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +32
//Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
//Only call if the answer changed
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

Comments should have a space after the double slashes for better readability. Change "//Only" to "// Only".

Suggested change
//Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
//Only call if the answer changed
// Only call if the answer changed
if (answer !== "yes") {
onChangeAnswer("yes");
}
}}
onAnswerNo={() => {
// Only call if the answer changed

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,36 @@
import { YesOrNo } from "../components/navigator/QuestionCard";
import { DecisionNode, decisionTree } from "../data/decision-tree";
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

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

The import path is incorrect. DecisionNode has been moved to the models directory and should be imported from "@site/src/models/decision-node" instead of from the data/decision-tree file which no longer exports it.

Suggested change
import { DecisionNode, decisionTree } from "../data/decision-tree";
import { DecisionNode } from "@site/src/models/decision-node";
import { decisionTree } from "../data/decision-tree";

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants