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

77 lines
3.2 KiB
TypeScript

// Metro module 14178 (f14179).
import { View } from "react-native";
import { useVideoQuestUIStore } from "../../VideoQuestUIStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useVideoQuestModalContext } from "./VideoQuestModalContext";
import { useQuestTaskDetails } from "../../hooks/QuestHooks";
import { parseMinutesAndSecondsFromSeconds, formatWatchTaskTime } from "../../utils/QuestTaskUtils";
import { shallow } from "../../../../_bundle/Module3802";
import { getVideoQuestProgressRemainingAccessibilityLabel } from "../../utils/VideoQuestUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import VideoQuestModalCloseButton from "./VideoQuestModalCloseButton";
const useStyles = createStyles({
videoContentHeaderWrapper: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "flex-start"
},
videoContentHeading: {
flexDirection: "column",
flexShrink: 1,
gap: Module712.space.PX_4
},
subheader: {
opacity: 0.6
},
textShadow: {
margin: -15,
padding: 15,
textShadowColor: Module712.colors.BLACK,
textShadowOffset: {
width: 0,
height: 0
},
textShadowRadius: 15
}
});
export default function VideoQuestModalHeader(props) {
const { closeButtonIconColor, onClose, style, showCurrentVideoTime = false, withTextShadow } = props;
let r19 = withTextShadow !== void 0 && withTextShadow;
const styles = useStyles();
const quest = useVideoQuestModalContext().quest;
const questTaskDetails = useQuestTaskDetails(quest);
const videoQuestUIStore = useVideoQuestUIStore((a0) => {
let r9 = a0.videoProgress[quest.id];
if (r9 == null) {
r9 = {
timestampSec: questTaskDetails.progressSeconds,
duration: questTaskDetails.targetSeconds,
maxTimestampSec: questTaskDetails.progressSeconds
};
}
const r22 = parseMinutesAndSecondsFromSeconds(r9.duration - r9.timestampSec);
return formatWatchTaskTime(r22.minutes, r22.seconds);
}, shallow);
const r42 = quest.userStatus?.completedAt != null;
const accessibilityLabel = r42 ? showCurrentVideoTime ? getVideoQuestProgressRemainingAccessibilityLabel(questTaskDetails, r42) : void 0 : getVideoQuestProgressRemainingAccessibilityLabel(questTaskDetails, r42);
const r66 = [<Text variant="heading-md/semibold" color="text-overlay-light" style={r19 ? styles.textShadow : r19}>
{intl.formatToPlainString(t.EQa7os, {
questName: quest.config.messages.questName
})}
</Text>, ,];
const style2 = [styles.subheader, ,];
if (r19) {
r19 = styles.textShadow;
}
style2[1] = r19;
r66[1] = <Text variant="heading-sm/semibold" color="text-overlay-light" accessibilityLabel={accessibilityLabel} style={style2}>
{r42 ? showCurrentVideoTime ? videoQuestUIStore : quest.config.messages.gamePublisher : videoQuestUIStore}
</Text>;
return <View style={[styles.videoContentHeaderWrapper, style]}>
<View style={styles.videoContentHeading}>{r66}</View>
<VideoQuestModalCloseButton iconColor={closeButtonIconColor} onClose={onClose} />
</View>;
};