-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added logged email user on the extension #42
Conversation
WalkthroughWalkthroughThe recent updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ContentApp
participant Popup
participant Footer
User->>ContentApp: Opens ContentApp
ContentApp->>Popup: Passes email prop
Popup->>Footer: Passes email prop
Footer->>Footer: Displays email
Poem
TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
apps/mocksi-lite/content/ContentApp.tsx (1)
Line range hint
33-56
: Consider simplifying the conditional rendering logic for better readability and maintainability.- if (!isDialogOpen) return null; - if (state === RecordingState.READY || state === RecordingState.CREATE) { - return ( - <Popup - state={state} - label={recordingLabel(state)} - close={() => setIsDialogOpen(false)} - setState={onChangeState} - email={email} - /> - ); - } - // other conditions + return isDialogOpen ? ( + <Popup + state={state} + label={recordingLabel(state)} + close={() => setIsDialogOpen(false)} + setState={onChangeState} + email={email} + /> + ) : null;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- apps/mocksi-lite/content/ContentApp.tsx (3 hunks)
- apps/mocksi-lite/content/Popup/Footer.tsx (1 hunks)
- apps/mocksi-lite/content/Popup/index.tsx (1 hunks)
- apps/mocksi-lite/content/constants.ts (1 hunks)
- apps/mocksi-lite/content/content.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
- apps/mocksi-lite/content/constants.ts
Additional comments not posted (6)
apps/mocksi-lite/content/Popup/Footer.tsx (2)
3-3
: The addition of theFooter
component aligns well with the PR's objectives.
6-6
: Displaying the email in the UI is a good touch for user awareness.apps/mocksi-lite/content/Popup/index.tsx (2)
15-15
: The addition of thePopup
component and its interface is consistent with the PR's objectives.Also applies to: 18-18
18-18
: Ensure that theVerification successful
The search results indicate that the
Popup/index.tsx
andPopup/Footer.tsx
. Specifically, theFooter
component within thePopup
component.
apps/mocksi-lite/content/Popup/index.tsx
: ThePopup
component.apps/mocksi-lite/content/Popup/Footer.tsx
: TheFooter
component.This confirms that the
Footer
child component within thePopup
component.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `email` prop is being correctly passed to all child components in the Popup component. # Test: Search for the `email` prop usage within child components. Expect: Correct usage of the `email` prop. rg --type typescript $'email'Length of output: 63
Script:
#!/bin/bash # Description: Verify that the `email` prop is being correctly passed to all child components in the Popup component. # Test: Search for the `email` prop usage within TypeScript and TSX files. Expect: Correct usage of the `email` prop. rg --type-add 'ts:*.{ts,tsx}' --type ts 'email'Length of output: 1873
apps/mocksi-lite/content/content.tsx (1)
3-3
: The integration ofSTORAGE_KEY
for fetching theContentApp
component is well-implemented.Also applies to: 23-32
apps/mocksi-lite/content/ContentApp.tsx (1)
14-14
: The addition of theContentApp
component and its usage in various conditions is well-implemented.Also applies to: 33-56
return ( | ||
<div className={"h-[36px] flex items-center justify-end pr-3"}> | ||
<div className={"text-[13px] text-[#5E5E5E] mr-2"}>jana@mocoso.com</div> | ||
<div className={"text-[13px] text-[#5E5E5E] mr-2"}>{email}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider completing the onKeyUp
event handler for accessibility.
- event.key === "Enter" && (() => undefined);
+ if (event.key === "Enter") logout();
Committable suggestion was skipped due to low confidence.
@@ -20,7 +20,16 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { | |||
root.unmount(); | |||
} | |||
root = ReactDOM.createRoot(extensionRoot); | |||
root.render(<ContentApp isOpen={true} sessionCookie={msg.loginToken} />); | |||
chrome.storage.local.get(STORAGE_KEY).then((value) => { | |||
const { email } = JSON.parse(value[STORAGE_KEY] || {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding error handling for JSON parsing to prevent runtime errors.
- const { email } = JSON.parse(value[STORAGE_KEY] || {});
+ let email;
+ try {
+ email = JSON.parse(value[STORAGE_KEY] || {}).email;
+ } catch (e) {
+ console.error('Failed to parse email:', e);
+ }
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.
const { email } = JSON.parse(value[STORAGE_KEY] || {}); | |
let email; | |
try { | |
email = JSON.parse(value[STORAGE_KEY] || {}).email; | |
} catch (e) { | |
console.error('Failed to parse email:', e); | |
} |
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/mocksi-lite/content/Popup/index.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/mocksi-lite/content/Popup/index.tsx
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- apps/mocksi-lite/consts.ts (1 hunks)
- apps/mocksi-lite/content/ContentApp.tsx (3 hunks)
- apps/mocksi-lite/content/Popup/Footer.tsx (1 hunks)
- apps/mocksi-lite/content/Popup/index.tsx (2 hunks)
- apps/mocksi-lite/content/content.tsx (2 hunks)
Files skipped from review due to trivial changes (2)
- apps/mocksi-lite/consts.ts
- apps/mocksi-lite/content/content.tsx
Files skipped from review as they are similar to previous changes (3)
- apps/mocksi-lite/content/ContentApp.tsx
- apps/mocksi-lite/content/Popup/Footer.tsx
- apps/mocksi-lite/content/Popup/index.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apps/mocksi-lite/consts.ts (1 hunks)
- apps/mocksi-lite/content/ContentApp.tsx (3 hunks)
- apps/mocksi-lite/content/content.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
- apps/mocksi-lite/content/content.tsx
Files skipped from review as they are similar to previous changes (2)
- apps/mocksi-lite/consts.ts
- apps/mocksi-lite/content/ContentApp.tsx
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- apps/mocksi-lite/content/ContentApp.tsx (3 hunks)
- apps/mocksi-lite/content/content.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- apps/mocksi-lite/content/ContentApp.tsx
- apps/mocksi-lite/content/content.tsx
This should be merged after https://github.com/Mocksi/nest/pull/10/files
Summary by CodeRabbit
New Features
email
property to theContentApp
andPopup
components, allowing them to receive and utilize email values.STORAGE_KEY
with the value"mocksi-auth"
for consistent key usage across the app.Enhancements
Footer
component to dynamically display the email value.