Skip to content

add setting modal #5

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add setting modal #5

wants to merge 1 commit into from

Conversation

malinosqui
Copy link
Member

@malinosqui malinosqui commented Jun 9, 2025

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


This pull request introduces a settings modal to the kodustech/onlook repository, merging changes from the feat/add-setting-modal branch into the main branch. Key updates include:

  1. Modals Integration: The Modals component is imported and rendered within the Main component's layout to provide modal functionality for the project view.

  2. Project Management Enhancements: New manager classes (DomainsManager, VersionsManager) are added with initial structures and getters. The ProjectManager now includes functionality to scan and parse project metadata from a specified layout file, updating the project state with limited error handling.

  3. Metadata Handling: Functionality to extract metadata from files by parsing their AST is introduced. Suggestions for code refactoring, type safety improvements, and documentation enhancements are provided.

  4. UI Component Refactoring: The Modals component is refactored by replacing the TooltipProvider with a React Fragment, simplifying the structure. The mechanism for opening external URLs is updated to use window.open(url, '_blank').

  5. Settings Modal Adjustments: The settings modal sees several updates, including re-enabling a useEffect hook for data scanning, commenting out analytics-related functionality, and renaming a property from metadata to siteMetadata for site-specific settings.

  6. Project Interface Updates: The Project interface is enhanced with new fields for url, siteMetadata, domains, and an optional env for environment variables, along with necessary type imports.

These changes collectively aim to enhance the functionality and maintainability of the project settings and metadata management within the application.

Copy link

kodus-qa bot commented Jun 9, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

}
return null;
})
.filter(Boolean);

This comment was marked as resolved.

Comment on lines +8 to +12
<>
<SettingsModal />
{/* <QuittingModal /> */}
<SubscriptionModal />
</TooltipProvider>
</>
Copy link

Choose a reason for hiding this comment

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

kody code-review Potential Issues high

// If TooltipProvider is confirmed to be necessary for tooltips in child modals:
import { TooltipProvider } from '@onlook/ui/tooltip'; // Ensure this import is present

// ... other code ...

export const Modals = () => {
    return (
        <TooltipProvider>
            <SettingsModal />
            {/* <QuittingModal /> */}
            <SubscriptionModal />
        </TooltipProvider>
    );
};

The TooltipProvider has been removed and replaced by a React Fragment (new lines 8 and 12). If SettingsModal or SubscriptionModal (or any components they render) rely on the context from TooltipProvider (presumably from '@onlook/ui/tooltip') for tooltips to function correctly, this change could lead to broken or missing tooltips. Please verify that TooltipProvider is no longer necessary for these components or that its functionality has been accounted for elsewhere (e.g., if tooltips are no longer used or if a different provider mechanism is in place).

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

@@ -27,7 +26,7 @@ export const BaseDomain = observer(() => {
}

const url = getValidUrl(baseUrl);
// invokeMainChannel(MainChannels.OPEN_EXTERNAL_WINDOW, url);
window.open(url, '_blank');
Copy link

Choose a reason for hiding this comment

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

kody code-review Security high

        window.open(url, '_blank', 'noopener,noreferrer');

When using window.open with target='_blank', it's recommended to add rel='noopener noreferrer' as the third argument (windowFeatures) to prevent potential security vulnerabilities like tabnabbing. noopener prevents the new page from accessing the window.opener property, and noreferrer prevents the browser from sending the Referer HTTP header to the new page.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

Comment on lines +34 to +40
useEffect(() => {
if (editorEngine.state.settingsOpen && project) {
pagesManager.scanPages();
editorEngine.image.scanImages();
projectsManager.scanProjectMetadata();
}
}, [editorEngine.state.settingsOpen]);
Copy link

Choose a reason for hiding this comment

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

kody code-review Potential Issues high

useEffect(() => {
    if (editorEngine.state.settingsOpen && project) {
        pagesManager.scanPages();
        editorEngine.image.scanImages();
        projectsManager.scanProjectMetadata();
    }
}, [editorEngine.state.settingsOpen, project, pagesManager, editorEngine.image, projectsManager]);

The useEffect hook (lines 34-40) uses project, pagesManager, editorEngine.image, and projectsManager (via its methods like scanPages, scanImages, scanProjectMetadata) from the component scope. However, only editorEngine.state.settingsOpen is included in its dependency array. This can lead to the effect using stale values for these variables if they change while editorEngine.state.settingsOpen remains constant (e.g., modal is open). To ensure the effect operates with the correct and current data, these dependencies should be added to the array.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

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