Skip to content

minor ui fixes, and enhancements of guidelines, reasons - #232

Merged
Vinod-V3 merged 7 commits into
ELEVATE-Project:release-1.0.5from
pinkman7009:fix/mitra-chat-fixes
Jan 18, 2026
Merged

minor ui fixes, and enhancements of guidelines, reasons#232
Vinod-V3 merged 7 commits into
ELEVATE-Project:release-1.0.5from
pinkman7009:fix/mitra-chat-fixes

Conversation

@pinkman7009

@pinkman7009 pinkman7009 commented Jan 18, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

Release Notes

  • New Features

    • Added guidelines with helpful information for objectives and action items
    • Enhanced file sharing with native mobile support and improved notifications
    • FAQ now includes a back button for easier navigation
  • Improvements

    • Updated Terms and Conditions specific to MItra platform
    • Added reasons display showing detailed context for recommended actions
    • New chat option now intelligently disables when appropriate

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This PR expands the AI creation flow with new translation keys for UI placeholders and guidelines, introduces Guidelines and Reasons components for displaying contextual information, updates the Mitra platform's terms reference, enhances file-sharing with mobile Web Share API support, and implements flow-specific session management and new chat creation controls.

Changes

Cohort / File(s) Summary
Translation Expansion
public/locales/en/ai_creation_translation.json, public/locales/en/translation.json
Added common placeholder keys (chatPlaceholder, placeholderProcessing, placeholderListening, back) and guideline keys (selectObjective.guidelines, actionItems.guidelines); introduced mitraTncText for platform-specific Terms and Conditions
New UI Components
src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/Guidelines.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/Reasons.jsx
Introduced Guidelines component with tooltip-based HTML content display; added Reasons component for rendering collapsible action-step reasoning lists
Content Rendering & Guidelines
src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/ActionItems.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/SelectObjective.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/objectives/ObjectivesCard.jsx
Integrated Guidelines and Reasons components into action items and objectives rendering; adjusted Disclaimer wrapping for consistent layout
Flow Selection & State Management
src/pages/ai-creation/pages/shikshalokam-mitra/MainPage.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/InitialSwitch.jsx
Added reactive subscription to initialSwitchChatHistory; modified flow selection logic to fetch new session for LCF while reusing session for other flows; updated Sidebar to disable new chat creation based on chat history; integrated mitraTncText and onBack callback for FAQ
UI Component Updates
src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/ChatBox.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/FAQ.jsx, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/Sidebar.jsx
Updated placeholder translation keys in ChatBox; added back button with navigation callback to FAQ; introduced isNewChatDisabled prop to Sidebar for disabling new chat action
File Sharing & Layout Adjustments
src/pages/ai-creation/utils/file.js, src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/StateMachineDefineChallenge.jsx, src/pages/ai-creation/pages/improvement-plan/index.jsx
Enhanced file sharing with mobile Web Share API support and desktop clipboard copying; added mobile detection logic; switched from alert to showNotification; toggled container height based on define-challenge mode; added Notification component to improvement-plan page

Sequence Diagrams

sequenceDiagram
    participant User
    participant Frontend as File Sharing<br/>(handleShareFile)
    participant API as Device API<br/>(Clipboard/Share)
    participant System as Notification<br/>System

    User->>Frontend: Trigger share action
    Frontend->>Frontend: Detect device type
    
    alt Desktop
        Frontend->>API: Copy URL to clipboard
        API-->>Frontend: Success
        Frontend->>System: Show success notification
        System-->>User: Display confirmation
    else Mobile
        Frontend->>API: Request Web Share API
        alt Share supported
            API->>API: Create file blob
            API-->>Frontend: File ready
            Frontend->>API: Share file
            API-->>Frontend: Share complete
            Frontend->>System: Show success notification
            System-->>User: Display confirmation
        else Share unsupported
            Frontend->>API: Copy URL to clipboard
            API-->>Frontend: Success
            Frontend->>System: Show fallback notification
            System-->>User: Display confirmation
        end
    end
