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 contributors' docs #420

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

Add contributors' docs #420

wants to merge 2 commits into from

Conversation

avikalpg
Copy link
Member

@avikalpg avikalpg commented Oct 8, 2024

Important change: Renamed the section from "Developer Guide" to "Contributor Guide" because our users are also developers and they might get confused.

Note: the documentation that is added is just a placeholder for now - they are better than having broken links on the website. We will fix the contents later when we try to attract open source contributions to our project.

Copy link

vercel bot commented Oct 8, 2024

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

Name Status Preview Comments Updated (UTC)
team-monitor-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 3:32pm

Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Caution

Review failed

The head commit changed during the review from 394e9fe to 4126b84.

Walkthrough

The pull request encompasses updates to several files, primarily focusing on enhancing the functionality of the documentation components and updating the application metadata. The package.json file has its version number incremented. Multiple new React components named Terms have been introduced across various documentation files, which fetch and display content from Markdown files. Additionally, pages/_app.tsx has been modified to improve script handling and SEO metadata.

Changes

File Path Change Summary
package.json Version updated: "version": "1.2.14""version": "1.2.15"
pages/_app.tsx New import: import Script from 'next/script';
Updated <title> and <meta> tags for SEO.
pages/docs/contributor-guide/dpu-setup.tsx New component Terms added; fetches and displays Markdown content.
pages/docs/contributor-guide/extension-setup.tsx New component Terms added; fetches and displays Markdown content.
pages/docs/contributor-guide/index.tsx New component Terms added; fetches and displays Markdown content.
pages/docs/contributor-guide/server-setup.tsx New component Terms added; fetches and displays Markdown content.
views/docs/DocsSideBar.tsx Updated navItems array; renamed "Developer Guide" to "Contributor Guide" and updated child items.

Possibly related PRs

Suggested reviewers

  • tapishr

Poem

🐰 In the garden of code, we hop and play,
With new terms and scripts to brighten the day.
From version to version, we leap with delight,
Fetching guides for contributors, all shiny and bright!
So let’s cheer for the changes, both big and small,
Together we flourish, together we stand tall! 🌼


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

Copy link
Contributor

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

Actionable comments posted: 8

🧹 Outside diff range and nitpick comments (10)
pages/docs/contributor-guide/dpu-setup.tsx (3)

9-9: Consider adding a loading state.

While the state management is implemented correctly, consider adding a loading state to improve user experience. This can prevent a flash of empty content before the markdown is loaded.

You could modify the state like this:

-const [contributorGuideContent, setContributorGuideContent] = React.useState('');
+const [contributorGuideContent, setContributorGuideContent] = React.useState({ content: '', isLoading: true });

Then update the fetch logic and the rendering accordingly.


34-34: Update export to match component name.

The default export is correct. However, if you implement the suggested changes to rename the component, remember to update this line as well.

If you rename the component to DpuSetup as suggested earlier, update this line to:

export default DpuSetup;

1-34: Overall assessment: Good foundation with room for improvement

The new component for displaying contributor guide content is implemented using modern React practices and responsive design. However, there are several areas for improvement:

  1. Align the component name, file name, and content being fetched for consistency.
  2. Implement proper error and loading state handling for better user experience.
  3. Make the content URL configurable for increased flexibility.
  4. Refine state management to include loading and error states.

Addressing these points will significantly enhance the component's robustness and maintainability.

Consider breaking down this component into smaller, reusable parts. For example, you could create a generic MarkdownFetcher component that handles fetching and rendering markdown content, which could be reused across different documentation pages.

pages/docs/contributor-guide/index.tsx (2)

18-31: LGTM: Rendering logic is well-structured. Consider adding a title for accessibility.

The rendering logic is well-organized and uses appropriate components for a documentation page. The use of flexbox for responsiveness is a good practice.

To improve accessibility, consider adding a title to the main content area:

Apply this diff to add a title:

 <div className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
+  <h1 className="text-2xl font-bold mb-4">Contributor Guide</h1>
   <RenderMarkdown markdownText={contributorGuideContent} />
 </div>

34-34: Update export statement if component is renamed.

If you rename the component as suggested earlier, don't forget to update the export statement accordingly.

Apply this diff if you rename the component:

-export default Terms
+export default ContributorGuide
pages/docs/contributor-guide/server-setup.tsx (1)

34-34: Consider renaming the file to match the component name

