mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-14 16:35:01 -05:00
improvement(execution-snapshot): enhance workflow preview in logs and deploy modal (#2742)
* added larger live deployment preview * edited subblock UI * removed comments * removed carrot * updated styling to match existing subblocks * enriched workflow preview * fix connetion in log preview * cleanup * ack PR comments * more PR comments * more * cleanup * use reactquery cache in deploy modal * ack comments * ack PR comment --------- Co-authored-by: aadamgough <adam@sim.ai>
This commit is contained in:
@@ -7,6 +7,19 @@ const APP_COLORS = [
|
||||
{ from: '#F59E0B', to: '#F97316' }, // amber to orange
|
||||
]
|
||||
|
||||
/**
|
||||
* User color palette matching terminal.tsx RUN_ID_COLORS
|
||||
* These colors are used consistently across cursors, avatars, and terminal run IDs
|
||||
*/
|
||||
export const USER_COLORS = [
|
||||
'#4ADE80', // Green
|
||||
'#F472B6', // Pink
|
||||
'#60C5FF', // Blue
|
||||
'#FF8533', // Orange
|
||||
'#C084FC', // Purple
|
||||
'#FCD34D', // Yellow
|
||||
] as const
|
||||
|
||||
interface PresenceColorPalette {
|
||||
gradient: string
|
||||
accentColor: string
|
||||
@@ -80,3 +93,35 @@ export function getPresenceColors(
|
||||
baseColor: colorPair.from,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a consistent color for a user based on their ID.
|
||||
* The same user will always get the same color across cursors, avatars, and terminal.
|
||||
*
|
||||
* @param userId - The unique user identifier
|
||||
* @returns A hex color string
|
||||
*/
|
||||
export function getUserColor(userId: string): string {
|
||||
const hash = hashIdentifier(userId)
|
||||
return USER_COLORS[hash % USER_COLORS.length]
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a stable mapping of user IDs to color indices for a list of users.
|
||||
* Useful when you need to maintain consistent color assignments across renders.
|
||||
*
|
||||
* @param userIds - Array of user IDs to map
|
||||
* @returns Map of user ID to color index
|
||||
*/
|
||||
export function createUserColorMap(userIds: string[]): Map<string, number> {
|
||||
const colorMap = new Map<string, number>()
|
||||
let colorIndex = 0
|
||||
|
||||
for (const userId of userIds) {
|
||||
if (!colorMap.has(userId)) {
|
||||
colorMap.set(userId, colorIndex++)
|
||||
}
|
||||
}
|
||||
|
||||
return colorMap
|
||||
}
|
||||
Reference in New Issue
Block a user