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: add message to display list being empty #300

Merged
merged 10 commits into from
Jan 13, 2025
Merged

feat: add message to display list being empty #300

merged 10 commits into from
Jan 13, 2025

Conversation

RohitR311
Copy link
Collaborator

@RohitR311 RohitR311 commented Dec 28, 2024

If in Capture List action all data fields are discarded display a message in the right side panel stating no list items.

Summary by CodeRabbit

  • New Features

    • Added localized "list empty" messages for multiple languages (German, English, Spanish, Japanese, Chinese).
    • Implemented handling for empty list states in the right side panel to improve user feedback.
  • User Experience

    • Enhanced user interface with clear notifications when no fields are selected in a list.

Copy link

coderabbitai bot commented Dec 28, 2024

Warning

Rate limit exceeded

@amhsirak has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 42 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7c0dbd3 and a9380a8.

📒 Files selected for processing (5)
  • public/locales/de.json (1 hunks)
  • public/locales/en.json (1 hunks)
  • public/locales/es.json (1 hunks)
  • public/locales/ja.json (1 hunks)
  • public/locales/zh.json (1 hunks)

Walkthrough

The pull request adds a new localization feature across multiple language files (German, English, Spanish, Japanese, and Chinese) by introducing a "list empty" message in the right_panel.messages section. This message informs users when no fields are selected within a list. Additionally, the RightSidePanel.tsx component has been updated to render this new message when the list is empty, enhancing user feedback in the interface.

Changes

File Change Summary
public/locales/de.json Added German "list empty" message: "Liste ausgewählt. Bitte wählen Sie Felder innerhalb der Liste aus."
public/locales/en.json Added English "list empty" message: "List selected. Please select fields inside the list."
public/locales/es.json Added Spanish "list empty" message: "Lista seleccionada. Seleccione los campos dentro de la lista."
public/locales/ja.json Added Japanese "list empty" message: "リストが選択されました。リスト内のフィールドを選択してください。"
public/locales/zh.json Added Chinese "list empty" message: "已选择列表。请选择列表内的字段。"
src/components/recorder/RightSidePanel.tsx Updated rendering logic to display "list empty" message when no fields are selected

Possibly related PRs

Poem

🐰 A Rabbit's Localization Delight 🌍
Empty lists no longer bare,
Messages now bloom with care,
In languages from far and near,
Our users' confusion we'll clear!
Multilingual magic, oh so bright! 🌈


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

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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4b12139 and 6665a4e.

📒 Files selected for processing (6)
  • public/locales/de.json (1 hunks)
  • public/locales/en.json (1 hunks)
  • public/locales/es.json (1 hunks)
  • public/locales/ja.json (1 hunks)
  • public/locales/zh.json (1 hunks)
  • src/components/organisms/RightSidePanel.tsx (1 hunks)
🔇 Additional comments (7)
src/components/organisms/RightSidePanel.tsx (1)

548-550: Consider adding a null/undefined check for step.fields.
If there's any scenario where step.fields might be undefined or null, Object.entries(step.fields) will throw an error. If you're certain step.fields is always defined at this point, you can ignore this. Otherwise, consider optional chaining or a defensive check.

public/locales/zh.json (1)

194-195: Translation addition looks good.
These new keys accurately convey an empty list message in a concise manner, consistent with existing translations.

public/locales/ja.json (1)

194-195: New “list_empty” message is well-formed.
The addition is grammatically correct and maintains consistency with the structure of other keys.

public/locales/en.json (1)

194-195: Localization string addition is appropriate.
The new message aligns with existing wording, improving clarity when the list contains no fields.

public/locales/es.json (1)

194-195: LGTM! Spanish translation is accurate and well-formatted.

The translation "La lista está vacía. No se han seleccionado campos." is grammatically correct and effectively conveys the empty list state to Spanish-speaking users.

public/locales/de.json (2)

193-194: LGTM! German translation is accurate and well-formatted.

The translation "Liste ist leer. Es wurden keine Felder ausgewählt." is grammatically correct and effectively conveys the empty list state to German-speaking users.


193-195: Verify translations in other language files.

The AI summary mentions translations in English, Japanese, and Chinese files. Let's verify they exist and are consistent.

✅ Verification successful

Translations are consistent across all language files

The verification shows that the "list_empty" message exists in all language files (en, ja, zh, de) with appropriate translations:

  • English: "List is empty. No fields have been selected."
  • Japanese: "リストが空です。フィールドが選択されていません。"
  • Chinese: "列表为空。尚未选择任何字段。"
  • German: "Liste ist leer. Es wurden keine Felder ausgewählt."

Each translation maintains the same meaning while being culturally appropriate for its target language.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the "list_empty" message exists in all language files
# and display their translations for comparison.

echo "Checking translations in all language files..."
for lang in en ja zh; do
  if [ -f "public/locales/${lang}.json" ]; then
    echo "=== ${lang}.json ==="
    # Extract the list_empty message using jq
    jq -r '.right_panel.messages.list_empty' "public/locales/${lang}.json"
  else
    echo "Warning: public/locales/${lang}.json not found"
  fi
done

Length of output: 679