The file is currently named server-setup.tsx, but the component is named Terms. To improve code organization and maintainability, consider renaming the file to match the component name.

Rename the file from server-setup.tsx to Terms.tsx or adjust the component name to match the current file name, depending on the intended purpose of this component.

pages/docs/contributor-guide/extension-setup.tsx (2)

8-9: Consider renaming the component for clarity.

The component name Terms doesn't accurately reflect its purpose of displaying contributor guide content. A more descriptive name like ContributorGuideContent or ExtensionSetupGuide would better convey its functionality.


18-34: LGTM: Well-structured layout with a minor suggestion.

The component's render method is well-structured, using appropriate components for navigation, sidebar, content, and footer. The use of flexbox for responsiveness is commendable.

Consider limiting the maximum width of the content area for improved readability on larger screens. You could add a max-w-3xl Tailwind class to the content div:

- <div className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
+ <div className='sm:w-2/3 mx-auto mt-8 px-2 py-2 max-w-3xl'>
views/docs/DocsSideBar.tsx (1)

23-29: Approve changes with minor suggestions

The renaming from "Developer Guide" to "Contributor Guide" has been implemented correctly, and the new child items align well with the PR objectives. Good job on introducing the placeholder documentation structure.

A couple of minor suggestions:

  1. Consider setting an href for the main "Contributor Guide" item, perhaps pointing to '/docs/contributor-guide' to match the "Overview" child item.
  2. Update the comment "Add more developer-specific items here" to "Add more contributor-specific items here" for consistency with the new terminology.

Here's a suggested diff for these minor improvements:

 {
 		label: 'Contributor Guide',
-		href: '',
+		href: '/docs/contributor-guide',
 		children: [
 			{ label: 'Overview', href: '/docs/contributor-guide' },
 			{ label: 'Server Setup', href: '/docs/contributor-guide/server-setup' },
 			{ label: 'Modifying the browser extension', href: '/docs/contributor-guide/extension-setup' },
 			{ label: 'Environment Setup for DPU', href: '/docs/contributor-guide/dpu-setup' },
-			// Add more developer-specific items here
+			// Add more contributor-specific items here
 		],
 	},
pages/_app.tsx (1)

14-21: LGTM: Comprehensive keyword expansion

The addition of new keywords significantly enhances the SEO metadata, covering a wide range of relevant topics. This aligns well with the PR's objective of improving documentation and attracting open-source contributions.

Consider alphabetizing the keywords for easier maintenance and to avoid potential duplicates. You could use a script to sort them automatically:

const sortedKeywords = [...keywords].sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2f4cd1e and 20ba2a7.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • package.json (1 hunks)
  • pages/_app.tsx (3 hunks)
  • pages/docs/contributor-guide/dpu-setup.tsx (1 hunks)
  • pages/docs/contributor-guide/extension-setup.tsx (1 hunks)
  • pages/docs/contributor-guide/index.tsx (1 hunks)
  • pages/docs/contributor-guide/server-setup.tsx (1 hunks)
  • views/docs/DocsSideBar.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • package.json
🧰 Additional context used
🪛 Biome
pages/_app.tsx

[error] 44-44: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

🔇 Additional comments (8)
pages/docs/contributor-guide/dpu-setup.tsx (2)

1-5: Imports look good!

The necessary components and libraries are correctly imported. The organization is clear and appropriate for the component's functionality.


8-8: Component declaration is correct.

The Terms component is properly declared as a functional component using arrow function syntax, which aligns with modern React best practices.

pages/docs/contributor-guide/index.tsx (1)

1-5: LGTM: Imports are well-structured and necessary.

The imports are correctly organized and include all the necessary components for rendering the contributor guide page.

pages/docs/contributor-guide/server-setup.tsx (1)

1-6: Verify component name and fetched content consistency

The component is named Terms and is located in server-setup.tsx, but it's fetching the README.md file. This seems inconsistent with the component's purpose and location. Consider the following:

  1. Rename the component to better reflect its purpose (e.g., ServerSetup or ContributorGuide).
  2. Update the fetched file to match the component's purpose (e.g., CONTRIBUTING.md or SERVER_SETUP.md).
  3. Ensure the file location (server-setup.tsx) aligns with the component's purpose.

To confirm the intended content, run:

pages/docs/contributor-guide/extension-setup.tsx (1)

1-6: LGTM: Imports are well-structured and relevant.

The imports are correctly organized and include all necessary components for the Terms component.

pages/_app.tsx (3)

