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

enhance(docs): add new use cases and improve website structure #4399

Merged
merged 22 commits into from
Dec 20, 2024

Conversation

rschlaefli
Copy link
Member

@rschlaefli rschlaefli commented Dec 16, 2024

Summary by CodeRabbit

  • New Features

    • Updated Docusaurus dependencies for improved performance and features.
    • Introduced new components: AIFormativeFeedback, AIPracticeContent, ChatbotTutoring, and LearningAnalytics.
    • Enhanced UseCase component with new sections for "Goals" and "References".
    • Dynamic sidebar generation for use cases in UseCaseLayout.
    • Improved layout and organization of use cases with new CategoryHeader component.
    • Integrated Matomo analytics for enhanced tracking and insights.
  • Bug Fixes

    • Consolidated release information for use cases in the development roadmap.
    • Updated iframe source in the KnowledgeBase component.
  • Chores

    • Updated package dependencies for better compatibility.
    • Modified Docusaurus configuration for improved analytics integration.

Copy link

aviator-app bot commented Dec 16, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

Copy link

coderabbitai bot commented Dec 16, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces comprehensive updates to the documentation application, focusing on Docusaurus dependency upgrades, component restructuring, and the addition of new use case pages. The changes span multiple files across the documentation project, including package dependency updates, component layout modifications, and the introduction of new use case-specific pages. The modifications aim to improve the documentation's structure, flexibility, and presentation of use case information.

Changes

File Change Summary
apps/docs/package.json Upgraded all Docusaurus-related dependencies from ~3.6.0 to ~3.6.3 and replaced @gabrielcsapo/docusaurus-plugin-matomo with docusaurus-plugin-matomo (version ~0.0.8).
apps/docs/src/components/usecases/UseCase.tsx Added SectionHeader component, modified layout with new grid structure, introduced "Goals" and "References" sections.
apps/docs/src/components/usecases/UseCaseLayout.tsx Implemented dynamic sidebar generation using USE_CASES and USE_CASE_CATEGORIES constants.
apps/docs/src/pages/development.tsx Updated use case status for "Groups and Group Activities" and "Randomized Group Formation".
apps/docs/src/pages/kb.tsx Modified iframe source URL.
apps/docs/src/pages/use_cases/* Added new use case pages:
- ai_formative_feedback.tsx
- ai_practice_content.tsx
- chatbot_tutoring.tsx
- learning_analytics.tsx
apps/docs/src/pages/use_cases/index.tsx Introduced CategoryHeader component, updated use case card layout, added category-based rendering.
apps/docs/docusaurus.config.ts Added docusaurus-plugin-matomo to plugins and defined its configuration in themeConfig.

Possibly Related PRs

Suggested Reviewers

  • sjschlapbach

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c1156f and 8b08118.

⛔ Files ignored due to path filters (1)
  • apps/docs/static/img_v3/la_performance_students.png is excluded by !**/*.png
📒 Files selected for processing (3)
  • apps/docs/docusaurus.config.ts (3 hunks)
  • apps/docs/src/components/usecases/UseCase.tsx (2 hunks)
  • apps/docs/src/components/usecases/UseCaseLayout.tsx (2 hunks)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@rschlaefli rschlaefli marked this pull request as ready for review December 18, 2024 21:42
Copy link

@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: 4

🔭 Outside diff range comments (1)
apps/docs/src/pages/development.tsx (1)

Line range hint 143-151: Improve TypeScript type safety and React best practices.

Consider the following improvements:

  1. Replace any type with a proper interface for tile content
  2. Add a key prop to the mapped RoadmapTile components

Here's the suggested implementation:

interface UseCaseType {
  content: string;
  href?: string;
  status: string;
}

interface TileType {
  title: string;
  content: string;
  useCases: UseCaseType[];
  tags: Array<{ text: string; color: string }>;
}

// In the map function:
{tileContent.map((tile: TileType, index: number) => (
  <RoadmapTile
    key={`roadmap-tile-${index}`}
    title={tile.title}
    content={tile.content}
    useCases={tile.useCases}
    tags={tile.tags}
  />
))}
🧹 Nitpick comments (5)
apps/docs/src/pages/use_cases/learning_analytics.tsx (1)

1-7: Add JSDoc documentation for the component.

The component implementation looks good, but could benefit from JSDoc documentation to describe its purpose and usage.