Comment on lines 551 to 604
<>
<Typography>{t('right_panel.messages.list_selected')}</Typography>
{Object.entries(step.fields).map(([key, field]) => (
<Box key={key}>
<TextField
label={t('right_panel.fields.field_label')}
value={field.label || ''}
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedListTextFields[field.id]?.[key],
startAdornment: (
<InputAdornment position="start">
<EditIcon />
</InputAdornment>
)
}}
/>
<TextField
label={t('right_panel.fields.field_data')}
value={field.data || ''}
fullWidth
margin="normal"
InputProps={{
readOnly: true,
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
)
}}
/>
{!confirmedListTextFields[step.id]?.[key] && (
<Box display="flex" justifyContent="space-between" gap={2}>
<Button
variant="contained"
onClick={() => handleListTextFieldConfirm(step.id, key)}
disabled={!field.label?.trim()}
>
{t('right_panel.buttons.confirm')}
</Button>
<Button
variant="contained"
color="error"
onClick={() => handleListTextFieldDiscard(step.id, key)}
>
{t('right_panel.buttons.discard')}
</Button>
</Box>
)}
</Box>
))}
</>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix mismatched indices in readOnly condition for list fields.
Currently, the code uses confirmedListTextFields[field.id]?.[key] to determine if the field is read-only. However, the confirm/discard logic uses handleListTextFieldConfirm(step.id, key) and handleListTextFieldDiscard(step.id, key), storing confirmation state in confirmedListTextFields[step.id][key]. This mismatch prevents the field from toggling read-only properly.

Below is a proposed fix for the relevant read-only line, switching to step.id so it matches the stored structure:

-                        readOnly: confirmedListTextFields[field.id]?.[key],
+                        readOnly: confirmedListTextFields[step.id]?.[key],
📝 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
<>
<Typography>{t('right_panel.messages.list_selected')}</Typography>
{Object.entries(step.fields).map(([key, field]) => (
<Box key={key}>
<TextField
label={t('right_panel.fields.field_label')}
value={field.label || ''}
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedListTextFields[field.id]?.[key],
startAdornment: (
<InputAdornment position="start">
<EditIcon />
</InputAdornment>
)
}}
/>
<TextField
label={t('right_panel.fields.field_data')}
value={field.data || ''}
fullWidth
margin="normal"
InputProps={{
readOnly: true,
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
)
}}
/>
{!confirmedListTextFields[step.id]?.[key] && (
<Box display="flex" justifyContent="space-between" gap={2}>
<Button
variant="contained"
onClick={() => handleListTextFieldConfirm(step.id, key)}
disabled={!field.label?.trim()}
>
{t('right_panel.buttons.confirm')}
</Button>
<Button
variant="contained"
color="error"
onClick={() => handleListTextFieldDiscard(step.id, key)}
>
{t('right_panel.buttons.discard')}
</Button>
</Box>
)}
</Box>
))}
</>
<>
<Typography>{t('right_panel.messages.list_selected')}</Typography>
{Object.entries(step.fields).map(([key, field]) => (
<Box key={key}>
<TextField
label={t('right_panel.fields.field_label')}
value={field.label || ''}
onChange={(e) => handleTextLabelChange(field.id, e.target.value, step.id, key)}
fullWidth
margin="normal"
InputProps={{
readOnly: confirmedListTextFields[step.id]?.[key],
startAdornment: (
<InputAdornment position="start">
<EditIcon />
</InputAdornment>
)
}}
/>
<TextField
label={t('right_panel.fields.field_data')}
value={field.data || ''}
fullWidth
margin="normal"
InputProps={{
readOnly: true,
startAdornment: (
<InputAdornment position="start">
<TextFieldsIcon />
</InputAdornment>
)
}}
/>
{!confirmedListTextFields[step.id]?.[key] && (
<Box display="flex" justifyContent="space-between" gap={2}>
<Button
variant="contained"
onClick={() => handleListTextFieldConfirm(step.id, key)}
disabled={!field.label?.trim()}
>
{t('right_panel.buttons.confirm')}
</Button>
<Button
variant="contained"
color="error"
onClick={() => handleListTextFieldDiscard(step.id, key)}
>
{t('right_panel.buttons.discard')}
</Button>
</Box>
)}
</Box>
))}
</>

@amhsirak amhsirak added the Type: Enhancement Improvements to existing features label Dec 28, 2024
Copy link
Member

@amhsirak amhsirak left a comment

Choose a reason for hiding this comment

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

@RohitR311 resolve merge conflicts

@RohitR311 RohitR311 requested a review from amhsirak January 8, 2025 06:20
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: 0

🧹 Nitpick comments (1)
src/components/recorder/RightSidePanel.tsx (1)

750-752: LGTM! Consider enhancing the empty state UI.

The empty state message implementation is clean and well-integrated with the translation system.

Consider enhancing the empty state with a visual indicator (like an icon) and possibly a call-to-action to guide users on how to add fields to the list. Example:

-<Typography>{t('right_panel.messages.list_empty')}</Typography>
+<Box display="flex" flexDirection="column" alignItems="center" gap={2}>
+  <ListIcon sx={{ fontSize: 48, color: 'text.secondary' }} />
+  <Typography>{t('right_panel.messages.list_empty')}</Typography>
+  <Typography variant="body2" color="text.secondary">
+    {t('right_panel.messages.list_empty_help')}
+  </Typography>
+</Box>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc2bb5 and 7c0dbd3.

📒 Files selected for processing (1)
  • src/components/recorder/RightSidePanel.tsx (1 hunks)

@amhsirak amhsirak merged commit 20dc987 into develop Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improvements to existing features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants