Files
discord-decomp/modules/quests/native/QuestDock/QuestDockDragHandle.tsx
T
2026-11-01 12:12:55 +02:00

129 lines
6.5 KiB
TypeScript

// Metro module 14219 (f14220).
import { memo, useContext } from "react";
import { StyleSheet } from "react-native";
import { QuestDockMode } from "../../QuestConstants";
import { QUEST_DOCK_COLLAPSED_MAX_WIDTH, QUEST_DOCK_MODE_CHANGE_PHYSICS } from "./QuestDockConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import QuestDockContext from "./QuestDockContext";
import { QuestDockGestureContext } from "./QuestDockGestureContext";
import { useYouBarHorizontalMargin } from "../../../main_tabs_v2/native/you_bar/hooks/useYouBarMargins";
import { useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { useMobileVisualRefreshConfig } from "../../../themes/experiments/MobileVisualRefreshExperiment";
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
import ReanimatedNativeView from "../../../core/native/ReanimatedNativeView";
import { dimensionsLayoutTransition } from "./QuestDockUtils";
import { ActionSheetHeaderBar } from "../../../../design/components/Sheet/native/ActionSheetHeaderBar.native";
import { intl, t } from "../../../../intl/index.native";
let getDragHandleOffsetLeft, __initData, __initData2, __initData3, __initData4;
const useStyles = createStyles({
dragHandleWrapper: {
...StyleSheet.absoluteFillObject,
bottom: void 0,
right: void 0,
zIndex: 4
},
dragHandleOverlay: {
...StyleSheet.absoluteFillObject,
bottom: void 0
}
});
const getDragHandleOffsetLeft2 = function getDragHandleOffsetLeft(a0, a1) {
return a0 !== QuestDockMode.EXPANDED ? -1 * a1 : 0;
};
getDragHandleOffsetLeft2.__closure = {
QuestDockMode
};
getDragHandleOffsetLeft2.__workletHash = 4145264969027;
getDragHandleOffsetLeft2.__initData = {
code: "function getDragHandleOffsetLeft_QuestDockDragHandleTsx1(activeQuestDockMode,horizontalEdgeGutter){const{QuestDockMode}=this.__closure;switch(activeQuestDockMode){case QuestDockMode.EXPANDED:return 0;default:return horizontalEdgeGutter*-1;}}"
};
getDragHandleOffsetLeft = getDragHandleOffsetLeft2;
__initData = {
code: "function QuestDockDragHandleTsx2(){const{windowDimensions,QUEST_DOCK_COLLAPSED_MAX_WIDTH}=this.__closure;return{width:Math.min(windowDimensions.get().width,QUEST_DOCK_COLLAPSED_MAX_WIDTH)};}"
};
__initData2 = {
code: "function QuestDockDragHandleTsx3(){const{getDragHandleOffsetLeft,activeQuestDockMode,questDockHorizontalGutterCollapsed,isVisualRefreshEnabled,QuestDockMode}=this.__closure;return{left:getDragHandleOffsetLeft(activeQuestDockMode.get(),questDockHorizontalGutterCollapsed),transform:[{translateY:isVisualRefreshEnabled&&activeQuestDockMode.get()!==QuestDockMode.CLOSED&&activeQuestDockMode.get()!==QuestDockMode.SOFT_DISMISSED?-4:0}]};}"
};
__initData3 = {
code: "function QuestDockDragHandleTsx4(){const{withSpring,isEnrolled,activeQuestDockMode,QuestDockMode,QUEST_DOCK_MODE_CHANGE_PHYSICS}=this.__closure;return{opacity:withSpring(isEnrolled||activeQuestDockMode.get()===QuestDockMode.CLOSED||activeQuestDockMode.get()===QuestDockMode.SOFT_DISMISSED?1:0,QUEST_DOCK_MODE_CHANGE_PHYSICS)};}"
};
__initData4 = {
code: "function QuestDockDragHandleTsx5(){const{withSpring,isEnrolled,activeQuestDockMode,QuestDockMode,QUEST_DOCK_MODE_CHANGE_PHYSICS}=this.__closure;return{opacity:withSpring(!isEnrolled&&activeQuestDockMode.get()!==QuestDockMode.CLOSED&&activeQuestDockMode.get()!==QuestDockMode.SOFT_DISMISSED?0.5:0,QUEST_DOCK_MODE_CHANGE_PHYSICS)};}"
};
const r54 = memo(function QuestDockDragHandle(props) {
let enabled;
const isExpanded = props.isExpanded;
const quest = useContext(QuestDockContext).quest;
const styles = useStyles();
const context = useContext(QuestDockGestureContext);
const { activeQuestDockMode, windowDimensions } = context;
const isEnrolled = quest.userStatus?.enrolledAt != null;
let c21047_2 = isEnrolled;
const youBarHorizontalMargin = useYouBarHorizontalMargin();
const n = () => ({
width: Math.min(windowDimensions.get().width, QUEST_DOCK_COLLAPSED_MAX_WIDTH)
});
n.__closure = {
windowDimensions,
QUEST_DOCK_COLLAPSED_MAX_WIDTH
};
n.__workletHash = 13640576219747;
n.__initData = __initData;
const animatedStyle = useAnimatedStyle(n);
enabled = useMobileVisualRefreshConfig({
location: "QuestDockDragHandle"
}).enabled;
const D = () => ({
left: activeQuestDockMode.get() !== QuestDockMode.EXPANDED ? -1 * youBarHorizontalMargin : 0,
transform: [{
translateY: enabled ? activeQuestDockMode.get() !== QuestDockMode.CLOSED ? activeQuestDockMode.get() !== QuestDockMode.SOFT_DISMISSED ? -4 : 0 : 0 : 0
}]
});
D.__closure = {
getDragHandleOffsetLeft,
activeQuestDockMode,
questDockHorizontalGutterCollapsed: youBarHorizontalMargin,
isVisualRefreshEnabled: enabled,
QuestDockMode
};
D.__workletHash = 2091098328770;
D.__initData = __initData2;
const animatedStyle2 = useAnimatedStyle(D);
const E = () => ({
opacity: _spring.withSpring(!c21047_2 && activeQuestDockMode.get() !== QuestDockMode.CLOSED ? activeQuestDockMode.get() === QuestDockMode.SOFT_DISMISSED ? 1 : 0 : 1, QUEST_DOCK_MODE_CHANGE_PHYSICS)
});
E.__closure = {
withSpring: _spring.withSpring,
isEnrolled,
activeQuestDockMode,
QuestDockMode,
QUEST_DOCK_MODE_CHANGE_PHYSICS
};
E.__workletHash = 12299455640931;
E.__initData = __initData3;
const animatedStyle3 = useAnimatedStyle(E);
const h = () => ({
opacity: _spring.withSpring(!c21047_2 && activeQuestDockMode.get() !== QuestDockMode.CLOSED ? activeQuestDockMode.get() === QuestDockMode.SOFT_DISMISSED ? 0 : 0.5 : 0, QUEST_DOCK_MODE_CHANGE_PHYSICS)
});
h.__closure = {
withSpring: _spring.withSpring,
isEnrolled,
activeQuestDockMode,
QuestDockMode,
QUEST_DOCK_MODE_CHANGE_PHYSICS
};
h.__workletHash = 9632835517209;
h.__initData = __initData4;
return <ReanimatedNativeView style={[styles.dragHandleWrapper, animatedStyle]}>
<ReanimatedNativeView style={animatedStyle2} layout={dimensionsLayoutTransition}>
<ReanimatedNativeView style={[styles.dragHandleOverlay, useAnimatedStyle(h)]}>
<ActionSheetHeaderBar variant="overlay" accessibilityLabel={isExpanded ? intl.string(t["GQ+4bk"]) : intl.string(t.Yplnt6)} />
</ReanimatedNativeView>
<ReanimatedNativeView style={[styles.dragHandleOverlay, animatedStyle3]} pointerEvents="none" accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
<ActionSheetHeaderBar variant="default" />
</ReanimatedNativeView>
</ReanimatedNativeView>
</ReanimatedNativeView>;
});
export default r54;