4-4: LGTM: Appropriate use of Next.js Script component

The addition of import Script from 'next/script'; is a good practice. This Next.js component provides better control over script loading and execution, which can improve performance and user experience.


38-39: LGTM: Improved title and meta description

The updated title and meta description provide a clearer, more specific representation of the application's purpose and benefits. This change aligns well with the PR objective of reducing confusion and improving documentation.

The new title "Vibinex • Review PRs 10x Faster on GitHub" is catchy and highlights a key benefit, which could improve click-through rates from search results.


Line range hint 1-59: Overall assessment: Positive improvements with minor security concern

The changes in this file effectively enhance the application's metadata, SEO, and script handling. The new keywords, updated title, and meta description align well with the PR objectives of improving documentation and reducing confusion. The use of Next.js's Script component is a step in the right direction for better performance.

However, the security concern with dangerouslySetInnerHTML should be addressed to ensure the application's safety.

To ensure these changes don't introduce any unintended side effects, please run the following verification steps:

  1. Check that the application builds successfully without warnings.
  2. Verify that the Microsoft Clarity script still functions correctly after implementing the suggested security improvement.
  3. Test the application's SEO performance using tools like Google's Lighthouse or SEO analyzers to confirm the positive impact of the metadata changes.
🧰 Tools
🪛 Biome

[error] 44-44: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

