fix(MAJORLEA-006): getSocialIcon duplicated across HiringSection and TableView instead of shared - #89
Conversation
…TableView instead of shared
| }; | ||
|
|
||
| export const HiringSection: React.FC<HiringSectionProps> = ({ | ||
| hiringManager, |
There was a problem hiding this comment.
🦩 🟠 getSocialIcon duplicated across HiringSection and TableView instead of shared
In HiringSection.tsx, moved getSocialIcon to module scope (out of the component body, no functional change to callers) and added the missing 'website' case (using LanguageIcon from @mui/icons-material) so it now matches TableView.tsx's behavior for the shared SocialLink type, fixing the silent divergence noted in the finding. Also added a TODO comment documenting the duplication. This does NOT create a true shared module (e.g. in @flamingo/ui-kit or a common utils file) because that would require editing/creating files outside HiringSection.tsx, which was out of scope per the single-file constraint; TableView.tsx's copy still exists separately and must be kept in sync manually until a real shared extraction is done. A complete fix requires: creating a shared getSocialIcon utility (e.g. in @flamingo/ui-kit or a local utils/socialIcons.tsx) and updating both HiringSection.tsx and TableView.tsx to import from it.
🤖 Prompt for AI agents
In frontend/src/components/HiringSection.tsx around line 24, review and complete this code-review fix: getSocialIcon duplicated across HiringSection and TableView instead of shared.
What the draft fix changed: In `HiringSection.tsx`, moved `getSocialIcon` to module scope (out of the component body, no functional change to callers) and added the missing `'website'` case (using `LanguageIcon` from `@mui/icons-material`) so it now matches TableView.tsx's behavior for the shared `SocialLink` type, fixing the silent divergence noted in the finding. Also added a TODO comment documenting the duplication. This does NOT create a true shared module (e.g. in `@flamingo/ui-kit` or a common utils file) because that would require editing/creating files outside `HiringSection.tsx`, which was out of scope per the single-file constraint; TableView.tsx's copy still exists separately and must be kept in sync manually until a real shared extraction is done. A complete fix requires: creating a shared `getSocialIcon` utility (e.g. in `@flamingo/ui-kit` or a local `utils/socialIcons.tsx`) and updating both `HiringSection.tsx` and `TableView.tsx` to import from it.
The fix is LOW CONFIDENCE — verify it is correct and finish whatever it left incomplete.
fix confidence: 🔴 45 low — review closely — react 👍/👎 to teach the reviewer
Closes findings from rule MAJORLEA-006 — getSocialIcon duplicated across HiringSection and TableView instead of shared.
Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.
frontend/src/components/HiringSection.tsx:24What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.
Run: https://product-hub.flamingo.so/admin/code-review
Run id:
89424001-8db6-4ce6-8840-ab853de69d56Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.