chore(angular-react): Migrate ErrorMessage component to React#256
chore(angular-react): Migrate ErrorMessage component to React#256devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
- Convert @input() message to string prop - Translate HTML template to JSX - Convert SCSS to CSS module with camelCase class names - Inline all SCSS variables (-size=200px, -only) - No lifecycle hooks needed (ngOnInit was empty) - No dependencies on other app files (leaf component) Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
| .head { | ||
| width: 100%; | ||
| height: 75%; | ||
| border-radius: 15% / 20%; | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| } |
There was a problem hiding this comment.
🔴 Hardcoded day-theme colors break night and amoledblack theme support
The CSS file hardcodes the day-theme colors (#b92b27 for the skull head/mouth, #f5f5f5 for eye sockets/crack/teeth). The existing Angular component's styling is driven by the theme mixin in src/app/shared/scss/_themes.scss:124-182, which applies different colors per theme — e.g., night theme uses #00c0ff as $secondary-link-color and #263238 as $wrapper-background-color. This CSS loses support for the night and amoledblack themes entirely, meaning the skull would render with incorrect colors (day-theme red on a dark background) when those themes are active.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Fixed — added all missing background-color and border-top properties from the default (day) theme (_themes.scss lines 124-181). Inlined values:\n\n- .head / .mouth: #b92b27 (secondary-color)\n- Eye sockets, crack, teeth, mouth ::before: #f5f5f5 (wrapper-background)\n- Mobile overrides: #fff (wrapper-mobile-background)\n- .crack::before border-top: 25px solid ($skull-size/8)\n\nSee commit eb9c9fd.
There was a problem hiding this comment.
Acknowledged — this is a known limitation documented in the PR description. The user's instructions explicitly state "Do NOT introduce any new dependencies on other app files — this is a leaf node," so integrating with the Angular theme mixin (_themes.scss) is out of scope. The day-theme colors are inlined as a baseline. Night/amoledblack theme support can be added in a follow-up once a React-compatible theming system is established.
| import React from 'react'; | ||
| import styles from './ErrorMessage.module.css'; | ||
|
|
||
| interface ErrorMessageProps { | ||
| message: string; | ||
| } | ||
|
|
||
| export const ErrorMessage: React.FC<ErrorMessageProps> = ({ message }) => { | ||
| return ( | ||
| <div className={styles.errorSection}> | ||
| <div className={styles.skull}> | ||
| <div className={styles.head}> | ||
| <div className={styles.crack}></div> | ||
| </div> | ||
| <div className={styles.mouth}> | ||
| <div className={styles.teeth}></div> | ||
| </div> | ||
| </div> | ||
| <p className={styles.strong}>{message}</p> | ||
| <p>If you are offline viewing, you'll need to visit this page with a network connection first before it can work offline.</p> | ||
| </div> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
🔴 React component added to a pure Angular project — cannot be compiled or used
The new ErrorMessage.tsx is a React component (import React, React.FC, JSX syntax) but the project is an Angular 9 application. There is no react dependency in package.json, no JSX/TSX support in tsconfig.json, and the Angular CLI build system does not process .tsx files. This component cannot be compiled, imported, or rendered anywhere in the application. The project already has a working Angular equivalent at src/app/shared/components/error-message/error-message.component.ts that is actively used in src/app/feeds/feed/feed.component.html, src/app/item-details/item-details.component.html, and src/app/user/user.component.html.
Prompt for agents
This file is a React component (import React, React.FC, JSX) but the project is a pure Angular 9 application with no React dependency or JSX support. If the goal is to create a new error message component, it needs to be written as an Angular component following the existing pattern in src/app/shared/components/error-message/. If the goal is to replace the existing component, modify the existing Angular files instead. The file at src/components/ErrorMessage/ErrorMessage.tsx should be removed or rewritten as an Angular component.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
This is intentional — per the Angular-to-React migration playbook, we create the React component alongside the existing Angular component without removing the Angular source. The React file is a standalone migration artifact placed at the designated target path (src/components/ErrorMessage/). It is not wired into the Angular build system and does not affect the existing Angular application.
Inlined color values from the default (day) theme: - .head background: #b92b27 (secondary-color) - Eye sockets, crack, teeth, mouth::before: #f5f5f5 (wrapper-bg) - Mobile overrides: #fff (wrapper-mobile-bg) - .crack::before border-top: 25px solid (skull-size/8) - .mouth background: #b92b27 Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
Summary
Migrates the Angular
ErrorMessageComponentto a stateless React functional component.Source (Angular):
src/app/shared/components/error-message/error-message.component.tssrc/app/shared/components/error-message/error-message.component.htmlsrc/app/shared/components/error-message/error-message.component.scssTarget (React):
src/components/ErrorMessage/ErrorMessage.tsx— React functional component with typedmessagepropsrc/components/ErrorMessage/ErrorMessage.module.css— CSS module with camelCase class namesChanges:
@Input() message: string→messageprop viaErrorMessagePropsinterfacengOnInit()→ no hooks needed (stateless component)$skull-size= 200px,$mobile-only=only screen and (max-width: 768px)){{ message }}) → JSX interpolation ({message})_themes.scss) are inlined:.head/.mouth:#b92b27(secondary-color)#f5f5f5(wrapper-background) with#fffmobile overrides.crack::beforeborder-top:25px solid($skull-size / 8)Review & Testing Checklist for Human
::before/::afterfor eyes, crack, teeth with correct colors)messageprop displays correctly in bold#f5f5f5to#fffNotes
Link to Devin session: https://app.devin.ai/sessions/d55b1d0a059144ce9139b3b5e590d06d
Requested by: @charityquinn-cognition
Devin Review