Comment on lines +11 to +16
React.useEffect(() => {
fetch('https://raw.githubusercontent.com/vibinex/vibi-dpu/refs/heads/main/README.md')
.then(response => response.text())
.then(text => setContributorGuideContent(text))
.catch(error => console.error('Error fetching CONTRIBUTING.md:', error));
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Improve fetch logic and component naming.

While the fetch logic is implemented correctly, there are a few areas for improvement:

  1. Consider making the URL configurable, perhaps through props or environment variables, to increase flexibility.
  2. Improve error handling to provide feedback to the user, not just log to the console.
  3. The component name (Terms) doesn't match the file name (dpu-setup.tsx) or the fetched content (README.md). Consider renaming for consistency.

Here's a suggested improvement:

interface DpuSetupProps {
  readmeUrl: string;
}

const DpuSetup: React.FC<DpuSetupProps> = ({ readmeUrl }) => {
  const [content, setContent] = React.useState({ text: '', isLoading: true, error: null });

  React.useEffect(() => {
    fetch(readmeUrl)
      .then(response => response.text())
      .then(text => setContent({ text, isLoading: false, error: null }))
      .catch(error => setContent({ text: '', isLoading: false, error: error.message }));
  }, [readmeUrl]);

  // ... rest of the component
}

export default DpuSetup;

Usage:

<DpuSetup readmeUrl="https://raw.githubusercontent.com/vibinex/vibi-dpu/refs/heads/main/README.md" />

Comment on lines +18 to +31
return (
<>
<Navbar transparent={false} />
<div className="flex flex-col sm:flex-row">
<DocsSideBar className='w-full sm:w-80' />

<div className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
<RenderMarkdown markdownText={contributorGuideContent} />
</div>

</div>
<Footer />
</>
)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance render method with loading and error states.

The render method is well-structured and implements responsive design. However, it doesn't handle loading or error states, which could lead to a poor user experience.

Consider updating the render method to handle these states:

return (
  <>
    <Navbar transparent={false} />
    <div className="flex flex-col sm:flex-row">
      <DocsSideBar className='w-full sm:w-80' />
      <div className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
        {content.isLoading ? (
          <p>Loading...</p>
        ) : content.error ? (
          <p>Error: {content.error}</p>
        ) : (
          <RenderMarkdown markdownText={content.text} />
        )}
      </div>
    </div>
    <Footer />
  </>
)

This change assumes you've implemented the state management improvements suggested earlier.

Comment on lines +11 to +16
React.useEffect(() => {
fetch('https://raw.githubusercontent.com/vibinex/vibinex/refs/heads/main/CONTRIBUTING.md')
.then(response => response.text())
.then(text => setContributorGuideContent(text))
.catch(error => console.error('Error fetching CONTRIBUTING.md:', error));
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve fetch logic and error handling.

While the use of useEffect for fetching data is appropriate, consider the following improvements:

  1. Move the hardcoded URL to an environment variable or a configuration file for better maintainability.
  2. Implement proper error handling to display an error message to the user instead of just logging to the console.
  3. Consider adding a loading state to improve user experience while fetching the content.

Here's a suggested implementation:

const [contributorGuideContent, setContributorGuideContent] = React.useState('');
const [isLoading, setIsLoading] = React.useState(true);
const [error, setError] = React.useState<string | null>(null);

React.useEffect(() => {
  const fetchContent = async () => {
    try {
      setIsLoading(true);
      const response = await fetch(process.env.CONTRIBUTOR_GUIDE_URL);
      if (!response.ok) {
        throw new Error('Failed to fetch contributor guide');
      }
      const text = await response.text();
      setContributorGuideContent(text);
    } catch (error) {
      setError('Error fetching contributor guide. Please try again later.');
      console.error('Error fetching CONTRIBUTING.md:', error);
    } finally {
      setIsLoading(false);
    }
  };

  fetchContent();
}, []);

Don't forget to handle the loading and error states in your JSX rendering.

Comment on lines 8 to 9
const Terms = () => {
const [contributorGuideContent, setContributorGuideContent] = React.useState('');
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Rename component to reflect its purpose.

The component name Terms is misleading for a contributor guide page. Consider renaming it to ContributorGuide or ContributorGuidePage to better reflect its purpose.

The use of useState for managing the fetched content is appropriate.

Apply this diff to rename the component:

-const Terms = () => {
+const ContributorGuide = () => {

Don't forget to update the export statement at the end of the file as well.

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

Suggested change
const Terms = () => {
const [contributorGuideContent, setContributorGuideContent] = React.useState('');
const ContributorGuide = () => {
const [contributorGuideContent, setContributorGuideContent] = React.useState('');

Comment on lines 8 to 16
const Terms = () => {
const [contributorGuideContent, setContributorGuideContent] = React.useState('');

React.useEffect(() => {
fetch('https://raw.githubusercontent.com/vibinex/vibinex-server/refs/heads/main/README.md')
.then(response => response.text())
.then(text => setContributorGuideContent(text))
.catch(error => console.error('Error fetching CONTRIBUTING.md:', error));
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance error handling and add loading state

The current implementation can be improved in terms of error handling and user experience:

  1. Add a loading state to inform users while content is being fetched.
  2. Implement better error handling to display user-friendly error messages.
  3. Consider adding a retry mechanism for failed fetches.

Here's a suggested implementation:

const Terms = () => {
  const [contributorGuideContent, setContributorGuideContent] = React.useState('');
  const [isLoading, setIsLoading] = React.useState(true);
  const [error, setError] = React.useState<string | null>(null);

  const fetchContent = async () => {
    try {
      setIsLoading(true);
      setError(null);
      const response = await fetch('https://raw.githubusercontent.com/vibinex/vibinex-server/refs/heads/main/README.md');
      if (!response.ok) throw new Error('Failed to fetch content');
      const text = await response.text();
      setContributorGuideContent(text);
    } catch (err) {
      setError('Error fetching content. Please try again later.');
      console.error('Error fetching README.md:', err);
    } finally {
      setIsLoading(false);
    }
  };

  React.useEffect(() => {
    fetchContent();
  }, []);

  // ... rest of the component
}

Update the return statement to handle these new states:

{isLoading && <p>Loading...</p>}
{error && <p className="text-red-500">{error}</p>}
{!isLoading && !error && <RenderMarkdown markdownText={contributorGuideContent} />}

Comment on lines +18 to +32
return (
<>
<Navbar transparent={false} />
<div className="flex flex-col sm:flex-row">
<DocsSideBar className='w-full sm:w-80' />

<div className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
<RenderMarkdown markdownText={contributorGuideContent} />
</div>

</div>
<Footer />
</>
)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance accessibility and SEO

The current layout structure is good, but we can improve it for better accessibility and SEO:

  1. Add appropriate heading tags (h1, h2, etc.) to structure the content hierarchy.
  2. Include meta tags for SEO, if not already present in a layout component.
  3. Add ARIA labels to improve accessibility.

Here's a suggested implementation:

return (
  <>
    <Navbar transparent={false} />
    <main className="flex flex-col sm:flex-row">
      <DocsSideBar className='w-full sm:w-80' />
      <article className='sm:w-2/3 mx-auto mt-8 px-2 py-2'>
        <h1 className="text-2xl font-bold mb-4">Contributor Guide: Server Setup</h1>
        {isLoading && <p>Loading...</p>}
        {error && <p className="text-red-500" role="alert">{error}</p>}
        {!isLoading && !error && <RenderMarkdown markdownText={contributorGuideContent} />}
      </article>
    </main>
    <Footer />
  </>
)

Also, consider adding meta tags in the appropriate place (e.g., in a Head component or a layout wrapper):

<Head>
  <title>Contributor Guide: Server Setup | Your Project Name</title>
  <meta name="description" content="Learn how to set up the server for contributing to our project." />
</Head>

Comment on lines +11 to +16
React.useEffect(() => {
fetch('https://raw.githubusercontent.com/vibinex/chrome-extension/refs/heads/main/README.md')
.then(response => response.text())
.then(text => setContributorGuideContent(text))
.catch(error => console.error('Error fetching CONTRIBUTING.md:', error));
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Improve content fetching and error handling.

  1. The fetch URL points to the main branch, which may not be ideal for production. Consider using a specific commit hash or tag for stability.

  2. Error handling only logs to the console. Consider updating the state to show an error message to the user.

  3. The error log message mentions 'CONTRIBUTING.md', but you're fetching 'README.md'. Update the error message for consistency.

Here's a suggested improvement:

React.useEffect(() => {
  const fetchContent = async () => {
    try {
      const response = await fetch('https://raw.githubusercontent.com/vibinex/chrome-extension/<specific-commit-or-tag>/README.md');
      if (!response.ok) throw new Error('Failed to fetch content');
      const text = await response.text();
      setContributorGuideContent(text);
    } catch (error) {
      console.error('Error fetching README.md:', error);
      setContributorGuideContent('Failed to load content. Please try again later.');
    }
  };
  fetchContent();
}, []);

pages/_app.tsx Outdated
Comment on lines 42 to 53
{/* Microsoft Clarity Update */}
<Script
dangerouslySetInnerHTML={{
__html: `
(function(c,l,a,r,i,t,y){
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
})(window, document, "clarity", "script", "${process.env.CLARITY_ID}");
`
}}
/>

</Head>
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Security concern: Use of dangerouslySetInnerHTML

While using the Next.js Script component is a good practice for performance, the use of dangerouslySetInnerHTML poses a security risk. It can potentially expose users to cross-site scripting (XSS) attacks.

Consider using the src prop of the Script component instead:

<Script
  src={`https://www.clarity.ms/tag/${process.env.CLARITY_ID}`}
  strategy="afterInteractive"
/>

This approach is safer and aligns better with Next.js best practices. If you need to execute additional code, consider using the onLoad prop:

<Script
  src={`https://www.clarity.ms/tag/${process.env.CLARITY_ID}`}
  strategy="afterInteractive"
  onLoad={() => {
    // Any additional initialization code can go here
  }}
/>

Would you like me to provide a complete implementation or open an issue to track this security improvement?

🧰 Tools
🪛 Biome

[error] 44-44: Avoid passing content using the dangerouslySetInnerHTML prop.

Setting content using code can expose users to cross-site scripting (XSS) attacks

(lint/security/noDangerouslySetInnerHtml)

… than showing 404. We will fix the docs later.
Copy link

sonarcloud bot commented Oct 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
68.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link

vibinex-dpu bot commented Oct 14, 2024

Relevant users for this PR:

Contributor Name/Alias Relevance
avikalpg 100.00%

Ignoring following files due to large size: - pages/docs/contributor-guide/dpu-setup.tsx

  • pages/docs/contributor-guide/extension-setup.tsx
  • pages/docs/contributor-guide/index.tsx
  • pages/docs/contributor-guide/server-setup.tsx

Auto assigning to relevant reviewers.

If you are a relevant reviewer, you can use the Vibinex browser extension to see parts of the PR relevant to you
Relevance of the reviewer is calculated based on the git blame information of the PR. To know more, hit us up at [email protected].

To change comment and auto-assign settings, go to your Vibinex settings page.

Copy link

vibinex-dpu bot commented Oct 14, 2024

Diff Graph:

Call Stack Diff

%%{init: { 'theme': 'neutral', 'themeVariables': { 'fontSize': '20px' }, 'flowchart': { 'nodeSpacing': 100, 'rankSpacing': 100 } } }%%
 	flowchart LR

	classDef modified stroke:black,fill:yellow
	classDef added stroke:black,fill:#b7e892,color:black
	classDef deleted stroke:black,fill:red

Loading

To modify DiffGraph settings, go to your Vibinex settings page.

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.

1 participant