Add documentation above the component:

 import UseCase from '@site/src/components/usecases/UseCase'

+/**
+ * Renders the Learning Analytics use case page using the UseCase component.
+ * This page describes how KlickerUZH can be used for learning analytics purposes.
+ */
 function LearningAnalytics() {
   return <UseCase slug="learning_analytics" />
 }
apps/docs/src/components/usecases/UseCase.tsx (1)

97-125: Improve component structure with semantic HTML and better organization.

Consider using semantic HTML5 elements and extracting sections into separate components for better maintainability.

Consider these improvements:

-<div className="prose order-2 col-span-1 max-w-none md:order-1 lg:col-span-2">
+<article className="prose order-2 col-span-1 max-w-none md:order-1 lg:col-span-2">
   <section id="Introduction">{useCase.introduction}</section>
-</div>
+</article>

-<div className="prose order-3 col-span-1 max-w-none lg:col-span-3">
+<article className="prose order-3 col-span-1 max-w-none lg:col-span-3">
   {/* Extract these sections into separate components */}
+  <UseCaseSection
+    id="Background"
+    icon={faBookOpen}
+    header="Background"
+    content={useCase.background}
+  />
   // ... similar for other sections
-</div>
+</article>

Consider creating a new UseCaseSection component to reduce duplication:

interface UseCaseSectionProps {
  id: string;
  icon: IconDefinition;
  header: string;
  content: React.ReactNode;
}

function UseCaseSection({ id, icon, header, content }: UseCaseSectionProps) {
  return (
    <section id={id} className="mb-12">
      <SectionHeader icon={icon} header={header} />
      {content}
    </section>
  );
}
apps/docs/src/components/usecases/UseCaseLayout.tsx (1)

20-41: Refactor repeated link definitions.
Each item in getUseCaseItems is structurally similar, repeating the type, label, and href properties while only changing the label and appended hash. Consider dynamically generating this array to reduce duplication and improve maintainability.

apps/docs/src/pages/use_cases/index.tsx (2)

1-6: Ensure icons remain consistent with future categories.
Adding new FontAwesome icons is fine, but if you introduce more categories in the future, ensure that CATEGORY_ICONS remains up to date so that the UI stays consistent.


14-43: Check sizing for large or missing images.
The new Card component sets a fixed height for the image container. For images that are large, small, or missing, consider fallback images or dynamic resizing to handle unexpected image aspect ratios gracefully.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54fdd47 and c72dea3.

