fix(js): fixes #4452 action buttons not showing externally while mobile (#4547)

This commit is contained in:
Gabe Kangas
2025-09-14 14:28:57 -07:00
committed by GitHub
parent c12ef0ec57
commit 8568f43310
4 changed files with 33 additions and 13 deletions
+21
View File
@@ -7,3 +7,24 @@ export interface ExternalAction {
icon?: string;
openExternally?: boolean;
}
/**
* Utility functions for working with ExternalAction objects
*/
export namespace ExternalActionUtils {
/**
* Generates a unique key for an external action based on its properties.
* This ensures each action has a unique identifier for React rendering.
*/
export function generateKey(action: ExternalAction): string {
return `${action.title}-${action.url || action.html || 'no-url'}-${action.color || 'no-color'}`;
}
/**
* Finds an action from an array based on a generated key.
* Useful for finding actions in event handlers when only the key is available.
*/
export function findByKey(actions: ExternalAction[], key: string): ExternalAction | undefined {
return actions.find(action => generateKey(action) === key);
}
}