You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All the changes are made in TeamEnginesTable.tsx
Changed some texts in the modal to match figma.
Fixed styling of the images
Styling of the selected projects is off, see the Figma but the spacing is off and it should also indicate what kind of engine it is Added Images for Engines
Added type of engines
All other changes are mentioned here.
All the changes are made in TeamEnginesTable.tsx
Changed some texts in the modal to match figma.
Fixed styling of the images
Styling of the selected projects is off, see the Figma but the spacing is off and it should also indicate what kind of engine it is Added Images for Engines
Added type of engines
All other changes are mentioned here.
How to Test
Go to team permissions page
Select any team card
Click on Add Engines
Modal will open where we have all the changes
PR Type
Enhancement
Description
Cleaned up imports and reorder modules
Added random project images mapping logic
Restyled Add Engines modal UI components
Refactored state hooks with TypeScript types
Diagram Walkthrough
flowchart LR
A["TeamEnginesTable"] --> B["StyledModal (Add Engines)"]
B --> C["getRandomImageForProject()"]
C --> D["Engine Avatar List"]
D --> E["Permissions Selection"]
E --> F["submitNonGroupEngines()"]
The getRandomImageForProject hook uses projectImageMap but never resets it when engines change or modal closes, potentially causing stale image associations or memory bloat.
const[projectImageMap,setProjectImageMap]=useState<Record<string,string>>({});/** * @name getEngines * @desc Gets all engines without credentials */constgetEngines=async(reset: boolean)=>{if(isLoading){return;}setIsLoading(true);try{letresponse;// possibly add more db table columns / keys here to get id type for display under engines// eslint-disable-next-line prefer-constresponse=awaitmonolithStore.getUnassignedTeamEngines(groupId,groupType,AUTOCOMPLETE_LIMIT,offset,searchEngineInput,);// ignore if there is no responseif(response){letrequests=reset ? [] : nonCredentialedEngines;constengines=response.map((val: Engine)=>{return{
...val,color: colors[Math.floor(Math.random()*colors.length)],};});requests=requests.concat(engines);setNonCredentialedEngines(requests);setCanCollect(engines.length===AUTOCOMPLETE_LIMIT);setIsLoading(false);setSearchLoading(false);}}catch(e){notification.add({color: "error",message: String(e),});setIsLoading(false);setSearchLoading(false);}};constgetRandomImageForProject=useCallback((projectId: string)=>{if(projectImageMap[projectId]){returnprojectImageMap[projectId];}constrandomIndex=Math.floor(Math.random()*projectImages.length,);constnewImage=projectImages[randomIndex];// Only update state if we don't have an image for this projectif(!projectImageMap[projectId]){setProjectImageMap((prev)=>({
...prev,[projectId]: newImage,}));}returnnewImage;},[projectImageMap],);
The nearBottom calculation subtracts 25 before comparing to clientHeight, which may misdetect bottom-of-list and repeatedly trigger fetches, impacting performance.
The useEffect fetching team engines references monolithStore.getTeamEngines but omits monolithStore itself in its dependency array, risking stale calls or missed updates.
Include a normalized engineid field when mapping unassigned engines so that UI references to engine.engineid work correctly. Map engineid from the returned engine_id. This ensures the table keys and selection logic function as intended.
Why: Adding engineid: val.engine_id ensures the mapped objects always include the correct identifier, preventing missing keys and fixing table row selection logic that relies on engineid.
Medium
General
Use unique engine IDs for images
Use the unique engine_id rather than engine_name when fetching a random image to avoid collisions if two engines share the same name. Passing engine.engine_id ensures each engine consistently maps to its own image.
Why: Switching to engine_id guarantees a unique key for getRandomImageForProject, avoiding collisions when two engines share the same name and improving consistency in image mapping.
Refined styling and layout for the Add Engines modal, including updated text and image spacing.
to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR has changes for styling Add Engines Modal
Changes Made
All the changes are made in TeamEnginesTable.tsx
Changed some texts in the modal to match figma.
Fixed styling of the images
Styling of the selected projects is off, see the Figma but the spacing is off and it should also indicate what kind of engine it is Added Images for Engines
Added type of engines
All other changes are mentioned here.
How to Test