Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add solution #1319

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

VadimKudrenko
Copy link

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Thank you for your hard work on this pull request! There are a few critical issues that need to be addressed before we can approve it. The getSelectedTabTitle function should return the title of the tab, not the entire tab object, which is crucial for the functionality. Additionally, there's a typo in the function name checkAvailiableTabId that should be corrected to checkAvailableTabId. Lastly, please review the necessity of the selectedTab prop in the Tabs component, as it is not mentioned in the task description. Once these issues are resolved, your code will be in great shape! Keep up the great work! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

src/App.jsx Outdated
Some text 1
</div>
function getSelectedTabTitle(tabsList, tabId) {
return tabsList.find(tab => tab.id === tabId);

Choose a reason for hiding this comment

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

The getSelectedTabTitle function should return the title of the tab, not the entire tab object. Modify the function to return tab.title instead of the whole tab object.

src/App.jsx Outdated
tabs={tabs}
activeTabId={activeTabId}
onTabSelected={tabId => setNewActiveTab(tabId)}
selectedTab={selectedTab}

Choose a reason for hiding this comment

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

The selectedTab prop is not mentioned in the task description as a required prop for the Tabs component. Ensure that this prop is necessary, and consider removing it if it's not needed.


export const Tabs = ({ tabs, activeTabId, onTabSelected }) => {
const getSelectedTabTitle = (tabsList, tabId) => {
return tabsList.find(tab => tab.id === tabId);

Choose a reason for hiding this comment

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

The getSelectedTabTitle function should return the title of the tab, not the entire tab object. Modify the function to return tab.title instead of the whole tab object.

return tabsList.find(tab => tab.id === tabId);
};

function checkAvailiableTabId(id) {

Choose a reason for hiding this comment

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

There's a typo in the function name checkAvailiableTabId. Consider renaming it to checkAvailableTabId for correct spelling.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on addressing the issues from the previous review! 🎉 The code now meets the task requirements and constraints, and the implementation follows the specified guidelines for rendering tabs and managing active states. Here are some important points to consider:

  • getSelectedTabTitle Function: You've successfully corrected the function to return only the title of the tab, which resolves the previous issue.

  • Function Naming: The typo in the function name checkAvailiableTabId has been corrected to checkAvailableTabId. Ensure that all references to the old name are removed, including any commented-out lines.

  • selectedTab Variable: The necessity of the selectedTab variable in the App component was questioned. Please review its usage and remove it if it's not required according to the task description.

  • Code Cleanliness: Keep your code clean by removing unnecessary comments and ensuring that all references to outdated code are eliminated.

Your efforts to improve the code are evident, and this decision is made to help you move forward with your learning. Please review the comments to further enhance your code quality. Keep up the great work and continue learning from these experiences! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨


export const App = () => {
const [activeTabId, setActiveTabId] = useState(tabs[0].id);
const selectedTab = getSelectedTabTitle(tabs, activeTabId);

Choose a reason for hiding this comment

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

The selectedTab variable is being used here, but its necessity was questioned in the previous review. Please ensure that this variable is required according to the task description, or remove it if it's not needed.

key={tab.id}
tab={tab}
activeTabId={checkAvailableTabId(activeTabId)}
// activeTabId={checkAvailiableTabId(activeTabId)}

Choose a reason for hiding this comment

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

Remove this commented-out line as it references the old function name checkAvailiableTabId, which has been corrected to checkAvailableTabId. Keeping the code clean and free of unnecessary comments is a good practice.

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