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

feat: remove private prompts on related brain delete #842

Merged
merged 2 commits into from
Aug 7, 2023

Conversation

mamadoudicko
Copy link
Contributor

Description

  • Improve personality picker ui
  • Remove private prompts on related brains deletion

@vercel
Copy link

vercel bot commented Aug 3, 2023

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2023 7:31am
quivrapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 4, 2023 7:31am

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

LOGAF Level 3 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/components/PublicPrompts/components/PublicPromptsList/hooks/usePublicPromptsList.ts

  1. The useEffect hook is used to add and remove an event listener for clicks outside of the dropdown. This could be abstracted into a custom hook for better readability and reusability. For example:
function useClickOutside(ref: RefObject<HTMLElement>, handler: (event: MouseEvent) => void) {
  useEffect(() => {
    const listener = (event: MouseEvent) => {
      if (ref.current && !ref.current.contains(event.target as Node)) {
        handler(event);
      }
    };

    document.addEventListener('click', listener);

    return () => {
      document.removeEventListener('click', listener);
    };
  }, [ref, handler]);
}
  1. The onChange and onSelect callbacks are called with an object that includes the title and content of the selected option. This could be simplified by passing the entire Prompt object, allowing the parent component to decide which properties it needs.

LOGAF Level 2 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/components/PublicPrompts/components/PublicPromptsList/PublicPromptsList.tsx

  1. The PublicPromptsList component is well-written, but it could be improved by adding PropTypes or TypeScript interfaces to validate the props.

  2. The handleOptionClick function could be simplified. Instead of passing the entire option object, you could just pass the option.id and find the corresponding option in the parent component.

Example:

onClick={() => handleOptionClick(option.id)}

LOGAF Level 1 - /home/runner/work/quivr/quivr/frontend/app/brains-management/[brainId]/components/BrainManagementTabs/components/SettingsTab/components/PublicPrompts/PublicPrompts.tsx

The PublicPrompts component is well-written and doesn't require any changes. However, it would be beneficial to add comments to explain what the component does and how it works.


🔨💡📝


Powered by Code Review GPT

@@ -1,5 +1,5 @@
import * as Accordion from "@radix-ui/react-accordion";
Copy link
Contributor

Choose a reason for hiding this comment

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

Omg what is this

);
};

type CustomSelectProps = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's split this file. Let's have a Prompt folder with components, hooks and types in different files

Copy link
Contributor

@gozineb gozineb left a comment

Choose a reason for hiding this comment

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

Split the code

@gozineb gozineb merged commit 4c15fe2 into main Aug 7, 2023
7 of 8 checks passed
StanGirard added a commit that referenced this pull request Aug 7, 2023
StanGirard added a commit that referenced this pull request Aug 7, 2023
StanGirard added a commit that referenced this pull request Aug 7, 2023
StanGirard added a commit that referenced this pull request Aug 7, 2023
mamadoudicko added a commit that referenced this pull request Aug 7, 2023
* feat: remove private prompts on brain deletion

* ui: improve personnality picker
mamadoudicko pushed a commit that referenced this pull request Aug 7, 2023
StanGirard pushed a commit that referenced this pull request Sep 12, 2023
* feat: remove private prompts on brain deletion

* ui: improve personnality picker
StanGirard added a commit that referenced this pull request Sep 12, 2023
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.

None yet

2 participants