Loading
sequenceDiagram
    participant WS as WebSocket<br/>Message
    participant InitialSwitch
    participant SessionStore
    participant FlowCallback

    WS->>InitialSwitch: Receive flow validation
    InitialSwitch->>InitialSwitch: Check flow type

    alt Flow is LCF
        InitialSwitch->>SessionStore: Fetch new session ID
        SessionStore-->>InitialSwitch: New session ID
        InitialSwitch->>SessionStore: Update with new session
        InitialSwitch->>InitialSwitch: Set flow type to LCF
        InitialSwitch->>FlowCallback: Invoke callback
        FlowCallback-->>InitialSwitch: Complete
    else Other flows (LFA, FREE_FLOW, MIP)
        InitialSwitch->>InitialSwitch: Set flow type (lowercased)
        InitialSwitch->>FlowCallback: Invoke callback directly
        FlowCallback-->>InitialSwitch: Complete
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • Vinod-V3

🐰 New Guidelines bloom, Reasons shine bright,
Mobile files now share with delight,
Sessions fresh for LCF's flight,
Chat history guards the night,
A better user experience takes flight!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'minor ui fixes, and enhancements of guidelines, reasons' accurately captures the main changes: UI improvements (ChatBox placeholder updates, Sidebar disabled state, Container height toggles), and the introduction of Guidelines and Reasons components throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pinkman7009

