This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,158 @@
// Metro module 8453 (f8454).
import { useState, useRef, useMemo, useCallback, useEffect } from "react";
import { ActivityIndicator, View } from "react-native";
import LurkingStore from "../../../lurker_mode/LurkingStore";
import GuildProfileStore, { GuildProfileFetchStatus } from "../../GuildProfileStore";
import { INVALID_ACCESS_ERROR_CODE } from "../../GuildProfileConstants";
import { VerticalGradient } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import useTheme from "../../../../hooks/useTheme";
import { useGuildProfile } from "../../hooks/useGuildProfile";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useToken } from "../../../../design/tokens/native/useToken";
import { useBottomSheetRef } from "../../../../design/components/Sheet/native/useBottomSheetRef";
import useAnalyticsLocations from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { useMobileLurkerServerPreview } from "../../../lurker_mode/experiments/MobileLurkerServerPreviewExperiment";
import { trackGuildProfileViewed } from "../../GuildProfileActionCreators";
import RestrictedGuildProfileView from "./RestrictedGuildProfileView";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
import GuildProfileLoadingError from "./GuildProfileLoadingError";
import GuildProfileView from "./GuildProfileView";
import GuildProfileCTA from "./GuildProfileCTA";
import Module689 from "../../../../_bundle/Module689";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import Module4611 from "../../../../_bundle/Module4611";
import { BottomSheetScrollView } from "../../../../_bundle/Module5245";
import { ActionSheetHeaderBar } from "../../../../design/components/Sheet/native/ActionSheetHeaderBar.native";
const useStyles = createStyles({
loadingContainer: {
paddingTop: 40
},
footerContainer: {
paddingHorizontal: 16,
paddingVertical: 40
},
scrollView: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
export default function GuildProfileActionSheet(props) {
let r135, r136, callback, callback2, memo;
let analyticsLocations, token;
const { guildId, context, inviteKey } = props;
analyticsLocations = void 0;
token = void 0;
const styles = useStyles();
const theme = useTheme();
const guildProfile2 = useGuildProfile(guildId);
const { guildProfile, fetchGuildProfile, fetchStatus } = guildProfile2;
const stateFromStores = useStateFromStores([GuildProfileStore], () => GuildProfileStore.getErrorCode(guildId));
const token2 = useToken(Module712.colors.INTERACTIVE_TEXT_HOVER, theme);
const bottomSheetRef3 = useBottomSheetRef();
const { bottomSheetRef: bottomSheetRef2, bottomSheetClose } = bottomSheetRef3;
analyticsLocations = useAnalyticsLocations(AnalyticsLocation.GUILD_PROFILE).analyticsLocations;
token = useToken(Module712.colors.BACKGROUND_BASE_LOW);
let r74 = useStateFromStores([LurkingStore], () => guildId != null && LurkingStore.isLurking(guildId), [guildId]);
const enabled2 = useMobileLurkerServerPreview("GuildProfileActionSheet").enabled;
if (r74) {
r74 = enabled2;
}
let enabled, c16602_1, bottomSheetRef, height, state, setState, state2, setState2, ref;
L11: {
const r4 = guildProfile != null;
enabled = r74;
c16602_1 = r4;
bottomSheetRef = bottomSheetRef2;
height = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
ref = void 0;
height = useWindowDimensions_native().height;
[state, setState] = useState(null);
[state2, setState2] = useState(null);
ref = useRef(false);
memo = useMemo(() => {
if (enabled) {
return state != null && state2 != null ? Math.round(Math.min(0.95 * height, Math.max(0.65 * height, state + state2))) : Math.round(0.65 * height);
}
}, [enabled, state, state2, height]);
callback = useCallback((a0) => {
let r1 = enabled;
if (enabled) {
r1 = c16602_1;
}
if (r1) {
setState(a0.nativeEvent.layout.height);
}
}, [enabled, r4]);
callback2 = useCallback((a0) => {
if (enabled) {
setState2(a0.nativeEvent.layout.height);
}
}, [enabled]);
useEffect(() => {
let r2 = enabled;
if (enabled) {
r2 = state != null;
}
if (r2) {
r2 = state2 != null;
}
if (r2 && !ref.current) {
ref.current = true;
requestAnimationFrame(() => {
const current = bottomSheetRef.current;
if (current != null) {
current.snapToIndex(0);
}
});
}
}, [enabled, state, state2, bottomSheetRef]);
useEffect(() => {
trackGuildProfileViewed(guildId, analyticsLocations);
}, [guildId, analyticsLocations]);
const callback3 = useCallback(() => {
fetchGuildProfile(true);
}, [fetchGuildProfile]);
useEffect(() => {
fetchGuildProfile();
}, [fetchGuildProfile]);
if (fetchStatus !== GuildProfileFetchStatus.NOT_FETCHED && fetchStatus !== GuildProfileFetchStatus.FETCHING) {
if (guildProfile == null && stateFromStores === INVALID_ACCESS_ERROR_CODE) {
r136 = <RestrictedGuildProfileView />;
r135 = <Button size="lg" text={intl.string(t.cpT0Cq)} onPress={bottomSheetClose} />;
break L11;
}
if (guildProfile == null) {
r136 = <GuildProfileLoadingError onRetry={callback3} />;
r135 = <Button size="lg" text={intl.string(t.cpT0Cq)} onPress={bottomSheetClose} />;
break L11;
}
const r131 = <GuildProfileView guildProfile={guildProfile} isLurkerServerPreview={enabled} />;
r135 = <GuildProfileCTA profile={guildProfile} context={context} inviteKey={inviteKey} isLurkerServerPreview={enabled} />;
r136 = r131;
} else {
r136 = <View style={styles.loadingContainer}>
<ActivityIndicator animating size="large" />
</View>;
r135 = null;
}
}
return <BottomSheet ref={bottomSheetRef} scrollable handleDisabled startHeight={memo} footer={<Module4611 start={VerticalGradient.START} end={{
x: 0,
y: 0.5
}} style={styles.footerContainer} colors={useMemo(() => [Module689(token).alpha(0).hex(), token], [token])} onLayout={enabled ? callback2 : void 0}>{r135}</Module4611>}>
<BottomSheetScrollView style={styles.scrollView}>
{enabled ? <View onLayout={callback}>{r136}</View> : r136}
</BottomSheetScrollView>
<ActionSheetHeaderBar variant="floating" tabStyle={{
backgroundColor: token2
}} onPress={bottomSheetClose} />
</BottomSheet>;
};