⛔ Files ignored due to path filters (12)
  • apps/docs/static/img_v3/chatbot_data.png is excluded by !**/*.png
  • apps/docs/static/img_v3/chatbot_example.png is excluded by !**/*.png
  • apps/docs/static/img_v3/dawid-zawila-OCMcTCu97EE-unsplash.jpg is excluded by !**/*.jpg
  • apps/docs/static/img_v3/glenn-carstens-peters-RLw-UC03Gwc-unsplash.jpg is excluded by !**/*.jpg
  • apps/docs/static/img_v3/jeshoots-com--2vD8lIhdnw-unsplash.jpg is excluded by !**/*.jpg
  • apps/docs/static/img_v3/la_lecturers_async.png is excluded by !**/*.png
  • apps/docs/static/img_v3/la_lecturers_daily.png is excluded by !**/*.png
  • apps/docs/static/img_v3/la_lecturers_question.png is excluded by !**/*.png
  • apps/docs/static/img_v3/la_students_dashboard.png is excluded by !**/*.png
  • apps/docs/static/img_v3/possessed-photography-JjGXjESMxOY-unsplash.jpg is excluded by !**/*.jpg
  • apps/docs/static/img_v3/simon-kadula-8gr6bObQLOI-unsplash.jpg is excluded by !**/*.jpg
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • apps/docs/package.json (1 hunks)
  • apps/docs/src/components/usecases/UseCase.tsx (2 hunks)
  • apps/docs/src/components/usecases/UseCaseLayout.tsx (2 hunks)
  • apps/docs/src/pages/development.tsx (1 hunks)
  • apps/docs/src/pages/kb.tsx (1 hunks)
  • apps/docs/src/pages/use_cases/ai_formative_feedback.tsx (1 hunks)
  • apps/docs/src/pages/use_cases/ai_practice_content.tsx (1 hunks)
  • apps/docs/src/pages/use_cases/chatbot_tutoring.tsx (1 hunks)
  • apps/docs/src/pages/use_cases/index.tsx (1 hunks)
  • apps/docs/src/pages/use_cases/learning_analytics.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • apps/docs/src/pages/kb.tsx
  • apps/docs/src/pages/use_cases/ai_practice_content.tsx
  • apps/docs/src/pages/use_cases/chatbot_tutoring.tsx
  • apps/docs/package.json
🔇 Additional comments (8)
apps/docs/src/pages/use_cases/ai_formative_feedback.tsx (1)

1-7: Same documentation improvement needed as in learning_analytics.tsx

apps/docs/src/pages/development.tsx (2)

51-51: LGTM: Status format update improves readability.

The consolidated version format is more concise while maintaining clarity.


55-56: Verify the external URL and release information.

A few points need verification:

  1. The external URL differs from the pattern of relative paths used for other use cases
  2. The version (v3.2) and semester (HS24) indicate a future release

Let's verify the URL accessibility and check for any related documentation:

✅ Verification successful

The URL and version information appear to be consistent with the development roadmap

The verification shows:

  1. The URL is referenced consistently in both development.tsx and kb.tsx
  2. The version v3.2 (HS24) follows a clear version progression in development.tsx:
    • v2.0 (HS21)
    • v3.0 (HS23)
    • v3.0/v3.1 (HS23/FS24)
    • v3.2 (HS24)
  3. The external URL (gbl.uzh.ch) is from the same domain family as other external links in the file (community.klicker.uzh.ch)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the URL and search for related documentation

# Check if the URL is mentioned in other documentation files
echo "Searching for URL references in documentation..."
rg -l "gbl.uzh.ch/quartz" --type=md --type=mdx --type=tsx

# Check if v3.2 is mentioned in other files
echo "Searching for version references..."
rg "v3\.2.*HS24" --type=md --type=mdx --type=tsx

Length of output: 352


Script:

#!/bin/bash
# Let's try a different approach to search for the URL and version information

# Search for the URL pattern without file type restrictions
echo "Searching for URL references..."
rg "gbl\.uzh\.ch/quartz"

# Search for version pattern without file type restrictions
echo "Searching for version references..."
rg "v3\.2.*HS24"

# List all files in the docs directory to understand the structure
echo "Checking docs structure..."
fd . apps/docs/src/

# Check other version/status patterns in the development.tsx file
echo "Checking other versions in development.tsx..."
cat apps/docs/src/pages/development.tsx

Length of output: 8333

apps/docs/src/components/usecases/UseCaseLayout.tsx (2)

80-86: Styling approach is consistent and clear.
The use of tailwind-merge with Docusaurus theme classes maintains readability and consistency across your layout. This approach looks good.


45-62: Verify the dynamic sidebar generation for categories with no use cases.
If a category in USE_CASE_CATEGORIES doesn't have any use cases, the current approach may produce empty or partially populated menu items. Ensure that each category contains at least one use case or handle empty arrays gracefully.

✅ Verification successful

Let me try another approach to get the necessary information.


Let me analyze the USE_CASE_CATEGORIES and USE_CASES data from the constants file to verify the concern about empty categories.


Let me get the complete list of USE_CASES to properly verify all referenced use cases.


Let me try one more focused approach to extract and compare the use cases.


Based on the analysis of the code, I can now provide a final response:

All use case categories have corresponding implementations - no empty categories found.

Looking at the output, we can see that all use cases referenced in the categories (live_qa, live_quiz, group_activity, flipped_classroom, microlearning, practice_quiz, gamification, learning_analytics, ai_practice_content, ai_formative_feedback, chatbot_tutoring) are properly defined in the USE_CASES object. Each category contains at least one use case, and all referenced use cases have corresponding implementations. The dynamic sidebar generation is handling the categories appropriately with no risk of empty or partially populated menu items.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that each category in USE_CASE_CATEGORIES has at least one entry in USE_CASES.
# We'll compare the keys from category.useCases to ensure they exist in USE_CASES.

echo "Verifying each category's slugs exist in USE_CASES..."
ast-grep --pattern $'export const USE_CASE_CATEGORIES = $_' | rg 'useCases'
ast-grep --pattern $'export const USE_CASES = $_'

Length of output: 987


Script:

#!/bin/bash
# Let's examine the content of the constants file directly
cat apps/docs/src/constants.tsx

Length of output: 131064


Script:

#!/bin/bash
# Let's extract and analyze the categories and their use cases
echo "Analyzing USE_CASE_CATEGORIES..."
echo "Categories and their use cases:"
cat apps/docs/src/constants.tsx | awk '/export const USE_CASE_CATEGORIES = {/,/}/ { print }' | grep -E "useCases:|title:"

echo -e "\nVerifying all referenced use cases exist..."
cat apps/docs/src/constants.tsx | awk '/export const USE_CASES = {/,/}/ { print }' | grep -E "^  [a-z_]+: {"

Length of output: 605


Script:

#!/bin/bash
# Let's get a more complete view of the USE_CASES object
echo "All defined use cases:"
cat apps/docs/src/constants.tsx | sed -n '/export const USE_CASES = {/,/^}/p'

echo -e "\nAll use cases referenced in categories:"
cat apps/docs/src/constants.tsx | grep -o "'[a-z_]\+'" | tr -d "'"

Length of output: 78082


Script:

#!/bin/bash
# Extract use cases from categories and compare with defined use cases
echo "Use cases referenced in categories:"
cat apps/docs/src/constants.tsx | grep "useCases:" | tr -d "[]'" | sed 's/.*useCases: //'

echo -e "\nDefined use cases:"
cat apps/docs/src/constants.tsx | grep -o "^  [a-z_]\+: {" | sed 's/: {//'

Length of output: 602

apps/docs/src/pages/use_cases/index.tsx (3)

46-56: Great use of CategoryHeader for improved readability.
This modular component approach simplifies the layout and makes the categories easy to scan. The API (props structure) looks clean.


70-93: Neatly organizes use cases by category.
Mapping through the categories and grouping cards underneath them is a clear and logical approach, improving navigation and content discovery.


62-66: Confirm coverage of all categories.
The CATEGORY_ICONS object must be kept in sync with USE_CASE_CATEGORIES. If a new category is added but not included in CATEGORY_ICONS, the icon rendering could fail or be undefined.

✅ Verification successful

Let me analyze the results. I can see both the USE_CASE_CATEGORIES from constants.tsx and CATEGORY_ICONS from the use_cases/index.tsx. Let me verify if the categories match by checking their identifiers with another script.


All categories are properly covered with icons
Based on the verification results, all category identifiers in USE_CASE_CATEGORIES (interaction, engagement, and ai_enhanced_learning) have corresponding icons defined in CATEGORY_ICONS. The mapping is complete and consistent:

  • interaction → faComments
  • engagement → faFire
  • ai_enhanced_learning → faLightbulb
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Confirm that all category identifiers in USE_CASE_CATEGORIES have a corresponding icon in CATEGORY_ICONS.

echo "Checking for mismatched categories and icons..."
ast-grep --pattern $'export const USE_CASE_CATEGORIES = $_' | rg 'title'
ast-grep --pattern $'const CATEGORY_ICONS = $_'

Length of output: 1270


Script:

#!/bin/bash
# Get the full USE_CASE_CATEGORIES definition to see the identifiers
ast-grep --pattern 'export const USE_CASE_CATEGORIES = {
  $$$
}'

Length of output: 1944

apps/docs/src/components/usecases/UseCase.tsx Outdated Show resolved Hide resolved
Comment on lines +33 to 42
className="h-32 w-full object-cover sm:h-48 md:h-64 lg:h-80"
src={useCase.headerImgSrc}
/>
<div className="grid grid-cols-3 gap-4 md:mt-4 md:gap-8">
<div className="order-1 col-span-3">
<H1>{useCase.title}</H1>
<div className="grid grid-cols-1 gap-4 md:p-4 lg:grid-cols-3 lg:gap-8 lg:p-0 lg:pt-8">
<div className="col-span-1 lg:col-span-3">
<H1 className={{ root: 'mb-4' }}>{useCase.title}</H1>
<div className="flex flex-row flex-wrap gap-2">
{useCase.tags?.map((tag) => <Tag key={tag} label={tag} />)}
</div>
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve accessibility for image and tags section.

The image is missing alt text, and the tags section could benefit from ARIA labels.

Apply these accessibility improvements:

 <img
   className="h-32 w-full object-cover sm:h-48 md:h-64 lg:h-80"
   src={useCase.headerImgSrc}
+  alt={`Header image for ${useCase.title} use case`}
 />
 <div className="grid grid-cols-1 gap-4 md:p-4 lg:grid-cols-3 lg:gap-8 lg:p-0 lg:pt-8">
   <div className="col-span-1 lg:col-span-3">
     <H1 className={{ root: 'mb-4' }}>{useCase.title}</H1>
-    <div className="flex flex-row flex-wrap gap-2">
+    <div className="flex flex-row flex-wrap gap-2" aria-label="Use case tags">
       {useCase.tags?.map((tag) => <Tag key={tag} label={tag} />)}
     </div>
   </div>
📝 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
className="h-32 w-full object-cover sm:h-48 md:h-64 lg:h-80"
src={useCase.headerImgSrc}
/>
<div className="grid grid-cols-3 gap-4 md:mt-4 md:gap-8">
<div className="order-1 col-span-3">
<H1>{useCase.title}</H1>
<div className="grid grid-cols-1 gap-4 md:p-4 lg:grid-cols-3 lg:gap-8 lg:p-0 lg:pt-8">
<div className="col-span-1 lg:col-span-3">
<H1 className={{ root: 'mb-4' }}>{useCase.title}</H1>
<div className="flex flex-row flex-wrap gap-2">
{useCase.tags?.map((tag) => <Tag key={tag} label={tag} />)}
</div>
</div>
className="h-32 w-full object-cover sm:h-48 md:h-64 lg:h-80"
src={useCase.headerImgSrc}
alt={`Header image for ${useCase.title} use case`}
/>
<div className="grid grid-cols-1 gap-4 md:p-4 lg:grid-cols-3 lg:gap-8 lg:p-0 lg:pt-8">
<div className="col-span-1 lg:col-span-3">
<H1 className={{ root: 'mb-4' }}>{useCase.title}</H1>
<div className="flex flex-row flex-wrap gap-2" aria-label="Use case tags">
{useCase.tags?.map((tag) => <Tag key={tag} label={tag} />)}
</div>
</div>

Comment on lines +44 to +77
<div className="prose sticky top-4 order-1 col-span-1 h-fit bg-slate-100 p-4 shadow-sm md:order-2 lg:rounded-lg">
<H2 className={{ root: 'mb-2 text-slate-600' }}>Goals</H2>
<div className="space-y-2 text-sm">
{useCase.goals?.map((goal, index) => {
// Check if the goal is a nested structure
if (Array.isArray(goal)) {
const [category, subgoals] = goal
return (
<div key={index} className="space-y-2">
<div className="font-bold text-slate-600">{category}</div>
{subgoals.map((subgoal, subIndex) => (
<div key={subIndex} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
/>
<div>{subgoal}</div>
</div>
))}
</div>
)
}
// Handle flat goal structure
return (
<div key={index} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
/>
<div>{goal}</div>
</div>
)
})}
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Improve accessibility and type safety for goals section.

The goals section needs ARIA labels and proper TypeScript types for the goals data structure.

Add these improvements:

+type Goal = string | [string, string[]];
+
-<div className="prose sticky top-4 order-1 col-span-1 h-fit bg-slate-100 p-4 shadow-sm md:order-2 lg:rounded-lg">
+<div 
+  className="prose sticky top-4 order-1 col-span-1 h-fit bg-slate-100 p-4 shadow-sm md:order-2 lg:rounded-lg"
+  aria-labelledby="goals-heading"
+>
-  <H2 className={{ root: 'mb-2 text-slate-600' }}>Goals</H2>
+  <H2 id="goals-heading" className={{ root: 'mb-2 text-slate-600' }}>Goals</H2>
   <div className="space-y-2 text-sm">
     {useCase.goals?.map((goal: Goal, index) => {
       if (Array.isArray(goal)) {
         const [category, subgoals] = goal;
         return (
           <div key={index} className="space-y-2">
             <div className="font-bold text-slate-600">{category}</div>
             {subgoals.map((subgoal, subIndex) => (
               <div key={subIndex} className="flex items-start gap-3">
                 <FontAwesomeIcon
                   icon={faCircleCheck}
                   className="mt-1 text-slate-400"
+                  aria-hidden="true"
                 />
                 <div>{subgoal}</div>
               </div>
             ))}
           </div>
         );
       }
       return (
         <div key={index} className="flex items-start gap-3">
           <FontAwesomeIcon
             icon={faCircleCheck}
             className="mt-1 text-slate-400"
+            aria-hidden="true"
           />
           <div>{goal}</div>
         </div>
       );
     })}
   </div>
📝 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
<div className="prose sticky top-4 order-1 col-span-1 h-fit bg-slate-100 p-4 shadow-sm md:order-2 lg:rounded-lg">
<H2 className={{ root: 'mb-2 text-slate-600' }}>Goals</H2>
<div className="space-y-2 text-sm">
{useCase.goals?.map((goal, index) => {
// Check if the goal is a nested structure
if (Array.isArray(goal)) {
const [category, subgoals] = goal
return (
<div key={index} className="space-y-2">
<div className="font-bold text-slate-600">{category}</div>
{subgoals.map((subgoal, subIndex) => (
<div key={subIndex} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
/>
<div>{subgoal}</div>
</div>
))}
</div>
)
}
// Handle flat goal structure
return (
<div key={index} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
/>
<div>{goal}</div>
</div>
)
})}
</div>
type Goal = string | [string, string[]];
<div
className="prose sticky top-4 order-1 col-span-1 h-fit bg-slate-100 p-4 shadow-sm md:order-2 lg:rounded-lg"
aria-labelledby="goals-heading"
>
<H2 id="goals-heading" className={{ root: 'mb-2 text-slate-600' }}>Goals</H2>
<div className="space-y-2 text-sm">
{useCase.goals?.map((goal: Goal, index) => {
if (Array.isArray(goal)) {
const [category, subgoals] = goal;
return (
<div key={index} className="space-y-2">
<div className="font-bold text-slate-600">{category}</div>
{subgoals.map((subgoal, subIndex) => (
<div key={subIndex} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
aria-hidden="true"
/>
<div>{subgoal}</div>
</div>
))}
</div>
);
}
return (
<div key={index} className="flex items-start gap-3">
<FontAwesomeIcon
icon={faCircleCheck}
className="mt-1 text-slate-400"
aria-hidden="true"
/>
<div>{goal}</div>
</div>
);
})}
</div>
</div>

apps/docs/src/components/usecases/UseCaseLayout.tsx Outdated Show resolved Hide resolved
Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c72dea3 and 1c1156f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • apps/docs/docusaurus.config.ts (2 hunks)
  • apps/docs/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/docs/package.json
🔇 Additional comments (1)
apps/docs/docusaurus.config.ts (1)

76-76: Verify Matomo plugin compatibility and installation

Please ensure that:

  1. The plugin is properly installed in package.json
  2. The plugin version is compatible with the current Docusaurus version
✅ Verification successful

Let me check the package.json location since it might be in the docs app directory.


Plugin installation and compatibility verified

The Matomo plugin (v0.0.8) is properly installed in apps/docs/package.json and is compatible with Docusaurus v3.6.3. The plugin configuration can proceed safely.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the plugin is installed and verify its version
cat package.json | jq '.dependencies["docusaurus-plugin-matomo"] // .devDependencies["docusaurus-plugin-matomo"]'

# Check Docusaurus version for compatibility
cat package.json | jq '.dependencies["@docusaurus/core"] // .devDependencies["@docusaurus/core"]'

Length of output: 225


Script:

#!/bin/bash
# Check package.json in the docs app directory
cat apps/docs/package.json | jq '.dependencies["docusaurus-plugin-matomo"] // .devDependencies["docusaurus-plugin-matomo"]'

# Check Docusaurus version for compatibility
cat apps/docs/package.json | jq '.dependencies["@docusaurus/core"] // .devDependencies["@docusaurus/core"]'

Length of output: 253

apps/docs/docusaurus.config.ts Outdated Show resolved Hide resolved
apps/docs/docusaurus.config.ts Outdated Show resolved Hide resolved
Copy link
Member

@sjschlapbach sjschlapbach left a comment

Choose a reason for hiding this comment

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

LGTM, the reworked use cases definitely have a much more modern appearance now!
We should probably exchange the one image in the performance analytics and potentially check which coderabbit suggestions might make sense to quickly realize.

apps/docs/static/img_v3/la_lecturers_async.png Outdated Show resolved Hide resolved
apps/docs/docusaurus.config.ts Outdated Show resolved Hide resolved
@rschlaefli rschlaefli merged commit 6d8aa25 into v3 Dec 20, 2024
8 of 9 checks passed
@rschlaefli rschlaefli deleted the UseCases2024 branch December 20, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants