Skip to content

Commit

Permalink
subs to the quick action report and policy onyx
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Apr 26, 2024
1 parent 42d4ed7 commit 05fd715
Showing 1 changed file with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ type FloatingActionButtonAndPopoverOnyxProps = {
/** Information on the last taken action to display as Quick Action */
quickAction: OnyxEntry<OnyxTypes.QuickAction>;

/** The report data of the quick action */
quickActionReport: OnyxEntry<OnyxTypes.Report>;

/** The policy data of the quick action */
quickActionPolicy: OnyxEntry<OnyxTypes.Policy>;

/** The current session */
session: OnyxEntry<OnyxTypes.Session>;

Expand Down Expand Up @@ -141,7 +147,18 @@ const getQuickActionTitle = (action: QuickActionName): TranslationPaths => {
* FAB that can open or close the menu.
*/
function FloatingActionButtonAndPopover(
{onHideCreateMenu, onShowCreateMenu, isLoading = false, allPolicies, quickAction, session, personalDetails, hasSeenTrackTraining}: FloatingActionButtonAndPopoverProps,
{
onHideCreateMenu,
onShowCreateMenu,
isLoading = false,
allPolicies,
quickAction,
quickActionReport,
quickActionPolicy,
session,
personalDetails,
hasSeenTrackTraining,
}: FloatingActionButtonAndPopoverProps,
ref: ForwardedRef<FloatingActionButtonAndPopoverRef>,
) {
const styles = useThemeStyles();
Expand All @@ -154,10 +171,6 @@ function FloatingActionButtonAndPopover(
const prevIsFocused = usePrevious(isFocused);
const {isOffline} = useNetwork();

const quickActionReport: OnyxEntry<OnyxTypes.Report> = useMemo(() => (quickAction ? ReportUtils.getReport(quickAction.chatReportID) : null), [quickAction]);

const quickActionPolicy = allPolicies ? allPolicies[`${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`] : undefined;

const quickActionAvatars = useMemo(() => {
if (quickActionReport) {
const avatars = ReportUtils.getIcons(quickActionReport, personalDetails);
Expand Down Expand Up @@ -418,6 +431,12 @@ export default withOnyx<FloatingActionButtonAndPopoverProps & RefAttributes<Floa
quickAction: {
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
},
quickActionReport: {
key: ({quickAction}) => `${ONYXKEYS.COLLECTION.REPORT}${quickAction?.chatReportID}`,
},
quickActionPolicy: {
key: ({quickActionReport}) => `${ONYXKEYS.COLLECTION.POLICY}${quickActionReport?.policyID}`,
},
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
Expand Down

0 comments on commit 05fd715

Please sign in to comment.