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,75 @@
// Metro module 11358 (f11359).
import { useEffect, useState, useRef, useMemo } from "react";
import GuildRoleMemberCountStore from "../../../../guild_settings/GuildRoleMemberCountStore";
import { isEveryoneRole } from "../../../../../records/GuildRoleRecord";
import GuildRoleStore from "../../../../../stores/GuildRoleStore";
import { DEFAULT_ROLE_COLOR_HEX } from "../../../../../Constants";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import { ShieldUserIcon } from "../../../../../design/components/Icon/native/redesign/generated/ShieldUserIcon";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import { fetchMemberCounts } from "../../../../guild_settings/GuildRoleMemberActionCreators";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { GroupIcon } from "../../../../../design/components/Icon/native/redesign/generated/GroupIcon";
import fuzzysearch from "../../../../../_bundle/fuzzysearch";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState, AppLauncherList } from "../../base_components/AppLauncherList";
let c7715_12, RoleRow;
const RoleIcon = function RoleIcon(props) {
const role = props.role;
return <AppLauncherOptionIcon icon={<ShieldUserIcon size="sm" color={role != null ? "white" : "interactive-text-default"} />} wrapperStyle={role != null ? {
backgroundColor: role.colorString != null ? role.colorString : DEFAULT_ROLE_COLOR_HEX
} : {}} />;
};
RoleRow = function RoleRow(props) {
const { guildRole, guildId, ...props2 } = props;
const stateFromStores2 = useStateFromStores([GuildRoleMemberCountStore], () => {
const roleMemberCount = GuildRoleMemberCountStore.getRoleMemberCount(guildId);
return roleMemberCount == null ? void 0 : roleMemberCount[guildRole.id];
});
const isEveryoneRole2 = isEveryoneRole(guildRole);
useEffect(() => {
fetchMemberCounts(guildId);
}, [guildId]);
return <TableRow key={guildRole.id} label={<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">{guildRole.name}</Text>} icon={<RoleIcon role={guildRole} />} trailing={isEveryoneRole2 ? null : stateFromStores2 == null ? null : <Text variant="text-sm/normal" color="text-muted">
<GroupIcon size="xxs" color="text-muted" />
{" "}
{stateFromStores2}
</Text>} {...props2} />;
};
c7715_12 = "AppLauncherRoleListActionSheet";
export default function AppLauncherRoleListActionSheet(props) {
let memo;
const { onRolePress, onActionSheetDismiss, channel, option } = props;
memo = void 0;
const guild_id = channel.guild_id;
const [state, setState] = useState("");
const ref = useRef(null);
const stateFromStores = useStateFromStores([GuildRoleStore], () => GuildRoleStore.getSortedRoles(guild_id));
memo = useMemo(() => stateFromStores.filter((stateFromStore) => state === stateFromStore.id || fuzzysearch(state.trim(), stateFromStore.name.toLowerCase())), [stateFromStores, state]);
return <AppLauncherCommandOptionActionSheet option={option} onDismiss={onActionSheetDismiss}>
<AppLauncherListSearchBar onChange={function onChange(event) {
setState(event.toLowerCase());
const current = ref.current;
if (current != null) {
current.scrollToOffset({
offset: 0,
animated: false
});
}
}} />
{memo.length === 0 ? <AppLauncherListEmptyState /> : <AppLauncherList ref={ref} data={memo} renderItem={function renderItem({ item, index }) {
return <RoleRow guildId={guild_id} guildRole={item} onPress={() => {
onRolePress({
role: item
});
ActionSheetActionCreators.hideActionSheet(c7715_12);
onActionSheetDismiss();
}} start={index === 0} end={index === memo.length - 1} />;
}} />}
</AppLauncherCommandOptionActionSheet>;
};
export const APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY = "AppLauncherRoleListActionSheet";
export { RoleIcon };
export { RoleRow };
@@ -0,0 +1,44 @@
// Metro module 11360 (f11361).
import { useState, useEffect } from "react";
import GuildRoleStore from "../../../../../stores/GuildRoleStore";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY, RoleIcon } from "./AppLauncherRoleListActionSheet";
export default function AppLauncherRoleOption(props) {
let state, setState, stateFromStores;
const { style, option, initialValue, onRolePress: onRolePress2, onActionSheetDismiss, channel, autoFocus, hasError, onPress: onPress2 } = props;
state = void 0;
setState = void 0;
stateFromStores = void 0;
const guild_id = channel.guild_id;
[state, setState] = useState(() => initialValue != null ? initialValue.type === "roleMention" ? initialValue.roleId : null : null);
stateFromStores = useStateFromStores([GuildRoleStore], () => {
if (state != null) {
return guild_id != null ? GuildRoleStore.getRole(guild_id, state) : void 0;
}
});
useEffect(() => {
if (state != null && stateFromStores == null) {
onRolePress2({
role: null
});
}
}, [onRolePress2, option.name, stateFromStores, state]);
return <AppLauncherSelectOptionFormRow style={style} option={option} hasError={hasError} selected={stateFromStores != null} selectedItemName={stateFromStores != null ? stateFromStores.name : void 0} onPress={function onPress() {
if (onPress2 != null) {
onPress2();
}
ActionSheetActionCreators.openLazy(import("./AppLauncherRoleListActionSheet"), APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY, {
option,
channel,
onRolePress: ({ role }) => {
setState(role.id);
onRolePress2({
role
});
},
onActionSheetDismiss
});
}} leading={<RoleIcon role={stateFromStores} />} autoFocus={autoFocus} />;
};