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,298 @@
// Metro module 10068 (f10069).
import GuildDirectorySearchStore from "./GuildDirectorySearchStore";
import { DirectoryEntryCategories } from "./GuildDirectoryConstants";
import { Endpoints } from "../../Constants";
import debounce from "../../_bundle/debounce";
import Dispatcher from "../../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
import TrackedHTTPUtils from "../../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../../_bundle/Module503";
let c6701_0;
let c6702_0;
let env6699 = {};
let c6700_0 = async (c26607_0, category_id) => {
let c26607_5 = 0;
let c30184_0, c30184_1;
L10: {
try {
c30184_0 = c26607_0;
c30184_1 = void 0;
c26607_5 = 1;
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_FETCH_START"
});
c30184_1 = await HTTP.get({
url: Endpoints.DIRECTORY_CHANNEL_ENTRIES(c26607_0),
query: {
category_id
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_FETCH_SUCCESS",
channelId: c30184_0,
entries: c30184_1.body
});
c26607_5 = 0;
} catch ($e) {
let r7 = $e;
if (c26607_5 !== 0) {
while (true) {
try {
c26607_5 = 0;
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_FETCH_FAILURE"
});
break L10;
} catch ($e) {
r7 = $e;
if (c26607_5 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
const r32 = debounce(function() {
const apply = c6700_0.apply;
return c6700_0.apply(this, arguments);
}, 200);
c6701_0 = void 0;
c6701_0 = async (c26608_0) => {
let c26608_4 = 0;
let c30185_0, c30185_1;
L10: {
try {
c30185_0 = c26608_0;
c30185_1 = void 0;
c26608_4 = 1;
c30185_1 = await HTTP.get({
url: Endpoints.DIRECTORY_CHANNEL_CATEGORY_COUNTS(c26608_0),
rejectWithError: true
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_COUNTS_FETCH_SUCCESS",
channelId: c30185_0,
counts: c30185_1.body
});
c26608_4 = 0;
} catch ($e) {
let r7 = $e;
if (c26608_4 !== 0) {
while (true) {
try {
c26608_4 = 0;
break L10;
} catch ($e) {
r7 = $e;
if (c26608_4 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
const r39 = debounce(function() {
const apply = c6701_0.apply;
return c6701_0.apply(this, arguments);
}, 200);
c6702_0 = void 0;
c6702_0 = async (channelId, query) => {
let c26609_5 = 0;
let c30186_0, c30186_1, c30186_2;
L14: {
try {
c30186_0 = channelId;
c30186_1 = query;
c30186_2 = void 0;
if (GuildDirectorySearchStore.shouldFetch(channelId, query)) {
c26609_5 = 1;
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_SEARCH_START",
channelId,
query
});
c30186_2 = await HTTP.get({
url: Endpoints.DIRECTORY_ENTRIES_SEARCH(channelId),
query: {
query
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_SEARCH_SUCCESS",
channelId: c30186_0,
query: c30186_1,
results: c30186_2.body
});
c26609_5 = 0;
break L14;
}
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_CACHED_SEARCH",
channelId,
query
});
} catch ($e) {
let r7 = $e;
if (c26609_5 !== 0) {
while (true) {
try {
c26609_5 = 0;
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_FETCH_FAILURE"
});
break L14;
} catch ($e) {
r7 = $e;
if (c26609_5 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
};
const r46 = debounce(function() {
const apply = c6702_0.apply;
return c6702_0.apply(this, arguments);
}, 200);
export { r32 as fetchDirectoryEntries };
export { r39 as fetchDirectoryCounts };
export async function addDirectoryGuildEntry(c26604_0, c26604_1, c26604_2, c26604_3) {
let c30181_0 = c26604_0;
let c30181_1 = c26604_1;
let c30181_2 = c26604_2;
let r34 = c26604_3;
if (r34 === void 0) {
r34 = DirectoryEntryCategories.UNCATEGORIZED;
}
let c30181_3 = r34;
await void 0;
let c30181_4 = await TrackedHTTPUtils.post({
url: Endpoints.DIRECTORY_CHANNEL_ENTRY(c30181_0, c30181_1),
body: {
description: c30181_2,
primary_category_id: c30181_3
},
trackedActionData: {
event: NetworkActionNames.DIRECTORY_GUILD_ENTRY_CREATE,
properties: {
directory_channel_id: c30181_0,
guild_id: c30181_1,
primary_category_id: c30181_3
}
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_ENTRY_CREATE",
channelId: c30181_0,
entry: c30181_4.body
});
}
export function removeDirectoryGuildEntry(a0, a1) {
TrackedHTTPUtils.delete({
url: Endpoints.DIRECTORY_CHANNEL_ENTRY(a0, a1),
trackedActionData: {
event: NetworkActionNames.DIRECTORY_GUILD_ENTRY_DELETE,
properties: {
directory_channel_id: a0,
guild_id: a1
}
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_ENTRY_DELETE",
channelId: a0,
guildId: a1
});
}
export { r46 as searchDirectoryEntries };
export function clearDirectorySearch(a0) {
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_SEARCH_CLEAR",
channelId: a0
});
}
export async function updateDirectoryEntry(c26605_0, c26605_1, c26605_2, c26605_3) {
let c30182_0 = c26605_0;
let c30182_1 = c26605_1;
let c30182_2 = c26605_2;
let r35 = c26605_3;
if (r35 === void 0) {
r35 = DirectoryEntryCategories.UNCATEGORIZED;
}
let c30182_3 = r35;
await void 0;
let c30182_4 = await HTTP.patch({
url: Endpoints.DIRECTORY_CHANNEL_ENTRY(c30182_0, c30182_1),
body: {
description: c30182_2,
primary_category_id: c30182_3
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_ENTRY_UPDATE",
channelId: c30182_0,
entry: c30182_4.body
});
}
export function selectDirectoryCategory(a0, a1) {
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_CATEGORY_SELECT",
channelId: a0,
categoryId: a1
});
}
export async function fetchGuildEntriesForIds(c26606_0, entity_ids) {
let c26606_5 = 0;
let c30183_0, c30183_1;
L10: {
try {
c30183_0 = c26606_0;
c30183_1 = void 0;
c26606_5 = 1;
c30183_1 = await HTTP.get({
url: Endpoints.DIRECTORY_CHANNEL_LIST_BY_ID(c26606_0),
query: {
entity_ids
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "GUILD_DIRECTORY_ADMIN_ENTRIES_FETCH_SUCCESS",
channelId: c30183_0,
entries: c30183_1.body
});
c26606_5 = 0;
} catch ($e) {
let r8 = $e;
if (c26606_5 !== 0) {
while (true) {
try {
c26606_5 = 0;
break L10;
} catch ($e) {
r8 = $e;
if (c26606_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
@@ -0,0 +1,482 @@
// Metro module 10057 (f10058).
import { ChannelTypes, Permissions } from "../../Constants";
import { intl, t } from "../../intl/index.native";
import { DEFAULT } from "../../utils/PermissionUtils";
import { combine } from "../../_bundle/HighLow";
const r10 = {
GUILD: 0,
0: "GUILD",
GUILD_SCHEDULED_EVENT: 1,
1: "GUILD_SCHEDULED_EVENT"
};
const r23 = {
GUILD_TEMPLATES: "guild-templates",
CUSTOMIZE_NEW_GUILD: "customize-new-guild",
CHOOSE_GUILD: "choose-guild",
CUSTOMIZE_EXISTING_GUILD: "customize-existing-guild",
CONFIRMATION: "confirmation"
};
let c6690_5 = {
CREATE: "CREATE",
HUB_SCHOOL_CLUB: "HUB_SCHOOL_CLUB",
HUB_STUDY: "HUB_STUDY",
HUB_CLASS: "HUB_CLASS",
HUB_SOCIAL: "HUB_SOCIAL",
HUB_MAJOR: "HUB_MAJOR",
HUB_DORM: "HUB_DORM"
};
const r37 = {
ALL: -1
};
r37[-1] = "ALL";
r37.UNCATEGORIZED = 0;
r37[0] = "UNCATEGORIZED";
r37.SCHOOL_CLUB = 1;
r37[1] = "SCHOOL_CLUB";
r37.CLASS = 2;
r37[2] = "CLASS";
r37.STUDY_SOCIAL = 3;
r37[3] = "STUDY_SOCIAL";
r37.MISC = 5;
r37[5] = "MISC";
let c6690_6 = r37;
let c6690_7 = "883060064561299456";
export { r10 as DirectoryEntryTypes };
export { r23 as CreateOrAddGuildSlideTypes };
export { c6690_5 as HubGuildTemplateId };
export { c6690_6 as DirectoryEntryCategories };
export const HQ_CHANNEL_ID = "883060064561299456";
export function getHubCategories(a0) {
return a0 === c6690_7 ? [{
id: "club",
value: c6690_6.SCHOOL_CLUB,
label: intl.string(t["Z+MPN/"])
}, {
id: "class",
value: c6690_6.CLASS,
label: intl.string(t.dV9uBr)
}, {
id: "study",
value: c6690_6.STUDY_SOCIAL,
label: intl.string(t.xoHQcn)
}, {
id: "misc",
value: c6690_6.MISC,
label: intl.string(t.Ao41ri)
}] : [{
id: "club",
value: c6690_6.SCHOOL_CLUB,
label: intl.string(t.oNHFUL),
idealSize: 100
}, {
id: "class",
value: c6690_6.CLASS,
label: intl.string(t.V1i8nS)
}, {
id: "study",
value: c6690_6.STUDY_SOCIAL,
label: intl.string(t.Z2ygQt),
idealSize: 50
}, {
id: "misc",
value: c6690_6.MISC,
label: intl.string(t["0Bg9La"])
}];
}
export function getHubGuildTemplatesMap() {
const r1 = {};
r1[c6690_5.CREATE] = {
id: c6690_5.CREATE,
code: "2TffvPucqHkN",
label: intl.string(t["H3+6BK"]),
channels: [],
system_channel_id: null
};
r1[c6690_5.HUB_SCHOOL_CLUB] = {
id: c6690_5.HUB_SCHOOL_CLUB,
code: "UMUbvRpRZhS6",
label: intl.string(t.mmFA51),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t["VCAA/X"]),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t.GHQoEd),
type: ChannelTypes.GUILD_TEXT
}, {
id: "02",
parent_id: "00",
name: intl.string(t.nSsoSF),
type: ChannelTypes.GUILD_TEXT
}, {
id: "03",
parent_id: "00",
name: intl.string(t.yZCzMa),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.mobYpC),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "13",
parent_id: "10",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "20",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "21",
parent_id: "20",
name: intl.string(t.XS6gcJ),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.string(t.hi1Ykg),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.string(t.vw8oaS),
type: ChannelTypes.GUILD_VOICE
}],
roles: [{
id: "00",
name: "@everyone",
permissions: DEFAULT
}, {
id: "01",
name: "officers (example)",
mentionable: true,
hoist: true,
permissions: combine(DEFAULT, Permissions.MANAGE_ROLES, Permissions.MANAGE_CHANNELS, Permissions.KICK_MEMBERS, Permissions.BAN_MEMBERS, Permissions.MANAGE_NICKNAMES, Permissions.MANAGE_GUILD_EXPRESSIONS, Permissions.MANAGE_MESSAGES, Permissions.SEND_TTS_MESSAGES),
color: 3066993
}],
system_channel_id: "12"
};
r1[c6690_5.HUB_STUDY] = {
id: c6690_5.HUB_STUDY,
code: "2JBhzzca2vfT",
label: intl.string(t.fYwSi2),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t["HY+vdA"]),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t["3eM+Lh"]),
type: ChannelTypes.GUILD_TEXT
}, {
id: "02",
parent_id: "00",
name: intl.string(t.Qi0D7e),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.yZIUVx),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "20",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "21",
parent_id: "20",
name: intl.string(t.XS6gcJ),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 1
}),
type: ChannelTypes.GUILD_VOICE
}, {
id: "23",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 2
}),
type: ChannelTypes.GUILD_VOICE
}],
system_channel_id: "12"
};
r1[c6690_5.HUB_CLASS] = {
id: c6690_5.HUB_CLASS,
code: "r86WWBwTGspb",
label: intl.string(t.e5gFS3),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t["HY+vdA"]),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t["710tNh"]),
type: ChannelTypes.GUILD_TEXT
}, {
id: "02",
parent_id: "00",
name: intl.string(t.Qi0D7e),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.yZIUVx),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "13",
parent_id: "10",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "20",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "21",
parent_id: "20",
name: intl.string(t.XS6gcJ),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 1
}),
type: ChannelTypes.GUILD_VOICE
}, {
id: "23",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 2
}),
type: ChannelTypes.GUILD_VOICE
}],
system_channel_id: "12"
};
r1[c6690_5.HUB_SOCIAL] = {
id: c6690_5.HUB_SOCIAL,
code: "AvvtXE3mfbCR",
label: intl.string(t.oOj7It),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t.yZIUVx),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "02",
parent_id: "00",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "03",
parent_id: "00",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "04",
parent_id: "00",
name: intl.string(t.d4F8gP),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.CLWKNs),
type: ChannelTypes.GUILD_VOICE
}, {
id: "12",
parent_id: "10",
name: intl.string(t.g3qPRn),
type: ChannelTypes.GUILD_VOICE
}, {
id: "13",
parent_id: "10",
name: intl.string(t["yQZpe/"]),
type: ChannelTypes.GUILD_VOICE
}],
system_channel_id: "02"
};
r1[c6690_5.HUB_MAJOR] = {
id: c6690_5.HUB_MAJOR,
code: "FhmfDR6Arvsc",
label: intl.string(t["9kly4U"]),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t["HY+vdA"]),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t.yZCzMa),
type: ChannelTypes.GUILD_TEXT
}, {
id: "02",
parent_id: "00",
name: intl.string(t.Qi0D7e),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.yZIUVx),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "13",
parent_id: "10",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "20",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "21",
parent_id: "20",
name: intl.string(t.XS6gcJ),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 1
}),
type: ChannelTypes.GUILD_VOICE
}, {
id: "23",
parent_id: "20",
name: intl.formatToPlainString(t.LuNsNf, {
number: 2
}),
type: ChannelTypes.GUILD_VOICE
}],
system_channel_id: "12"
};
r1[c6690_5.HUB_DORM] = {
id: c6690_5.HUB_DORM,
code: "fkq8xHfrGE58",
label: intl.string(t["ppGw/P"]),
channels: [{
id: "00",
parent_id: null,
name: intl.string(t["HY+vdA"]),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "01",
parent_id: "00",
name: intl.string(t["b2+FCc"]),
type: ChannelTypes.GUILD_TEXT
}, {
id: "10",
parent_id: null,
name: intl.string(t.yZIUVx),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "11",
parent_id: "10",
name: intl.string(t.pIOigB),
type: ChannelTypes.GUILD_TEXT
}, {
id: "12",
parent_id: "10",
name: intl.string(t.ao2wxq),
type: ChannelTypes.GUILD_TEXT
}, {
id: "13",
parent_id: "10",
name: intl.string(t.AIszv8),
type: ChannelTypes.GUILD_TEXT
}, {
id: "20",
parent_id: null,
name: intl.string(t.vcKDMv),
type: ChannelTypes.GUILD_CATEGORY
}, {
id: "21",
parent_id: "20",
name: intl.string(t.XS6gcJ),
type: ChannelTypes.GUILD_VOICE
}, {
id: "22",
parent_id: "20",
name: intl.string(t.g3qPRn),
type: ChannelTypes.GUILD_VOICE
}, {
id: "23",
parent_id: "20",
name: intl.string(t.CLWKNs),
type: ChannelTypes.GUILD_VOICE
}],
system_channel_id: "12"
};
return r1;
}
@@ -0,0 +1,96 @@
// Metro module 10055 (f10056).
import { guildDirectoryEntryFromServer, orderByTotalMemberCount } from "./GuildDirectoryUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c6688_2 = [];
let c6688_3 = {};
let c6688_4 = {};
class GuildDirectorySearchStore extends Module589.Store {
static displayName = "GuildDirectorySearchStore";
getSearchState(a0) {
let r4 = c6688_3[a0];
if (r4 == null) {
r4 = {
mostRecentQuery: "",
fetching: false
};
}
return r4;
}
getSearchResults(a0, a1) {
const r6 = c6688_4[a0];
let r7 = r6 == null ? void 0 : r6[a1]?.results;
if (r7 == null) {
r7 = c6688_2;
}
return r7;
}
shouldFetch(a0, a1) {
const r6 = c6688_4[a0];
const r8 = r6 == null ? void 0 : r6[a1]?.lastSearchedAt;
return r8 == null || Date.now() - r8 > 120000;
}
}
const guildDirectorySearchStore = new GuildDirectorySearchStore(Dispatcher, {
GUILD_DIRECTORY_SEARCH_START: function handleSearchStart(a0) {
c6688_3[a0.channelId] = {
fetching: true,
mostRecentQuery: a0.query
};
},
GUILD_DIRECTORY_SEARCH_SUCCESS: function handleSearchSuccess({ channelId, query, results }) {
c6688_3[channelId] = {
...c6688_3[channelId],
fetching: false
};
const r13 = [];
let c17657_0 = r13;
results.forEach((result) => {
c17657_0.push(guildDirectoryEntryFromServer(result));
});
const r18 = {
...c6688_4[channelId]
};
r18[query] = {
results: orderByTotalMemberCount(r13),
lastSearchedAt: Date.now()
};
c6688_4[channelId] = r18;
},
GUILD_DIRECTORY_SEARCH_FAILURE: function handleSearchFailure({ channelId }) {
c6688_3[channelId] = {
...c6688_3[channelId],
fetching: false
};
},
GUILD_DIRECTORY_SEARCH_CLEAR: function handleSearchClear(a0) {
c6688_3[a0.channelId] = {
fetching: false,
mostRecentQuery: ""
};
},
GUILD_DIRECTORY_CACHED_SEARCH: function handleUpdateQuery(a0) {
c6688_3[a0.channelId] = {
fetching: false,
mostRecentQuery: a0.query
};
},
GUILD_DIRECTORY_ENTRY_DELETE: function handleDeleteEntry({ channelId, guildId }) {
const mostRecentQuery = c6688_3[channelId]?.mostRecentQuery;
if (mostRecentQuery != null) {
const r9 = c6688_4[channelId][mostRecentQuery];
if (r9 != null) {
const results = r9.results.filter((result) => result.guildId !== guildId);
const r20 = {
...c6688_4[channelId]
};
r20[c6688_3[channelId].mostRecentQuery] = {
...r9,
results
};
c6688_4[channelId] = r20;
}
}
}
});
export default guildDirectorySearchStore;
@@ -0,0 +1,238 @@
// Metro module 10064 (f10065).
import { DirectoryEntryCategories } from "./GuildDirectoryConstants";
import { guildDirectoryEntryFromServer } from "./GuildDirectoryUtils";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c6695_3 = Object.freeze({});
let c6695_4 = false;
let c6695_5 = {};
let c6695_6 = {};
let c6695_7 = {};
let c6695_8 = {};
let c6695_9 = {};
class GuildDirectoryStore extends Module589.Store {
static displayName = "GuildDirectoryStore";
isFetching() {
return c6695_4;
}
getCurrentCategoryId(a0) {
let r4 = c6695_6[a0];
if (r4 == null) {
r4 = DirectoryEntryCategories.ALL;
}
return r4;
}
getDirectoryEntries(a0, a1) {
let r5;
if (a1 != null) {
const r7 = c6695_7[a0];
r5 = r7 == null ? void 0 : r7[a1];
} else {
r5 = c6695_5[a0];
}
return r5;
}
getDirectoryEntry(a0, a1) {
const r3 = c6695_5[a0];
return r3 == null ? void 0 : r3[a1];
}
getDirectoryAllEntriesCount(a0) {
const r3 = Object;
let r7 = c6695_5[a0];
if (r7 == null) {
r7 = {};
}
return r3.keys(r7).length;
}
getDirectoryCategoryCounts(a0) {
let r4 = c6695_8[a0];
if (r4 == null) {
r4 = c6695_3;
}
return r4;
}
getAdminGuildEntryIds(a0) {
return c6695_9[a0];
}
}
const guildDirectoryStore = new GuildDirectoryStore(Dispatcher, {
GUILD_DIRECTORY_FETCH_START: function handleFetchStart() {
c6695_4 = true;
},
GUILD_DIRECTORY_FETCH_SUCCESS: function handleFetchSuccess({ channelId, entries }) {
c6695_4 = false;
const r5 = {};
let c17665_0 = r5;
const r8 = {};
let c17665_1 = r8;
entries.forEach((entry) => {
const r11 = guildDirectoryEntryFromServer(entry);
c17665_0[r11.guildId] = r11;
if (c17665_1[r11.primaryCategoryId] != null) {
c17665_1[r11.primaryCategoryId][r11.guildId] = r11;
} else {
const primaryCategoryId = r11.primaryCategoryId;
const r18 = {};
r18[r11.guildId] = r11;
c17665_1[primaryCategoryId] = r18;
}
});
c6695_5[channelId] = r5;
c6695_7[channelId] = r8;
},
GUILD_DIRECTORY_FETCH_FAILURE: function handleFetchFailure() {
c6695_4 = false;
},
GUILD_DIRECTORY_ENTRY_CREATE: function handleCreateEntry(a0) {
const channelId = a0.channelId;
const r11 = guildDirectoryEntryFromServer(a0.entry);
if (r11 != null) {
const r9 = c6695_5[channelId];
if ((r9 == null ? void 0 : r9[r11.guildId]) == null) {
const r21 = {
...c6695_5[channelId]
};
r21[r11.guildId] = r11;
c6695_5[channelId] = r21;
let primaryCategoryId = r11.primaryCategoryId;
if (primaryCategoryId == null) {
primaryCategoryId = DirectoryEntryCategories.UNCATEGORIZED;
}
const r27 = {
...c6695_7[channelId]
};
const r31 = c6695_7[channelId];
const r33 = {
...r31 == null ? void 0 : r31[primaryCategoryId]
};
r33[r11.guildId] = r11;
r27[primaryCategoryId] = r33;
c6695_7[channelId] = r27;
if (c6695_8[channelId] != null) {
const r40 = c6695_8[channelId];
let r42 = r40 == null ? void 0 : r40[primaryCategoryId];
if (r42 == null) {
r42 = 0;
}
const r43 = {
...c6695_8[channelId]
};
r43[primaryCategoryId] = r42 + 1;
c6695_8[channelId] = r43;
}
}
}
},
GUILD_DIRECTORY_ENTRY_DELETE: function handleDeleteEntry({ channelId, guildId }) {
const r9 = c6695_5[channelId];
const r8 = r9 == null ? void 0 : r9[guildId];
if (r8 != null) {
const primaryCategoryId = r8.primaryCategoryId;
const r22 = {
...c6695_5[channelId]
};
delete r22[guildId];
const r25 = c6695_9[channelId];
if (r25 != null) {
r25.delete(guildId);
}
c6695_9[channelId] = new Set(c6695_9[channelId]);
c6695_5[channelId] = r22;
const r37 = {
...c6695_7[channelId][primaryCategoryId]
};
delete r37[guildId];
const r39 = {
...c6695_7[channelId]
};
r39[primaryCategoryId] = r37;
c6695_7[channelId] = r39;
if (c6695_8[channelId] != null) {
const r1 = c6695_8[channelId][primaryCategoryId] - 1;
const r46 = {
...c6695_8[channelId]
};
r46[primaryCategoryId] = 0 <= r1 ? r1 : 0;
c6695_8[channelId] = r46;
}
}
},
GUILD_DIRECTORY_ENTRY_UPDATE: function handleUpdateEntry(a0) {
const channelId = a0.channelId;
const r16 = guildDirectoryEntryFromServer(a0.entry);
const r12 = c6695_5[channelId];
const r25 = r12 == null ? void 0 : r12[r16.guildId];
const r27 = {
...c6695_5[channelId]
};
r27[r16.guildId] = {
...r25,
...r16
};
c6695_5[channelId] = r27;
const r35 = r25 == null;
let r36 = r35 ? void 0 : r25.primaryCategoryId;
if (r36 == null) {
r36 = DirectoryEntryCategories.UNCATEGORIZED;
}
let primaryCategoryId = r16.primaryCategoryId;
if (primaryCategoryId == null) {
primaryCategoryId = DirectoryEntryCategories.UNCATEGORIZED;
}
const r15 = Object;
const r43 = c6695_7[channelId];
const r47 = r15.assign({}, r43 == null ? void 0 : r43[r36]);
if (r25 != null && r36 !== primaryCategoryId) {
delete r47[r16.guildId];
}
const r51 = {
...c6695_7[channelId]
};
r51[r36] = r47;
const r55 = c6695_7[channelId];
const r58 = {
...r55 == null ? void 0 : r55[primaryCategoryId]
};
r58[r16.guildId] = {
...r25,
...r16
};
r51[primaryCategoryId] = r58;
c6695_7[channelId] = r51;
if (primaryCategoryId !== r36 && c6695_8[channelId] != null) {
const r74 = {
...c6695_8[channelId]
};
const r78 = c6695_8[channelId];
const r81 = (r78 == null ? void 0 : r78[r36]) > 0;
let r1 = 0;
if (r81) {
const r82 = c6695_8[channelId];
r1 = (r82 == null ? void 0 : r82[r36]) - 1;
}
r74[r36] = r1;
const r85 = c6695_8[channelId];
let r87 = r85 == null ? void 0 : r85[primaryCategoryId];
if (r87 == null) {
r87 = 0;
}
r74[primaryCategoryId] = r87 + 1;
c6695_8[channelId] = r74;
}
},
GUILD_DIRECTORY_CATEGORY_SELECT: function handleSelectCategory(a0) {
c6695_6[a0.channelId] = a0.categoryId;
},
GUILD_DIRECTORY_COUNTS_FETCH_SUCCESS: function handleFetchCategoryCounts(a0) {
c6695_8[a0.channelId] = a0.counts;
},
GUILD_DIRECTORY_ADMIN_ENTRIES_FETCH_SUCCESS: function handleFetchAdminEntries({ channelId, entries }) {
const set = new Set();
let c17666_0 = set;
entries.forEach((entry) => {
c17666_0.add(guildDirectoryEntryFromServer(entry).guildId);
});
c6695_9[channelId] = set;
}
});
export default guildDirectoryStore;
@@ -0,0 +1,46 @@
// Metro module 10056 (f10057).
import { DirectoryEntryTypes } from "./GuildDirectoryConstants";
import Module38 from "../../_bundle/Module38";
import Module12 from "../../_bundle/Module12";
function $mk83845() {
return (a0) => a0.approximateMemberCount;
}
function $mk83846() {
return (a0) => a0.createdAt;
}
export function guildDirectoryEntryFromServer(a0) {
if (a0.type === DirectoryEntryTypes.GUILD) {
const name = a0.guild?.name;
return {
channelId: a0.directory_channel_id,
guildId: a0.entity_id,
type: a0.type,
authorId: a0.author_id,
createdAt: a0.created_at,
description: a0.description,
primaryCategoryId: a0.primary_category_id,
name,
icon: a0.guild?.icon,
splash: a0.guild?.splash,
features: new Set(a0.guild?.features),
approximateMemberCount: a0.guild?.approximate_member_count,
approximatePresenceCount: a0.guild?.approximate_presence_count,
featurableInDirectory: a0.guild?.featurable_in_directory
};
}
a0.type;
Module38(false, "Directory entries must be connected to a guild!");
}
export const MAX_CATEGORY_SERVERS = 5;
export function orderByTotalMemberCount(a0) {
return Module12.orderBy(a0, [$mk83845()], ["desc"]);
}
export function orderByDateAdded(a0) {
return Module12.orderBy(a0, [$mk83846()], ["desc"]);
}
export function rankByDateAdded(a0) {
return Module12.orderBy(a0.filter((item) => item.featurableInDirectory), [$mk83846()], ["desc"]).slice(0, 5);
}
export function rankGuildEntries(a0) {
return Module12.orderBy(a0, [$mk83845()], ["desc"]);
}
@@ -0,0 +1,15 @@
// Metro module 10062 (f10063).
const r10 = {
CREATE_OR_ADD: "CREATE_OR_ADD",
DESCRIPTION: "DESCRIPTION",
TEMPLATES: "TEMPLATES",
CREATE: "CREATE"
};
const r15 = {
GUILD_LIST_TOP: 1,
1: "GUILD_LIST_TOP"
};
export { r10 as GuildDirectoryCreate };
export const GUILD_DIRECTORY_BASE_HEADER_HEIGHT = 300;
export const GUILD_DIRECTORY_PROGRESS_BAR_HEIGHT = 96;
export { r15 as DirectoryChannelScrollBehavior };
@@ -0,0 +1,59 @@
// Metro module 11761 (f11762).
import { DirectoryEntryCategories } from "../GuildDirectoryConstants";
import { rankGuildEntries, rankByDateAdded, orderByTotalMemberCount } from "../GuildDirectoryUtils";
import { intl, t } from "../../../intl/index.native";
let c8058_3 = {
ENTRY: 0,
0: "ENTRY",
HEADER: 1,
1: "HEADER",
PLACEHOLDER: 2,
2: "PLACEHOLDER"
};
let c8058_4 = Array(20).fill({
type: c8058_3.PLACEHOLDER
});
export { c8058_3 as RowType };
export function generateDirectoryRows(a0, a1, a2) {
if (a0 && a1.length === 0) {
return c8058_4;
}
if (a1.length === 0) {
return [];
}
if (a2 !== DirectoryEntryCategories.ALL) {
return rankGuildEntries(a1).map((item) => ({
type: c8058_3.ENTRY,
entry: item
}));
}
const r9 = [];
const r11 = rankByDateAdded(a1);
let c19137_0 = new Set(r11.map((item) => item.guildId));
const length = r11.length;
let r32 = r9;
if (length > 0) {
r9.push({
type: c8058_3.HEADER,
header: intl.string(t.CbaapP)
});
r32 = r9.concat(r11.map((item) => ({
type: c8058_3.ENTRY,
entry: item
})));
}
const r54 = orderByTotalMemberCount(a1.filter((item) => !c19137_0.has(item.guildId)));
const length2 = r54.length;
let r56 = r32;
if (length2 > 0) {
r32.push({
type: c8058_3.HEADER,
header: intl.string(t.wxbhEe)
});
r56 = r32.concat(r54.map((item) => ({
type: c8058_3.ENTRY,
entry: item
})));
}
return r56;
}
@@ -0,0 +1,18 @@
// Metro module 10077 (f10078).
import Module10078 from "../../../_bundle/Module10078";
import Module10079 from "../../../_bundle/Module10079";
import Module10080 from "../../../_bundle/Module10080";
import Module10081 from "../../../_bundle/Module10081";
import Module10082 from "../../../_bundle/Module10082";
import Module10083 from "../../../_bundle/Module10083";
import Module10084 from "../../../_bundle/Module10084";
const r12 = {
CREATE: Module10078,
HUB_SCHOOL_CLUB: Module10079,
HUB_STUDY: Module10080,
HUB_CLASS: Module10081,
HUB_SOCIAL: Module10082,
HUB_MAJOR: Module10083,
HUB_DORM: Module10084
};
export { r12 as GUILD_TEMPLATE_ICONS };
@@ -0,0 +1,52 @@
// Metro module 10073 (f10074).
import { addDirectoryGuildEntry } from "../GuildDirectoryActionCreators";
import AlertActionCreators from "../../../actions/native/AlertActionCreators";
function $mk115621($env) {
return () => import("./components/GuildDirectoryAddAlert").then($mk118156($env));
}
function $mk118156($env) {
return (a0) => {
let env31998 = {
$parent: $env
};
env31998[0] = a0.default;
return (a0) => {
const r3 = env31998.$parent.$parent[5];
const r2 = env31998[0];
const r10 = env31998.$parent;
return r3(r2, {
...a0,
guild: r10[2],
directoryGuildName: r10[1]
});
};
};
}
let env6707 = {};
export async function onAddDirectoryGuildEntry(c26612_0) {
let env30191;
const r30 = env6707;
let c26612_2 = r30;
const r10 = env30191 = {
$parent: r30
};
let c26612_1 = r10;
env30191[0] = void 0;
env30191[1] = void 0;
env30191[2] = void 0;
env30191[3] = void 0;
env30191[4] = void 0;
env30191[5] = void 0;
env30191[0] = c26612_0.directoryChannelId;
env30191[1] = c26612_0.directoryGuildName;
env30191[2] = c26612_0.guild;
env30191[3] = c26612_0.description;
env30191[4] = c26612_0.category;
env30191[5] = c26612_0.onClose;
await void 0;
await addDirectoryGuildEntry(env30191[0], env30191[2].id, env30191[3], env30191[4]);
(0, env30191[5])();
AlertActionCreators.openLazy({
importer: $mk115621(c26612_1)
});
}
@@ -0,0 +1,279 @@
// Metro module 11759 (f11760).
import { useRef, useEffect, useMemo } from "react";
import { Image as Image2, SectionList, View, StyleSheet } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import ReadStateStore from "../../../../stores/ReadStateStore";
import GuildDirectoryStore from "../../GuildDirectoryStore";
import { DirectoryEntryCategories } from "../../GuildDirectoryConstants";
import { DirectoryChannelScrollBehavior, GUILD_DIRECTORY_BASE_HEADER_HEIGHT, GUILD_DIRECTORY_PROGRESS_BAR_HEIGHT } from "../GuildDirectoryConstants";
import { AnalyticEvents, AnalyticsObjectTypes, AnalyticsObjects, GuildFeatures } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { getNextHubProgressStep, useHubProgressBarCompletedSteps } from "../../../hub/HubProgressBarUtils";
import { RowType, generateDirectoryRows } from "../GuildDirectoryRowGenerator";
import GuildDirectoryRow from "./GuildDirectoryRow";
import GuildDirectoryPlaceholderRow from "./GuildDirectoryPlaceholderRow";
import { Text } from "../../../../design/components/Text/native/Text";
import * as _Module11762 from "../../../../_bundle/Module11762";
import { intl, t } from "../../../../intl/index.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { MagnifyingGlassIcon } from "../../../../design/components/Icon/native/redesign/generated/MagnifyingGlassIcon";
import { TTIFirstContentfulPaint } from "../../../tti_analytics/native/TTIFirstContentfulPaint";
import HubProgressHeader from "../../../hub/native/components/progress_bar/HubProgressHeader";
import { useCanCreateOrAddGuildInDirectory } from "../../useCanManageGuildDirectoryEntry";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import GuildDirectoryAddModalActionCreators from "./GuildDirectoryAddModalActionCreators";
import { PlusMediumIcon } from "../../../../design/components/Icon/native/redesign/generated/PlusMediumIcon";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { trackAppUIViewed } from "../../../tti_analytics/native/TTIAnalyticsUtils";
import TTITracker from "../../../tti_analytics/TTITracker";
import { ack } from "../../../../actions/ReadStateActionCreators";
import { useLocation, useHistory } from "../../../../_bundle/Module4017";
import { fetchDirectoryEntries, fetchDirectoryCounts } from "../../GuildDirectoryActionCreators";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import GuildDirectoryEmpty from "./GuildDirectoryEmpty";
import GuildDirectorySearchModalActionCreators from "./GuildDirectorySearchModalActionCreators";
import GuildDirectoryCategorySelector from "./GuildDirectoryCategorySelector";
let c8056_22, useStyles, renderItem, GuildDirectoryHeaderRowItem, GuildDirectoryHeader, GuildDirectoryFooter;
const keyExtractor = function keyExtractor(a0, a1) {
return a0?.type === RowType.ENTRY ? a0.entry.guildId : `${a0?.type}${a1.toString()}`;
};
renderItem = function renderItem({ item }) {
const type = item?.type;
if (RowType.HEADER === type) {
return <GuildDirectoryHeaderRowItem>{item.header}</GuildDirectoryHeaderRowItem>;
}
if (RowType.ENTRY === type) {
return <GuildDirectoryRow entry={item.entry} />;
}
return <GuildDirectoryPlaceholderRow />;
};
GuildDirectoryHeaderRowItem = function GuildDirectoryHeaderRowItem(props) {
const children = props.children;
return <Text style={useStyles().categorySectionText} variant="text-md/semibold" color="mobile-text-heading-primary">{children}</Text>;
};
GuildDirectoryHeader = function GuildDirectoryHeader(props) {
const { guild: guild2, onPressSearch: onPressSearch2 } = props;
const styles = useStyles();
const r9 = guild2.features.has(GuildFeatures.HUB);
return <>
<View style={styles.headerWrapper}>
<Image2 source={_Module11762} style={styles.backgroundImage} />
<View style={styles.textWrapper}>
<Text style={styles.headerTitle} variant="heading-xl/extrabold" color="text-overlay-light">
{intl.string(t.IT7qoC)}
</Text>
<Text style={[styles.headerDescription]} variant="text-sm/medium" color="text-overlay-light">
{intl.string(t["5PoYts"])}
</Text>
<Button variant="primary-overlay" icon={<MagnifyingGlassIcon size="sm" color="text-strong" />} text={intl.string(t.nL2wKD)} onPress={onPressSearch2} />
<TTIFirstContentfulPaint label="hub_directory" />
</View>
</View>
{r9 ? <HubProgressHeader guild={guild2} onDirectoryPage /> : null}
</>;
};
GuildDirectoryFooter = function GuildDirectoryFooter(props) {
const { guild, channel, hideFooter } = props;
const styles = useStyles();
return useCanCreateOrAddGuildInDirectory(channel) ? hideFooter ? null : <PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.H9jxS1)} onPress={() => GuildDirectoryAddModalActionCreators.open({
directoryGuildName: guild.name,
directoryGuildId: guild.id,
directoryChannelId: channel.id
})}>
<View style={styles.footer}>
<View style={styles.addIcon}>
<PlusMediumIcon />
</View>
<Text variant="text-md/semibold" color="mobile-text-heading-primary">
{intl.string(t.H9jxS1)}
</Text>
</View>
</PressableOpacity> : null;
};
c8056_22 = Array(20).fill(null);
useStyles = createStyles({
border: {
height: StyleSheet.hairlineWidth,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
list: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
headerWrapper: {
overflow: "hidden",
height: GUILD_DIRECTORY_BASE_HEADER_HEIGHT
},
backgroundImage: {
resizeMode: "cover",
width: "100%"
},
textWrapper: {
position: "absolute",
bottom: 0,
left: 0,
right: 0,
padding: 16,
alignContent: "center"
},
headerTitle: {
textAlign: "center",
marginBottom: 8
},
headerDescription: {
lineHeight: 18,
textAlign: "center",
paddingHorizontal: 20,
marginBottom: 72
},
footer: {
flexDirection: "row",
padding: 16,
alignItems: "center"
},
addIcon: {
marginRight: 16,
height: 40,
width: 40,
alignItems: "center",
justifyContent: "center",
borderRadius: 20,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
categorySectionText: {
padding: 16,
paddingBottom: 4
}
});
export default function GuildDirectory(props) {
let stateFromStores, ref, GUILD_DIRECTORY_BASE_HEADER_HEIGHT2, currentCategoryId, directoryEntries, directoryIsFetching, allEntriesCount, categoryCounts, ref2, ref3, location2, history2;
const { channel: channel2, guildId } = props;
stateFromStores = void 0;
ref = void 0;
GUILD_DIRECTORY_BASE_HEADER_HEIGHT2 = void 0;
currentCategoryId = void 0;
directoryEntries = void 0;
directoryIsFetching = void 0;
allEntriesCount = void 0;
categoryCounts = void 0;
ref2 = void 0;
ref3 = void 0;
location2 = void 0;
history2 = void 0;
const handleTapCategory2 = function handleTapCategory() {
if (ref3.current >= GUILD_DIRECTORY_BASE_HEADER_HEIGHT2) {
ref.current = true;
}
};
const styles = useStyles();
stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
ref = useRef(null);
const bottom = useSafeAreaInsets_native().bottom;
GUILD_DIRECTORY_BASE_HEADER_HEIGHT2 = getNextHubProgressStep(useHubProgressBarCompletedSteps(stateFromStores)) == null ? GUILD_DIRECTORY_BASE_HEADER_HEIGHT : GUILD_DIRECTORY_PROGRESS_BAR_HEIGHT + GUILD_DIRECTORY_BASE_HEADER_HEIGHT;
const stateFromStoresObject = useStateFromStoresObject([GuildDirectoryStore], () => {
const currentCategoryId2 = GuildDirectoryStore.getCurrentCategoryId(channel2.id);
const directoryEntries2 = GuildDirectoryStore.getDirectoryEntries(channel2.id, currentCategoryId2 !== DirectoryEntryCategories.ALL ? currentCategoryId2 : null);
const directoryAllEntriesCount = GuildDirectoryStore.getDirectoryAllEntriesCount(channel2.id);
const directoryCategoryCounts = GuildDirectoryStore.getDirectoryCategoryCounts(channel2.id);
return {
currentCategoryId: currentCategoryId2,
directoryEntries: directoryEntries2,
directoryIsFetching: GuildDirectoryStore.isFetching() || currentCategoryId2 === null && directoryEntries2 == null,
allEntriesCount: directoryAllEntriesCount,
categoryCounts: directoryCategoryCounts
};
});
currentCategoryId = stateFromStoresObject.currentCategoryId;
directoryEntries = stateFromStoresObject.directoryEntries;
directoryIsFetching = stateFromStoresObject.directoryIsFetching;
allEntriesCount = stateFromStoresObject.allEntriesCount;
categoryCounts = stateFromStoresObject.categoryCounts;
useEffect(() => {
trackAppUIViewed();
const r7 = Object;
let r17 = directoryEntries;
if (directoryEntries == null) {
r17 = {};
}
TTITracker.recordRender(r7.keys(r17).length, !directoryIsFetching);
}, [directoryEntries, directoryIsFetching]);
useEffect(() => () => {
const r5 = ReadStateStore.lastMessageId(channel2.id);
if (r5 != null) {
ack(channel2.id, {
object: AnalyticsObjects.ACK_GUILD_DIRECTORY_CHANNEL_VIEWED,
objectType: AnalyticsObjectTypes.ACK_AUTOMATIC
}, true, true, r5);
}
}, [channel2.id]);
const memo = useMemo(() => directoryIsFetching ? c8056_22 : directoryEntries != null ? generateDirectoryRows(directoryIsFetching, Object.values(directoryEntries), currentCategoryId) : [], [directoryIsFetching, directoryEntries, currentCategoryId]);
ref2 = useRef(null);
ref3 = useRef(0);
location2 = useLocation();
history2 = useHistory();
useEffect(() => {
if (location2.state?.scrollBehavior === DirectoryChannelScrollBehavior.GUILD_LIST_TOP) {
const current = ref2.current;
if (current != null) {
current.scrollToLocation({
sectionIndex: 0,
itemIndex: 0,
animated: true,
viewOffset: 0
});
}
history2.replace({
state: {}
});
}
}, [location2, history2]);
useEffect(() => {
fetchDirectoryEntries(channel2.id);
fetchDirectoryCounts(channel2.id);
}, [channel2.id]);
useEffect(() => {
AnalyticsUtils.track(AnalyticEvents.GUILD_DIRECTORY_CHANNEL_VIEWED, {
directory_channel_id: channel2.id,
directory_guild_id: stateFromStores?.id,
primary_category_id: currentCategoryId
});
}, [stateFromStores?.id, channel2.id, currentCategoryId]);
useEffect(() => {
if (ref.current) {
const current = ref2.current;
if (current != null) {
current.scrollToLocation({
sectionIndex: 0,
itemIndex: 0,
animated: true,
viewOffset: 0
});
}
ref.current = null;
}
}, [memo]);
return stateFromStores == null ? null : !directoryIsFetching && allEntriesCount === 0 ? <View style={{
paddingBottom: bottom
}}>
<View style={styles.border} />
<GuildDirectoryEmpty guild={stateFromStores} channel={channel2} />
<TTIFirstContentfulPaint label="guild_directory_empty" />
</View> : <View>
<SectionList ref={ref2} onScroll={function onScroll(event) {
ref3.current = event.nativeEvent.contentOffset.y;
}} scrollEventThrottle={16} contentContainerStyle={{
paddingBottom: bottom
}} windowSize={10} ListHeaderComponent={<GuildDirectoryHeader guild={stateFromStores} onPressSearch={function onPressSearch() {
GuildDirectorySearchModalActionCreators.open({
channel: channel2
});
}} />} sections={[{
data: memo
}]} stickySectionHeadersEnabled style={styles.list} scrollIndicatorInsets={{
right: 1
}} keyExtractor={keyExtractor} renderItem={renderItem} renderSectionHeader={function renderSectionHeader() {
return <GuildDirectoryCategorySelector onCategorySelected={handleTapCategory2} channel={channel2} categoryCounts={categoryCounts} allEntriesCount={allEntriesCount} />;
}} ListFooterComponent={() => <GuildDirectoryFooter guild={stateFromStores} channel={channel2} hideFooter={false} />} />
</View>;
};
@@ -0,0 +1,42 @@
// Metro module 10074 (f10075).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Alert from "../../../../components_native/common/Alert";
import { intl, t } from "../../../../intl/index.native";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
guildIcon: {
marginBottom: 16,
borderRadius: Module712.radii.sm
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
container: {
alignItems: "center",
justifyContent: "center"
}
});
export default function GuildDirectoryAddAlert(props) {
const { onClose, guild, directoryGuildName } = props;
const styles = useStyles();
return <Alert confirmText={intl.string(t["X0WK+6"])} onConfirm={onClose}>
<View style={styles.container}>
<GuildIcon style={styles.guildIcon} guild={guild} size={GuildIconSizes.XLARGE} />
<Text style={styles.title} accessibilityRole="header" variant="text-lg/bold" color="mobile-text-heading-primary">
{intl.string(t.CueiPY)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t.R7Pqn5, {
guildName: directoryGuildName
})}
</Text>
</View>
</Alert>;
};
@@ -0,0 +1,67 @@
// Metro module 10061 (f10062).
import { GuildDirectoryCreate } from "../GuildDirectoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import { ImpressionNames } from "../../../../_bundle/Module503";
import { getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import GuildDirectoryAddModalActionCreators from "./GuildDirectoryAddModalActionCreators";
import GuildDirectoryCreateOrAdd from "./GuildDirectoryCreateOrAdd";
import GuildDirectoryCreateOrAddDescription from "./GuildDirectoryCreateOrAddDescription";
import GuildDirectoryTemplates from "./GuildDirectoryTemplates";
import CreateGuildContainer from "../../../create_guild/native/components/CreateGuildContainer";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import useInitialValue from "../../../../hooks/useInitialValue";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
safeArea: {
marginTop: NAV_BAR_HEIGHT,
flex: 1
}
});
export default function GuildDirectoryAddModal(props) {
let c17661_0 = props;
const initialValue = useInitialValue(() => {
const initialStack = [{
name: GuildDirectoryCreate.CREATE_OR_ADD,
params: {
...c17661_0
}
}];
const screens = {};
screens[GuildDirectoryCreate.CREATE_OR_ADD] = {
fullscreen: true,
impressionName: ImpressionNames.HUB_EXISTING_GUILD_CHOOSE,
headerLeft: getHeaderCloseButton(GuildDirectoryAddModalActionCreators.close),
headerTitle: () => null,
render: (a0) => <GuildDirectoryCreateOrAdd {...a0} />
};
screens[GuildDirectoryCreate.DESCRIPTION] = {
fullscreen: true,
impressionName: ImpressionNames.HUB_CREATE_GUILD_CUSTOMIZE,
headerTitle: () => null,
render: (a0) => <GuildDirectoryCreateOrAddDescription {...a0} />
};
screens[GuildDirectoryCreate.TEMPLATES] = {
fullscreen: true,
impressionName: ImpressionNames.HUB_CREATE_GUILD_TEMPLATE,
headerTitle: () => null,
render: (a0) => <GuildDirectoryTemplates {...a0} />
};
screens[GuildDirectoryCreate.CREATE] = {
headerTitle: () => null,
fullscreen: true,
impressionName: ImpressionNames.HUB_CREATE_GUILD_CUSTOMIZE,
render: (a0) => <CreateGuildContainer {...a0} />
};
return {
screens,
initialStack
};
});
return <Navigator screens={initialValue.screens} initialRouteStack={initialValue.initialStack} headerBackTitle={intl.string(t["13/7kX"])} />;
};
export function GuildDirectoryAddModalScreen(props) {
const children = props.children;
return <SafeAreaPaddingView top style={useStyles().safeArea}>{children}</SafeAreaPaddingView>;
}
@@ -0,0 +1,12 @@
// Metro module 10060 (f10061).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c6692_3 = "GUILD_DIRECTORY_ADD_MODAL_KEY";
const r15 = {
open: (a0) => {
ModalActionCreators.pushLazy(import("./GuildDirectoryAddModal"), a0, c6692_3);
},
close: () => {
ModalActionCreators.popWithKey(c6692_3);
}
};
export default r15;
@@ -0,0 +1,66 @@
// Metro module 11861 (f11862).
import { useState, useCallback, useMemo } from "react";
import { View } from "react-native";
import GuildDirectoryStore from "../../GuildDirectoryStore";
import { DirectoryEntryCategories, getHubCategories } from "../../GuildDirectoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import { useToken } from "../../../../design/tokens/native/useToken";
import Module689 from "../../../../_bundle/Module689";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { selectDirectoryCategory } from "../../GuildDirectoryActionCreators";
import { Tabs } from "../../../../design/components/Tabs/native/Tabs.native";
import TabsGradient_native from "../../../../design/components/Tabs/native/TabsGradient.native";
const useStyles = createStyles({
categoriesListWrapper: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
paddingTop: 12
}
});
export default function GuildDirectoryCategorySelector(props) {
let stateFromStores, memo;
const { channel, onCategorySelected, categoryCounts, allEntriesCount } = props;
stateFromStores = void 0;
memo = void 0;
const styles = useStyles();
const [pageWidth, setState] = useState(0);
const callback = useCallback((a0) => {
setState(a0.nativeEvent.layout.width);
}, []);
stateFromStores = useStateFromStores([GuildDirectoryStore], () => GuildDirectoryStore.getCurrentCategoryId(channel.id));
memo = useMemo(() => {
const id = channel.id;
return [{
value: DirectoryEntryCategories.ALL,
label: intl.string(t.hEAa2a),
idealSize: 70
}, ...getHubCategories(id)];
}, [channel.id]);
const segmentedControlState = useSegmentedControlState({
items: useMemo(() => memo.map((item) => ({
label: item.label,
id: String(item.value),
count: item.value === DirectoryEntryCategories.ALL ? allEntriesCount : categoryCounts == null ? void 0 : categoryCounts[item.value],
page: null
})), [memo, categoryCounts, allEntriesCount]),
defaultIndex: useMemo(() => {
const r5 = memo.findIndex((item) => item.value === stateFromStores);
return r5 !== -1 ? r5 : 0;
}, [memo, stateFromStores]),
onSetActiveIndex: (a0) => {
const value = memo[a0]?.value;
if (value !== stateFromStores) {
selectDirectoryCategory(channel.id, value);
onCategorySelected();
}
},
pageWidth
});
const token = useToken(Module712.colors.BACKGROUND_BASE_LOW);
return <View style={styles.categoriesListWrapper} onLayout={callback}>
<Tabs state={segmentedControlState} />
<TabsGradient_native state={segmentedControlState} colors={[token, Module689(token).alpha(0).hex()]} />
</View>;
};
@@ -0,0 +1,177 @@
// Metro module 10063 (f10064).
import * as Module19 from "react";
import { useRef, useEffect, useState, useMemo, useCallback } from "react";
import { ActivityIndicator, FlatList, View } from "react-native";
import GuildDirectoryStore from "../../GuildDirectoryStore";
import { GuildDirectoryCreate } from "../GuildDirectoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native";
import GuildIcon from "../../../guild/native/GuildIcon";
import GuildDirectoryMoreMenu from "./GuildDirectoryMoreMenu";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { SegmentedControl } from "../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useRefValue from "../../../../hooks/useRefValue";
import useAvailableAndAddedGuilds from "../../useAvailableAndAddedGuilds";
import { GuildDirectoryAddModalScreen } from "./GuildDirectoryAddModal";
let useStyles, Component, Component2, GuildDirectoryCreateOrAddFooter;
const GuildDirectoryCreateOrAddHeader = function GuildDirectoryCreateOrAddHeader(props) {
const { directoryGuildName, tabIndex, setTabIndex } = props;
const styles = useStyles();
const segmentedControlState = useSegmentedControlState({
pageWidth: 0,
defaultIndex: tabIndex,
onSetActiveIndex: setTabIndex,
items: [intl.string(t.FTe8HS), intl.string(t.epOumr)].map((item) => ({
id: item,
label: item,
page: null
}))
});
return <View style={styles.header}>
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.format(t["9SKJdF"], {
guildName: directoryGuildName
})}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.pYFZ9p)}
</Text>
<View style={styles.segmentedControl}>
<SegmentedControl state={segmentedControlState} />
</View>
</View>;
};
GuildDirectoryCreateOrAddFooter = function GuildDirectoryCreateOrAddFooter(props) {
const handleFooterPress = props.handleFooterPress;
const styles = useStyles();
return <View style={[styles.footerSafeAreaContainer, {
paddingBottom: useSafeAreaInsets_native().bottom
}]}>
<View style={styles.footerContainer}>
<Text style={styles.footerTitle} variant="heading-lg/semibold" color="mobile-text-heading-primary">
{intl.string(t.pgCZRP)}
</Text>
<Button variant="secondary" text={intl.string(t.WqJbLi)} onPress={handleFooterPress} />
</View>
</View>;
};
useStyles = createStyles({
loadingContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
container: {
flex: 1
},
guildIcon: {
borderRadius: Module712.radii.sm
},
header: {
padding: 16,
alignItems: "center",
justifyContent: "center"
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
footerSafeAreaContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
position: "absolute",
bottom: 0,
width: "100%"
},
footerContainer: {
paddingHorizontal: 16,
height: 110,
justifyContent: "center"
},
footerTitle: {
alignSelf: "center",
textAlign: "center",
marginBottom: 16
},
segmentedControl: {
paddingHorizontal: Module712.space.PX_12,
width: "100%",
marginTop: 18
}
});
Component = Module19.memo(function({ guild, directoryChannelId, start, end }) {
return <TableRow label={guild.name} icon={<GuildIcon style={useStyles().guildIcon} guild={guild} />} trailing={<GuildDirectoryMoreMenu entry={useStateFromStores([GuildDirectoryStore], () => GuildDirectoryStore.getDirectoryEntry(directoryChannelId, guild.id))} />} start={start} end={end} />;
});
Component2 = Module19.memo(function({ guild: guild2, handleItemPress: handleItemPress2, start, end }) {
return <TableRow onPress={() => handleItemPress2(guild2)} label={guild2.name} icon={<GuildIcon style={useStyles().guildIcon} guild={guild2} />} trailing={<TableRow.Arrow />} start={start} end={end} />;
});
export default function GuildDirectoryCreateOrAdd(props) {
let availableGuilds, addedGuilds, bottom, memo;
const current = props;
const styles = useStyles();
const navigation = useNavigation();
const ref = useRef(props);
const refValue = useRefValue(ref);
useEffect(() => {
ref.current = current;
});
const availableAndAddedGuilds = useAvailableAndAddedGuilds(refValue.directoryGuildId, refValue.directoryChannelId);
availableGuilds = availableAndAddedGuilds.availableGuilds;
addedGuilds = availableAndAddedGuilds.addedGuilds;
const loading = availableAndAddedGuilds.loading;
bottom = useSafeAreaInsets_native().bottom;
const [state, setState] = useState(0);
memo = useMemo(() => state === 0 ? availableGuilds : addedGuilds, [addedGuilds, availableGuilds, state]);
const callback = useCallback(() => {
navigation.push(GuildDirectoryCreate.TEMPLATES, {
directoryGuildName: ref.current.directoryGuildName,
onHubGuildInfoSet: (a0, a1, a2) => {
navigation.push(GuildDirectoryCreate.DESCRIPTION, {
createGuild: {
name: a0,
icon: a1,
template: a2
},
directoryChannelId: ref.current.directoryChannelId,
directoryGuildName: ref.current.directoryGuildName
});
}
});
}, [navigation]);
const callback2 = useCallback(({ item, index }) => {
const props = {
guild: item,
start: index === 0,
end: index === memo.length - 1
};
return state === 1 ? <Component {...props} directoryChannelId={ref.current.directoryChannelId} /> : <Component2 {...props} handleItemPress={function handleItemPress(a0) {
navigation.push(GuildDirectoryCreate.DESCRIPTION, {
guild: a0,
directoryChannelId: ref.current.directoryChannelId,
directoryGuildName: ref.current.directoryGuildName
});
}} />;
}, [memo.length, navigation, state]);
const callback3 = useCallback(() => <GuildDirectoryCreateOrAddHeader directoryGuildName={ref.current.directoryGuildName} tabIndex={state} setTabIndex={setState} />, [state]);
const memo2 = useMemo(() => ({
paddingHorizontal: 16,
paddingBottom: 110 + bottom + 8
}), [bottom]);
return loading ? <View style={styles.loadingContainer}>
<ActivityIndicator />
</View> : <GuildDirectoryAddModalScreen>
<View style={styles.container}>
<FlatList data={memo} ListHeaderComponent={callback3} renderItem={callback2} contentContainerStyle={memo2} />
<GuildDirectoryCreateOrAddFooter handleFooterPress={callback} />
</View>
</GuildDirectoryAddModalScreen>;
};
@@ -0,0 +1,99 @@
// Metro module 10071 (f10072).
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import CreateGuildActionCreators from "../../../create_guild/CreateGuildActionCreators";
import { fromGuild } from "../../../../utils/GuildRecordUtils";
import { onAddDirectoryGuildEntry } from "../GuildDirectoryUtils";
import GuildDirectoryAddModalActionCreators from "./GuildDirectoryAddModalActionCreators";
import { GuildDirectoryAddModalScreen } from "./GuildDirectoryAddModal";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import GuildDirectoryEditDescriptionTemplate from "./GuildDirectoryEditDescriptionTemplate";
const useStyles = createStyles({
container: {
flex: 1
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
header: {
alignItems: "center",
justifyContent: "center",
padding: 16
}
});
export default function GuildDirectoryCreateOrAddDescription(props) {
const { directoryChannelId, directoryGuildName, guild, createGuild } = props;
let _onSubmit2 = function _onSubmit() {
const r9 = async (c30189_0, c30189_1) => {
let c30189_3;
let c31521_0, c31521_1, c31521_2;
L23: {
L13: {
L21: {
c30189_3 = void 0;
c31521_0 = c30189_0;
c31521_1 = c30189_1;
c31521_2 = void 0;
if (createGuild != null) {
const { name, icon, template } = createGuild;
if (template == null) {
break L23;
}
c31521_2 = await CreateGuildActionCreators.createGuildFromTemplate(name, icon, template);
guild = fromGuild(c31521_2);
if (guild != null) {
await onAddDirectoryGuildEntry({
directoryChannelId,
directoryGuildName,
guild,
description: c31521_0,
category: c31521_1,
onClose: GuildDirectoryAddModalActionCreators.close
});
break L13;
}
break L21;
}
if (guild != null) {
await onAddDirectoryGuildEntry({
directoryChannelId,
directoryGuildName,
guild,
description: c31521_0,
category: c31521_1,
onClose: GuildDirectoryAddModalActionCreators.close
});
break L13;
}
return void 0;
}
return void 0;
}
return void 0;
}
};
_onSubmit2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
return <GuildDirectoryAddModalScreen>
<ScrollView style={styles.container} keyboardShouldPersistTaps="handled">
<View style={styles.header}>
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t["5bQcoa"])}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.Ie60Wc)}
</Text>
</View>
<GuildDirectoryEditDescriptionTemplate onSubmit={function onSubmit(event, a1) {
return _onSubmit2.apply(this, arguments);
}} buttonLabel={intl.string(t.H9jxS1)} directoryChannelId={directoryChannelId} />
</ScrollView>
</GuildDirectoryAddModalScreen>;
};
@@ -0,0 +1,71 @@
// Metro module 10067 (f10068).
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import { updateDirectoryEntry } from "../../GuildDirectoryActionCreators";
import GuildDirectoryEditDescriptionModalActionCreators from "./GuildDirectoryEditDescriptionModalActionCreators";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import GuildDirectoryEditDescriptionTemplate from "./GuildDirectoryEditDescriptionTemplate";
import { getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
let useStyles, initialRouteName;
const GuildDirectoryEditDescription = function GuildDirectoryEditDescription(props) {
const entry = props.entry;
let _onSubmit2 = function _onSubmit() {
const r9 = async (c30180_0, c30180_1) => {
let c30180_2;
c30180_2 = void 0;
await updateDirectoryEntry(entry.channelId, entry.guildId, c30180_0, c30180_1);
GuildDirectoryEditDescriptionModalActionCreators.close();
};
_onSubmit2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
return <SafeAreaPaddingView top style={styles.safeArea}>
<ScrollView style={styles.container} keyboardShouldPersistTaps="handled">
<View style={styles.header}>
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.format(t.w9tsNk, {
guildName: entry.name
})}
</Text>
</View>
<GuildDirectoryEditDescriptionTemplate onSubmit={function onSubmit(event, a1) {
return _onSubmit2.apply(this, arguments);
}} buttonLabel={intl.string(t["R3BPH+"])} entry={entry} directoryChannelId={entry.channelId} />
</ScrollView>
</SafeAreaPaddingView>;
};
useStyles = createStyles({
safeArea: {
marginTop: NAV_BAR_HEIGHT,
flex: 1
},
container: {
flex: 1
},
title: {
marginBottom: 8,
textAlign: "center"
},
header: {
alignItems: "center",
justifyContent: "center",
padding: 16
}
});
initialRouteName = "EDIT_DESCRIPTION";
export default function GuildDirectoryEditDescriptionModal(props) {
let c17669_0 = props;
const screens = {};
screens[initialRouteName] = {
fullscreen: true,
headerLeft: getHeaderCloseButton(GuildDirectoryEditDescriptionModalActionCreators.close),
headerTitle: () => null,
render: () => <GuildDirectoryEditDescription {...c17669_0} />
};
return <Navigator screens={screens} initialRouteName={initialRouteName} />;
};
@@ -0,0 +1,12 @@
// Metro module 10066 (f10067).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c6697_3 = "GUILD_DIRECTORY_EDIT_DESCRIPTION_MODAL_KEY";
const r15 = {
open: (a0) => {
ModalActionCreators.pushLazy(import("./GuildDirectoryEditDescriptionModal"), a0, c6697_3);
},
close: () => {
ModalActionCreators.popWithKey(c6697_3);
}
};
export default r15;
@@ -0,0 +1,119 @@
// Metro module 10069 (f10070).
import { useState } from "react";
import { Keyboard, View } from "react-native";
import GuildDirectoryStore from "../../GuildDirectoryStore";
import { DirectoryEntryCategories, getHubCategories } from "../../GuildDirectoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import APIError from "../../../../errors/APIError";
import { TextArea } from "../../../../design/components/TextInput/native/TextArea.native";
import { intl, t } from "../../../../intl/index.native";
import { TableRadioGroup } from "../../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../../design/components/TableRow/native/TableRadioRow.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
marginHorizontal: 16,
gap: 24
}
});
export default function GuildDirectoryEditDescriptionTemplate(props) {
let state, setState, state2, setState2, setState3;
const { onSubmit, buttonLabel, entry, directoryChannelId } = props;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
setState3 = void 0;
let _handleSubmit2 = function _handleSubmit() {
const r9 = async () => {
let c30187_2;
let c30187_3 = 0;
let c31520_0;
L10: {
try {
setState2(true);
c30187_3 = 2;
await onSubmit(state2, state);
c30187_3 = 1;
c30187_3 = 0;
(0, setState2)(false);
} catch ($e) {
const r26 = $e;
let r7 = r26;
c30187_2 = r26;
let r27 = c30187_3;
if (r27 !== 0) {
while (true) {
if (r27 === 1) {
try {
const r79 = c30187_2;
c30187_3 = 0;
(0, setState2)(false);
throw r79;
} catch (r77) {
r7 = r77;
c30187_2 = r77;
r27 = c30187_3;
if (r27 === 0) {
break;
}
}
} else {
try {
const r60 = c30187_2;
c30187_3 = 1;
c31520_0 = r60;
setState3(new APIError(c31520_0));
c30187_3 = 0;
(0, setState2)(false);
break L10;
} catch (r57) {
r7 = r57;
c30187_2 = r57;
r27 = c30187_3;
if (r27 === 0) {
break;
}
}
}
}
}
throw r7;
}
}
};
_handleSubmit2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const hubCategories = getHubCategories(directoryChannelId);
const stateFromStores = useStateFromStores([GuildDirectoryStore], () => GuildDirectoryStore.getCurrentCategoryId(directoryChannelId));
let r35 = entry?.primaryCategoryId;
if (r35 == null) {
r35 = stateFromStores;
}
[state, setState] = useState(r35);
let r42 = entry?.description;
if (r42 == null) {
r42 = "";
}
let onChange2;
[state2, onChange2] = useState(r42);
let loading;
[loading, setState2] = useState(false);
let state3;
[state3, setState3] = useState(null);
return <View style={styles.container}>
<TextArea label={intl.string(t.FFFAGt)} description={intl.string(t["/zbXqm"])} value={state2} onChange={onChange2} placeholder={intl.string(t.VzuITC)} maxLength={200} status={state3 != null ? "error" : "default"} errorMessage={state3 == null ? void 0 : state3.getAnyErrorMessage()} submitBehavior="blurAndSubmit" returnKeyType="done" />
<TableRadioGroup title={intl.string(t.Olo8FB)} defaultValue={state} onChange={(event) => {
Keyboard.dismiss();
setState(event);
}} hasIcons={false}>
{hubCategories.map((hubCategory) => <TableRadioRow key={hubCategory.value} label={hubCategory.label} value={hubCategory.value} />)}
</TableRadioGroup>
<Button disabled={state2.length === 0 || state === DirectoryEntryCategories.ALL} onPress={function handleSubmit() {
return _handleSubmit2.apply(this, arguments);
}} loading={loading} text={buttonLabel} size="lg" />
</View>;
};
@@ -0,0 +1,72 @@
// Metro module 11857 (f11858).
import { Image as Image2, ScrollView } from "react-native";
import GuildChannelStore from "../../../../stores/GuildChannelStore";
import { InstantInviteSources, Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useCanCreateOrAddGuildInDirectory } from "../../useCanManageGuildDirectoryEntry";
import Module11858 from "../../../../_bundle/Module11858";
import { LegacyText } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { FormCTA } from "../../../../design/void/Form/native/index";
import GuildDirectoryAddModalActionCreators from "./GuildDirectoryAddModalActionCreators";
import Module11859 from "../../../../_bundle/Module11859";
import { handleOpenInviteActionsheet } from "../../../instant_invite/native/InstantInviteUtils";
import Module11860 from "../../../../_bundle/Module11860";
const useStyles = createStyles({
container: {
flex: 1,
justifyContent: "flex-end",
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
header: {
marginBottom: 16,
alignSelf: "center"
},
title: {
fontFamily: Fonts.PRIMARY_BOLD,
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
fontSize: 24,
textAlign: "center",
marginBottom: 8,
alignSelf: "center"
},
description: {
textAlign: "center",
alignSelf: "center",
marginBottom: 24
},
ctaContainer: {
marginBottom: 8
}
});
export default function GuildDirectoryEmpty(props) {
const { guild, channel } = props;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const stateFromStores = useStateFromStores([GuildChannelStore], () => GuildChannelStore.getChannels(guild.id));
const canCreateOrAddGuildInDirectory = useCanCreateOrAddGuildInDirectory(channel);
return <ScrollView contentContainerStyle={[styles.container, {
paddingBottom: bottom + 16
}]}>
<Image2 source={Module11858} style={styles.header} />
<LegacyText style={styles.title} accessibilityRole="header">
{intl.format(t.vyvrpC, {
guildName: guild.name
})}
</LegacyText>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.WypE0i)}
</Text>
{canCreateOrAddGuildInDirectory ? <FormCTA style={styles.ctaContainer} onPress={() => GuildDirectoryAddModalActionCreators.open({
directoryGuildName: guild.name,
directoryGuildId: guild.id,
directoryChannelId: channel.id
})} iconSource={Module11859} title={intl.string(t.hyK15i)} /> : null}
<FormCTA style={styles.ctaContainer} onPress={() => handleOpenInviteActionsheet(guild, channel.id, stateFromStores, InstantInviteSources.HUB_EMPTY_STATE)} iconSource={Module11860} title={intl.string(t.L4bwJ9)} />
</ScrollView>;
};
@@ -0,0 +1,72 @@
// Metro module 10065 (f10066).
import useCanManageGuildDirectoryEntry from "../../useCanManageGuildDirectoryEntry";
import GuildDirectoryEditDescriptionModalActionCreators from "./GuildDirectoryEditDescriptionModalActionCreators";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import { intl, t } from "../../../../intl/index.native";
import { removeDirectoryGuildEntry } from "../../GuildDirectoryActionCreators";
import { ButtonColors } from "../../../../design/void/native";
import { showReportModalForGuildDirectoryEntry } from "../../../in_app_reports/ReportModals";
import { PencilIcon } from "../../../../design/components/Icon/native/redesign/generated/PencilIcon";
import { TrashIcon } from "../../../../design/components/Icon/native/redesign/generated/TrashIcon";
import { FlagIcon } from "../../../../design/components/Icon/native/redesign/generated/FlagIcon";
import { ContextMenu } from "../../../../design/components/ContextMenu/native/ContextMenu.native";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import { MoreHorizontalIcon } from "../../../../design/components/Icon/native/redesign/generated/MoreHorizontalIcon";
import Module712 from "../../../../_bundle/Module712";
export default function GuildDirectoryMoreMenu(props) {
const entry = props.entry;
const canManageGuildDirectoryEntry = useCanManageGuildDirectoryEntry(entry);
const { isEntryAdmin, canEdit, canRemove } = canManageGuildDirectoryEntry;
const items = [];
if (canEdit) {
items.push({
label: intl.string(t.XnuOvN),
IconComponent: PencilIcon,
action: function handleEdit() {
GuildDirectoryEditDescriptionModalActionCreators.open({
entry
});
}
});
}
if (canRemove) {
items.push({
label: intl.string(t.KUxYWH),
IconComponent: TrashIcon,
variant: "destructive",
action: function handleRemove() {
AlertActionCreators.show({
title: intl.string(t.KUxYWH),
body: intl.formatToPlainString(t["/5y0uV"], {
guildName: entry.name
}),
onConfirm: () => {
removeDirectoryGuildEntry(entry.channelId, entry.guildId);
},
confirmColor: ButtonColors.RED,
confirmText: intl.string(t.N86XcP),
cancelText: intl.string(t["ETE/oC"]),
onCancel: () => {
AlertActionCreators.close();
}
});
}
});
}
if (!isEntryAdmin) {
items.push({
label: intl.string(t.Aen9eh),
IconComponent: FlagIcon,
variant: "destructive",
action: function handleReport() {
showReportModalForGuildDirectoryEntry(entry);
}
});
}
return items.length !== 0 ? <ContextMenu items={items}>
{(a0) => {
const { ref, ...rest } = a0;
return <IconButton ref={a0.ref} {...rest} size="sm" variant="secondary" accessibilityLabel={intl.string(t.PdRCRg)} icon={<MoreHorizontalIcon size="sm" color={Module712.colors.WHITE} />} />;
}}
</ContextMenu> : null;
};
@@ -0,0 +1,175 @@
// Metro module 11756 (f11757).
import { useState, useRef } from "react";
import { ScrollView, View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import { GuildPrompts } from "../../../guild/Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { NAV_BAR_HEIGHT } from "../../../../design/components/Navigator/native/NavigatorConstants.native";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
import { updateGuildSelfMember } from "../../../guild_member/GuildMemberActionCreators";
import { APIError } from "../../../../errors/index";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
import { ClearButtonVisibility } from "../../../../design/void/native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import GuildPromptsActionCreators from "../../../guild/GuildPromptsActionCreators";
import GuildDirectoryNicknameUpsellModalActionCreators from "./GuildDirectoryNicknameUpsellModalActionCreators";
import { getHeaderCloseButton } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
import useInitialValue from "../../../../hooks/useInitialValue";
let useStyles, initialRouteName;
const GuildDirectoryNicknameUpsell = function GuildDirectoryNicknameUpsell(props) {
let setState, state, ref;
const { guildId, handleClose: handleClose2 } = props;
setState = void 0;
state = void 0;
ref = void 0;
let _handleSubmit2 = function _handleSubmit() {
const r9 = async () => {
let c30438_2;
let c30438_3 = 0;
let c31640_0;
L10: {
try {
setState(null);
const r17 = {
nick: state
};
c30438_3 = 1;
await updateGuildSelfMember(guildId, r17);
(0, handleClose2)();
c30438_3 = 0;
} catch ($e) {
const r26 = $e;
let r7 = r26;
c30438_2 = r26;
if (c30438_3 !== 0) {
while (true) {
try {
const r65 = c30438_2;
c30438_3 = 0;
c31640_0 = r65;
setState(new APIError(c31640_0));
break L10;
} catch (r61) {
r7 = r61;
c30438_2 = r61;
if (c30438_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
};
_handleSubmit2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
let state2;
[state2, setState] = useState(null);
let onChangeText;
[state, onChangeText] = useState("");
ref = useRef(null);
return <ScrollView ref={ref} contentContainerStyle={[styles.container, {
paddingBottom: insets.bottom + Module712.space.PX_16,
paddingTop: insets.top
}]}>
<GuildIcon style={styles.guildIcon} guild={stateFromStores} size={GuildIconSizes.XLARGE} />
<View style={styles.header}>
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.format(t["d+6kzl"], {
guildName: stateFromStores?.name
})}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.b3L8yx)}
</Text>
</View>
<FreeFormInputGroup label={intl.string(t.ilDlmW)} placeholder={intl.string(t.RfWvWI)} value={state} onChangeText={onChangeText} style={styles.input} textStyle={styles.redesignTextInput} clearButtonVisibility={ClearButtonVisibility.WITH_CONTENT} error={state2 == null ? void 0 : state2.getFirstFieldErrorMessage("name")} onFocus={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} onBlur={() => {
setTimeout(() => {
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}, 100);
}} />
<View style={styles.redesignGrowSpacing} />
<View style={styles.redesignButtonContainer}>
<Button size="lg" text={intl.string(t.Np4yXU)} onPress={function handleSubmit() {
return _handleSubmit2.apply(this, arguments);
}} />
</View>
</ScrollView>;
};
useStyles = createStyles({
container: {
flex: 1,
flexGrow: 2,
marginTop: NAV_BAR_HEIGHT
},
guildIcon: {
alignSelf: "center",
marginTop: 16
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
header: {
alignItems: "center",
justifyContent: "center",
padding: 16
},
input: {
marginHorizontal: 16
},
redesignTextInput: {
borderRadius: Module712.radii.lg
},
redesignGrowSpacing: {
flexGrow: 2,
minHeight: Module712.space.PX_24
},
redesignButtonContainer: {
paddingHorizontal: Module712.space.PX_16
}
});
initialRouteName = "UPSELL_SCREEN_KEY";
export default function GuildDirectoryNicknameUpsellModal(props) {
let c19132_0 = props;
return <Navigator screens={useInitialValue(() => {
const { guildId: guildId2, onHide } = c19132_0;
const handleClose3 = function handleClose() {
GuildPromptsActionCreators.viewPrompt(GuildPrompts.REAL_NAME_PROMPT, guildId2);
onHide();
GuildDirectoryNicknameUpsellModalActionCreators.close();
};
const r10 = {};
r10[initialRouteName] = {
fullscreen: true,
headerLeft: getHeaderCloseButton(handleClose3),
headerTitle: () => null,
render: () => <GuildDirectoryNicknameUpsell guildId={guildId2} handleClose={handleClose3} />
};
return r10;
})} initialRouteName={initialRouteName} />;
};
@@ -0,0 +1,12 @@
// Metro module 11755 (f11756).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c8053_3 = "GUILD_DIRECTORY_NICKNAME_UPSELL_MODAL_KEY";
const r15 = {
open: (a0) => {
ModalActionCreators.pushLazy(import("./GuildDirectoryNicknameUpsellModal"), a0, c8053_3);
},
close: () => {
ModalActionCreators.popWithKey(c8053_3);
}
};
export default r15;
@@ -0,0 +1,50 @@
// Metro module 10097 (f10098).
import { memo } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { DARK_PRIMARY_500_LIGHT_PRIMARY_230 } from "../../../../design/migrations/native/LegacyTokens";
import getChatPlaceholderRowWidth from "../../../chat/native/placeholder/getChatPlaceholderRowWidth";
const useStyles = createStyles({
row: {
flexDirection: "row",
padding: 16
},
rowInner: {
flex: 1
},
placeholderAvatar: {
width: 40,
height: 40,
borderRadius: Module712.radii.sm,
overflow: "hidden",
marginRight: 16,
backgroundColor: DARK_PRIMARY_500_LIGHT_PRIMARY_230
},
placeholderText: {
height: 15,
borderRadius: 5,
backgroundColor: DARK_PRIMARY_500_LIGHT_PRIMARY_230
},
placeholderBody: {
width: "100%",
marginTop: 10
}
});
const r44 = memo(() => {
const styles = useStyles();
const r12 = Math.floor(2 * Math.random()) + 2;
let c17682_1 = Math.floor(10 * Math.random());
return <View style={styles.row}>
<View style={styles.placeholderAvatar} />
<View style={styles.rowInner}>
<View style={[styles.placeholderText, {
width: `${Math.floor(50 * Math.random()) + 10}%`
}]} />
{new Array(r12).fill(void 0).map((item, index) => <View key={index} style={[styles.placeholderText, styles.placeholderBody, {
width: `${getChatPlaceholderRowWidth(c17682_1 + index)}%`
}]} />)}
</View>
</View>;
});
export default r44;
@@ -0,0 +1,200 @@
// Metro module 10094 (f10095).
import { memo, useState } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import { JoinGuildSources } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { transitionToGuild } from "../../../routing/transitionToGuild.native";
import GuildActionCreators from "../../../../actions/GuildActionCreators";
import { setHubProgressActionComplete } from "../../../hub/HubProgressActionCreators";
import { HubProgressStep } from "../../../../_bundle/Module1306";
import AvatarUtils from "../../../../utils/AvatarUtils";
import { intl, t } from "../../../../intl/index.native";
import { Card } from "../../../../design/components/Card/native/Card.native";
import GuildIcon from "../../../guild/native/GuildIcon";
import { fromGuildDirectoryEntry } from "../../../../utils/GuildRecordUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import GuildDirectoryMoreMenu from "./GuildDirectoryMoreMenu";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
flexDirection: "row",
padding: 16,
marginVertical: 6,
marginHorizontal: 8
},
guildInfoContainer: {
flexDirection: "column",
flex: 1
},
guildIcon: {
borderRadius: Module712.radii.sm,
marginRight: 16
},
guildWrapper: {
flex: 1
},
guildDescription: {
flexShrink: 1,
marginBottom: 8
},
memberInfo: {
flexDirection: "row",
alignItems: "center",
marginBottom: 8
},
dotOnline: {
width: 8,
height: 8,
borderRadius: Module712.radii.sm,
marginRight: 4,
backgroundColor: Module712.unsafe_rawColors.GREEN_360
},
dotOffline: {
width: 8,
height: 8,
borderRadius: Module712.radii.sm,
marginRight: 4,
marginLeft: 16,
backgroundColor: Module712.unsafe_rawColors.PRIMARY_400
},
headerContainer: {
flexDirection: "row",
marginBottom: 4,
justifyContent: "space-between"
},
titleContainer: {
flexDirection: "row",
flex: 1
},
flex: {
flex: 1,
height: 4
}
});
const r72 = memo(function GuildDirectoryRow(props) {
let c17679_1, setState;
const entry = props.entry;
c17679_1 = void 0;
setState = void 0;
let _handleJoinGuild2 = function _handleJoinGuild() {
const r9 = async () => {
let c30194_2;
let c30194_3 = 0;
let c31522_0;
L17: {
L16: {
try {
c31522_0 = void 0;
setState(true);
c30194_3 = 1;
if (c17679_1) {
transitionToGuild(entry.guildId);
c30194_3 = 0;
setState(false);
break L17;
}
await GuildActionCreators.joinGuild(entry.guildId, {
source: JoinGuildSources.DIRECTORY_ENTRY
});
c31522_0 = ChannelStore.getChannel(entry.channelId);
if (c31522_0 == null) {
c30194_3 = 0;
(0, setState)(false);
break L16;
}
const r92 = c31522_0;
setHubProgressActionComplete(r92 == null ? void 0 : r92.getGuildId(), HubProgressStep.JOIN_GUILD);
c30194_3 = 0;
(0, setState)(false);
} catch ($e) {
const r28 = $e;
let r7 = r28;
c30194_2 = r28;
if (c30194_3 !== 0) {
while (true) {
try {
const r116 = c30194_2;
c30194_3 = 0;
(0, setState)(false);
throw r116;
} catch (r113) {
r7 = r113;
c30194_2 = r113;
if (c30194_3 === 0) {
break;
}
}
}
}
throw r7;
}
return void 0;
}
return void 0;
}
};
_handleJoinGuild2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const { name, description, approximateMemberCount, approximatePresenceCount } = entry;
const r4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(entry.guildId)) != null;
c17679_1 = r4;
let loading;
[loading, setState] = useState(false);
let icon = AvatarUtils.getGuildIconURL({
id: entry.guildId,
icon: entry.icon,
size: 40
});
if (icon == null) {
icon = void 0;
}
let text = intl.string(t.VJlc0S);
if (r4) {
text = intl.string(t.cqWE2Z);
}
return <Card style={styles.container}>
<View style={styles.guildWrapper}>
<View style={styles.headerContainer}>
<View style={styles.titleContainer}>
<GuildIcon style={styles.guildIcon} icon={icon} guild={icon == null ? fromGuildDirectoryEntry(entry) : void 0} selected={false} />
<View style={styles.guildInfoContainer}>
<Text variant="text-md/semibold" color="mobile-text-heading-primary" lineClamp={1}>{name}</Text>
<View style={styles.memberInfo}>
{approximatePresenceCount != null ? <>
<View style={styles.dotOnline} />
<Text variant="text-xs/medium" color="text-default">
{intl.format(t["LC+S+m"], {
membersOnline: approximatePresenceCount
})}
</Text>
</> : null}
{approximateMemberCount != null ? <>
<View style={styles.dotOffline} />
<Text variant="text-xs/medium" color="text-default">
{intl.format(t.zRl6XR, {
count: approximateMemberCount
})}
</Text>
</> : null}
</View>
</View>
</View>
<View>
<GuildDirectoryMoreMenu entry={entry} />
</View>
</View>
{description != null && description !== "" && <Text lineClamp={3} style={styles.guildDescription} variant="text-sm/medium" color="text-default">{description}</Text>}
<View style={styles.flex} />
<Button loading={loading} onPress={function handleJoinGuild() {
return _handleJoinGuild2.apply(this, arguments);
}} variant={r4 ? "secondary" : "active"} text={text} />
</View>
</Card>;
});
export default r72;
@@ -0,0 +1,148 @@
// Metro module 10054 (f10055).
import { useState, useMemo } from "react";
import { FlatList, Image as Image2, View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import GuildDirectorySearchStore from "../../GuildDirectorySearchStore";
import { AnalyticEvents, Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Module10058 from "../../../../_bundle/Module10058";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { LegacyText } from "../../../../design/void/native";
import { useStateFromStores, useStateFromStoresObject } from "../../../../_bundle/Module589";
import { useCanCreateOrAddGuildInDirectory } from "../../useCanManageGuildDirectoryEntry";
import GuildDirectoryAddModalActionCreators from "./GuildDirectoryAddModalActionCreators";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import GuildDirectoryRow from "./GuildDirectoryRow";
import GuildDirectoryPlaceholderRow from "./GuildDirectoryPlaceholderRow";
import { FauxHeader } from "../../../../design/components/Navigator/native/NavigatorHeader.native";
import SearchBarNav from "../../../main_tabs_v2/native/shared_components/SearchBarNav";
import { clearDirectorySearch, searchDirectoryEntries } from "../../GuildDirectoryActionCreators";
import GuildDirectorySearchModalActionCreators from "./GuildDirectorySearchModalActionCreators";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
let useStyles, EmptyState, c6687_17;
const DefaultState = function DefaultState() {
const styles = useStyles();
return <View style={styles.emptyWrapper}>
<Image2 style={styles.emptyStateImage} source={Module10058} />
<Text style={styles.emptyStateText} variant="text-sm/medium" color="text-default">
{intl.format(t.aYLd8O, {
protipHook: (a0) => <LegacyText key="protip" style={styles.proTip}>
{a0}
</LegacyText>
})}
</Text>
</View>;
};
EmptyState = function EmptyState(props) {
const channel = props.channel;
const styles2 = useStyles();
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(channel.getGuildId()));
const r32 = useCanCreateOrAddGuildInDirectory(channel) ? intl.format(t.ZxNVMy, {
addServerHook: () => {
GuildDirectoryAddModalActionCreators.open({
directoryGuildName: stateFromStores.name,
directoryGuildId: stateFromStores.id,
directoryChannelId: channel.id
});
}
}) : intl.string(t.vYyEnv);
return <View style={styles2.emptyWrapper}>
<Image2 style={styles2.emptyStateImage} source={Module10058} />
<Text style={styles2.emptyStateTitle} variant="text-sm/semibold" color="mobile-text-heading-primary">
{intl.string(t["6HXiuE"])}
</Text>
<Text style={styles2.emptyStateText} variant="text-sm/medium" color="text-default">{r32}</Text>
</View>;
};
useStyles = createStyles({
flex: {
flex: 1,
height: "100%"
},
fauxHeader: {
paddingHorizontal: 0
},
scrollContainer: {
flex: 1,
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
emptyWrapper: {
flex: 1,
alignItems: "center",
justifyContent: "center",
paddingHorizontal: 16
},
emptyStateImage: {
marginBottom: 24
},
emptyStateText: {
textAlign: "center"
},
emptyStateTitle: {
marginBottom: 4,
textAlign: "center"
},
proTip: {
fontFamily: Fonts.PRIMARY_BOLD,
color: Module712.unsafe_rawColors.GREEN_360,
textTransform: "uppercase"
}
});
c6687_17 = Array(20).fill(null);
export default function GuildDirectorySearch(props) {
let searchFetching, searchResults;
const channel2 = props.channel;
searchFetching = void 0;
searchResults = void 0;
const styles2 = useStyles();
const [state2, setState] = useState(false);
const [state, onChange] = useState("");
const stateFromStoresObject = useStateFromStoresObject([GuildDirectorySearchStore], () => {
const searchState = GuildDirectorySearchStore.getSearchState(channel2.id);
return {
searchFetching: searchState.fetching,
searchResults: GuildDirectorySearchStore.getSearchResults(channel2.id, searchState.mostRecentQuery)
};
});
searchFetching = stateFromStoresObject.searchFetching;
searchResults = stateFromStoresObject.searchResults;
const memo = useMemo(() => searchFetching ? searchResults.concat(c6687_17) : searchResults, [searchResults, searchFetching]);
const bottom = useSafeAreaInsets_native().bottom;
let r45 = <DefaultState />;
if (state2) {
r45 = searchResults.length === 0 && !searchFetching ? <EmptyState channel={channel2} /> : <FlatList data={memo} renderItem={function renderItem({ item }) {
return item != null ? <GuildDirectoryRow entry={item} /> : <GuildDirectoryPlaceholderRow />;
}} keyExtractor={function keyExtractor(item, index) {
return item != null ? item.guildId : index.toString();
}} ListEmptyComponent={() => <EmptyState channel={channel2} />} scrollIndicatorInsets={{
right: 0
}} style={styles2.scrollContainer} contentContainerStyle={{
paddingBottom: bottom + 16
}} />;
}
return <View style={styles2.flex}>
<FauxHeader style={styles2.fauxHeader}>
<SearchBarNav placeholder={intl.string(t.nL2wKD)} onChange={onChange} onClose={() => {
clearDirectorySearch(channel2.id);
GuildDirectorySearchModalActionCreators.close();
}} onSubmitEditing={function onSubmitEditing() {
if (state.trim().length !== 0) {
const r16 = searchDirectoryEntries(channel2.id, state);
AnalyticsUtils.track(AnalyticEvents.GUILD_DIRECTORY_SEARCH, {
directory_channel_id: channel2.id,
directory_guild_id: channel2.getGuildId()
});
if (r16 != null) {
r16.then(() => setState(true));
} else {
setState(true);
}
}
}} />
</FauxHeader>
{r45}
</View>;
};
@@ -0,0 +1,18 @@
// Metro module 10053 (f10054).
import GuildDirectorySearch from "./GuildDirectorySearch";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
import useInitialValue from "../../../../hooks/useInitialValue";
const initialRouteName = "SEARCH_SCREEN_KEY";
export default function GuildDirectorySearchModal(props) {
let c17653_0 = props;
return <Navigator screens={useInitialValue(() => {
let c26603_0 = c17653_0;
const r5 = {};
r5[initialRouteName] = {
fullscreen: true,
headerShown: false,
render: () => <GuildDirectorySearch {...c26603_0} />
};
return r5;
})} initialRouteName={initialRouteName} />;
};
@@ -0,0 +1,14 @@
// Metro module 10052 (f10053).
import ModalActionCreators from "../../../../actions/ModalActionCreators";
let c6685_3 = "GUILD_DIRECTORY_SEARCH_MODAL_KEY";
const r15 = {
open: ({ channel }) => {
ModalActionCreators.pushLazy(import("./GuildDirectorySearchModal"), {
channel
}, c6685_3);
},
close: () => {
ModalActionCreators.popWithKey(c6685_3);
}
};
export default r15;
@@ -0,0 +1,101 @@
// Metro module 10075 (f10076).
import { useRef, useEffect, useCallback } from "react";
import { ScrollView, View } from "react-native";
import { HubGuildTemplateId, getHubGuildTemplatesMap } from "../../GuildDirectoryConstants";
import { GuildDirectoryCreate } from "../GuildDirectoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import ListSelectionItem from "../../../create_guild/native/components/ListSelectionItem";
import * as _native from "../../../../design/void/native";
import { GUILD_TEMPLATE_ICONS } from "../GuildDirectoryTemplatesIcons";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { GuildDirectoryAddModalScreen } from "./GuildDirectoryAddModal";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { TableRowGroup } from "../../../../design/components/TableRow/native/TableRowGroup.native";
import FreeFormLabel from "../../../../design/void/Form/native/FreeFormLabel";
let useStyles;
const GuildTemplatesItem = function GuildTemplatesItem(props) {
const { guildTemplate, onGuildTemplatePress } = props;
return <ListSelectionItem Icon={() => <_native.Icon source={GUILD_TEMPLATE_ICONS[guildTemplate.id]} disableColor style={{
width: 48,
height: 48
}} />} message={guildTemplate.label} onPress={() => onGuildTemplatePress(guildTemplate)} />;
};
useStyles = createStyles({
label: {
marginTop: 16,
marginLeft: 16,
marginBottom: 8
},
title: {
marginBottom: 8,
textAlign: "center"
},
description: {
textAlign: "center"
},
header: {
alignItems: "center",
justifyContent: "center",
padding: 16
},
templateGroup: {
marginHorizontal: 16
}
});
export default function GuildDirectoryTemplates(props) {
const current = props;
const styles = useStyles();
const ref = useRef(props);
const navigation = useNavigation();
const hubGuildTemplatesMap = getHubGuildTemplatesMap();
const bottom = useSafeAreaInsets_native().bottom;
useEffect(() => {
ref.current = current;
});
const callback = useCallback((a0) => {
navigation.push(GuildDirectoryCreate.CREATE, {
onHubGuildInfoSet: ref.current.onHubGuildInfoSet,
guildTemplate: a0
});
}, [navigation]);
return <GuildDirectoryAddModalScreen>
<ScrollView contentContainerStyle={{
paddingBottom: bottom + 16
}}>
<View style={styles.header}>
<Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.format(t.T7aLYT, {
guildName: props.directoryGuildName
})}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t["RA+St6"])}
</Text>
</View>
<View style={styles.templateGroup}>
<TableRowGroup hasIcons>
<GuildTemplatesItem guildTemplate={{
...hubGuildTemplatesMap[HubGuildTemplateId.CREATE],
label: intl.string(t.WqJbLi)
}} onGuildTemplatePress={callback} />
</TableRowGroup>
</View>
<FreeFormLabel style={styles.label}>
{intl.string(t.JGDkfg)}
</FreeFormLabel>
<View style={styles.templateGroup}>
<TableRowGroup hasIcons>
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_STUDY]} onGuildTemplatePress={callback} />
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_SCHOOL_CLUB]} onGuildTemplatePress={callback} />
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_CLASS]} onGuildTemplatePress={callback} />
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_SOCIAL]} onGuildTemplatePress={callback} />
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_MAJOR]} onGuildTemplatePress={callback} />
<GuildTemplatesItem guildTemplate={hubGuildTemplatesMap[HubGuildTemplateId.HUB_DORM]} onGuildTemplatePress={callback} />
</TableRowGroup>
</View>
</ScrollView>
</GuildDirectoryAddModalScreen>;
};
export { GuildTemplatesItem };
@@ -0,0 +1,41 @@
// Metro module 10070 (f10071).
import { useState, useMemo } from "react";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import SortedGuildStore from "../../stores/SortedGuildStore";
import GuildDirectoryStore from "./GuildDirectoryStore";
import { Permissions } from "../../Constants";
import { useStateFromStores, useStateFromStoresArray } from "../../_bundle/Module589";
import useMountEffect from "../../hooks/useMountEffect";
import { fetchGuildEntriesForIds } from "./GuildDirectoryActionCreators";
export default function useAvailableAndAddedGuilds(a0, c17671_1) {
let stateFromStoresArray;
const [loading, setState] = useState(false);
const stateFromStores = useStateFromStores([GuildDirectoryStore], () => GuildDirectoryStore.getAdminGuildEntryIds(c17671_1));
stateFromStoresArray = useStateFromStoresArray([SortedGuildStore, GuildStore, PermissionStore], () => {
const flattenedGuildIds = SortedGuildStore.getFlattenedGuildIds();
const r5 = [];
let c26610_0 = r5;
flattenedGuildIds.forEach((flattenedGuildId) => {
const guild = GuildStore.getGuild(flattenedGuildId);
if (guild != null && PermissionStore.can(Permissions.ADMINISTRATOR, guild) && guild.id !== a0) {
c26610_0.push(guild);
}
});
return r5;
}, [a0]);
useMountEffect(() => {
(async () => {
let c30188_0;
c30188_0 = void 0;
setState(true);
await fetchGuildEntriesForIds(c17671_1, stateFromStoresArray.map((item) => item.id));
(0, setState)(false);
})();
});
return {
availableGuilds: useMemo(() => stateFromStoresArray.filter((item) => !(stateFromStores == null ? void 0 : stateFromStores.has(item.id))), [stateFromStoresArray, stateFromStores]),
addedGuilds: useMemo(() => stateFromStoresArray.filter((item) => stateFromStores == null ? void 0 : stateFromStores.has(item.id)), [stateFromStoresArray, stateFromStores]),
loading
};
};
@@ -0,0 +1,26 @@
// Metro module 10059 (f10060).
import ChannelStore from "../../stores/ChannelStore";
import GuildStore from "../../stores/GuildStore";
import PermissionStore from "../../stores/PermissionStore";
import { Permissions } from "../../Constants";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useCanManageGuildDirectoryEntry(c17659_0) {
let stateFromStores2;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(c17659_0.guildId));
stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(c17659_0.channelId));
let isEntryAdmin = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.ADMINISTRATOR, stateFromStores));
const stateFromStores3 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_MESSAGES, stateFromStores2));
const r33 = {
isEntryAdmin,
canEdit: isEntryAdmin ? isEntryAdmin : stateFromStores3,
canRemove: null
};
if (!isEntryAdmin) {
isEntryAdmin = stateFromStores3;
}
r33.canRemove = isEntryAdmin;
return r33;
};
export function useCanCreateOrAddGuildInDirectory(c17660_0) {
return useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.SEND_MESSAGES, c17660_0));
}