Copy link
Copy Markdown
Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jan 18, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@public/locales/en/ai_creation_translation.json`:
- Around line 12-16: The new locale file ai_creation_translation.json
(containing keys like "download", "chatPlaceholder", "placeholderProcessing",
"placeholderListening", "back" and the other keys added at lines noted) is
present only in en; add an identical ai_creation_translation.json to the hi, kn,
and te locale directories containing proper translations for all keys (or at
minimum the same key structure with translated values) so those locales do not
fall back to raw keys; ensure filenames match exactly and include all keys
present in the en file (including those near lines 76-77 and 92-93).

In
`@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/Guidelines.jsx`:
- Around line 1-27: The <Guidelines> component renders a <p> with both children
and dangerouslySetInnerHTML which causes lint warnings; remove the empty child
by making the <p> that uses dangerouslySetInnerHTML self-closing (i.e., do not
include inner children) and keep the existing __html: text usage, and optionally
add a comment or TODO to sanitize with DOMPurify later if the HTML becomes
untrusted.

In
`@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/InitialSwitch.jsx`:
- Around line 147-157: The current branch for LCF calls getNewSessionID()
without error handling so if it rejects the flow type never gets set; modify the
LCF branch around compareFlowTypesEquality(...) to await or then/catch
getNewSessionID(), and in the catch ensure you log the error and still call
useAICreationSessionStore.getState().setSelectedFlowType(validation?.toLowerCase())
and onFlowTypeSelectedRef.current?.(validation?.toLowerCase()) (leaving session
unchanged on failure); when getNewSessionID() succeeds, call
useAICreationSessionStore.getState().setSession(newSession) then
setSelectedFlowType and invoke onFlowTypeSelectedRef as today.

In
`@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/StateMachineDefineChallenge.jsx`:
- Around line 612-613: The ChatWindow component requires the
isDefineChallengeSection prop but it isn't being passed from
StateMachineDefineChallenge; update the ChatWindow JSX within
StateMachineDefineChallenge (the ChatWindow(...) element) to include
isDefineChallengeSection={isDefineChallengeSection} so the ChatWindow component
receives and can use that variable for its conditional logic.
🧹 Nitpick comments (5)
src/pages/ai-creation/pages/improvement-plan/index.jsx (1)

10-17: Potential stale data: items captured once at mount.

items is assigned via getState().getMedia() outside the useEffect, so it captures the value at component mount time. If the store updates after mount, items won't reflect those changes, and the useEffect won't re-run since items isn't in the dependency array.

Consider either:

  1. Moving the store access inside the effect, or
  2. Using the reactive selector pattern like chatHistory in other components
Suggested fix
 const ImprovementPlan = () => {
   const [media, setMedia] = useState([]);
   const { projectId } = useParams();
-  const items = useAICreationSessionStore.getState().getMedia()
+  const items = useAICreationSessionStore(state => state.getMedia?.() || []);

   useEffect(() => {
     const mediaItems = items || [];
     setMedia(mediaItems);
-  }, [projectId]);
+  }, [projectId, items]);
src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/Reasons.jsx (1)

21-21: Consider i18n for fallback text.

The hardcoded "No reason provided" string should ideally use a translation key for consistency with the rest of the app's i18n approach.

Suggested change
+import { useTranslation } from "react-i18next";
+
 const Reasons = ({ reasonList = [], customClassNames = {} }) => {
+  const { t } = useTranslation("ai_creation_translation");
   // ...
   <li key={index} className="text-gray-700 text-sm">
-    {item?.reason || "No reason provided"}
+    {item?.reason || t("noReasonProvided")}
   </li>
public/locales/en/ai_creation_translation.json (1)

76-77: Render rich‑text translations safely.

These new guideline strings embed HTML (<strong>, <br/>). Please verify they’re rendered via Trans/component mapping (or sanitized) so users don’t see raw tags and to keep XSS risk controlled if translations ever move to a CMS.

Also applies to: 92-93

src/pages/ai-creation/utils/file.js (2)

2-2: Extract a reusable toast helper to avoid duplication.

The same showNotification payload appears three times; a small helper will reduce drift and make future tweaks safer.

♻️ Proposed refactor
+const notifyUrlCopied = (fullFileName) =>
+    showNotification({
+        message: `${fullFileName} URL copied to clipboard!`,
+        type: "success",
+        options: {
+            autoClose: 3000,
+            position: "top-center",
+            style: { fontWeight: "bold", color: "#1D1616" },
+        },
+    });
@@
-            showNotification({
-                message: `${fullFileName} URL copied to clipboard!`,
-                type: "success",
-                options: { 
-                    autoClose: 3000,
-                    position: "top-center",
-                    style: { fontWeight: "bold", color: "#1D1616" }
-                }
-            });
+            notifyUrlCopied(fullFileName);
@@
-            showNotification({
-                message: `${fullFileName} URL copied to clipboard!`,
-                type: "success",
-                options: { 
-                    autoClose: 3000,
-                    position: "top-center",
-                    style: { fontWeight: "bold", color: "#1D1616" }
-                }
-            });
+            notifyUrlCopied(fullFileName);
@@
-                showNotification({
-                    message: `${fullFileName} URL copied to clipboard!`,
-                    type: "success",
-                    options: { 
-                        autoClose: 3000,
-                        position: "top-center",
-                        style: { fontWeight: "bold", color: "#1D1616" }
-                    }
-                });
+                notifyUrlCopied(fullFileName);

Also applies to: 20-38, 76-84, 93-101


8-10: Replace UA sniffing gate with capability-first detection.

UA sniffing to gate the Web Share vs. clipboard choice is fragile—iPadOS, UA-reduced browsers, and other edge cases can misclassify. Your code already includes proper capability checks (navigator.share and navigator.canShare()); instead of trusting the user-agent, try Web Share directly and fall back gracefully:

const handleShareFile = async (/* params */) => {
    const fullFileName = getFileName(fileName, fileExtension);
    
    // Try Web Share if supported
    if (navigator.share && navigator.canShare?.({ files: [fileBlob] })) {
        // Web Share logic
    } else {
        // Clipboard fallback (works on all platforms)
    }
};

This eliminates the UA dependency and lets the browser's own APIs decide, which is more reliable across all devices and browsers.

Comment thread public/locales/en/ai_creation_translation.json
@Vinod-V3
Vinod-V3 merged commit a4b14c5 into ELEVATE-Project:release-1.0.5 Jan 18, 2026
1 check passed
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