@messenger-box/slack-ui-browser 10.0.3-alpha.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/lib/components/Home/Channels.js +62 -0
- package/lib/components/Home/Channels.js.map +1 -0
- package/lib/components/Home/DirectChannels.js +92 -0
- package/lib/components/Home/DirectChannels.js.map +1 -0
- package/lib/components/Home/InviteMembers.js +70 -0
- package/lib/components/Home/InviteMembers.js.map +1 -0
- package/lib/components/Home/Teams.js +62 -0
- package/lib/components/Home/Teams.js.map +1 -0
- package/lib/components/Home/TopCommonSlider.js +35 -0
- package/lib/components/Home/TopCommonSlider.js.map +1 -0
- package/lib/compute.js +223 -0
- package/lib/compute.js.map +1 -0
- package/lib/constants/routes.js +63 -0
- package/lib/constants/routes.js.map +1 -0
- package/lib/hooks/useOptimizedChannelsQueries.js +107 -0
- package/lib/hooks/useOptimizedChannelsQueries.js.map +1 -0
- package/lib/hooks/useRouteState.js +193 -0
- package/lib/hooks/useRouteState.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/machines/routeMachine.js +804 -0
- package/lib/machines/routeMachine.js.map +1 -0
- package/lib/module.js +3 -0
- package/lib/module.js.map +1 -0
- package/lib/queries/slackuiQueries.js +144 -0
- package/lib/queries/slackuiQueries.js.map +1 -0
- package/lib/routes.json +260 -0
- package/lib/screens/Home/HomeScreen.js +664 -0
- package/lib/screens/Home/HomeScreen.js.map +1 -0
- package/lib/screens/Home/index.js +1 -0
- package/lib/screens/Home/index.js.map +1 -0
- package/package.json +52 -0
- package/rollup.config.mjs +41 -0
- package/src/components/Home/Channels.tsx +135 -0
- package/src/components/Home/DirectChannels.tsx +185 -0
- package/src/components/Home/InviteMembers.tsx +134 -0
- package/src/components/Home/Teams.tsx +129 -0
- package/src/components/Home/TopCommonSlider.tsx +70 -0
- package/src/components/Home/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/compute.ts +156 -0
- package/src/constants/index.ts +1 -0
- package/src/constants/routes.ts +92 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useOptimizedChannelsQueries.ts +165 -0
- package/src/hooks/useRouteState.ts +253 -0
- package/src/icons.ts +137 -0
- package/src/index.ts +11 -0
- package/src/machines/index.ts +9 -0
- package/src/machines/routeMachine.ts +682 -0
- package/src/module.tsx +6 -0
- package/src/queries/index.ts +1 -0
- package/src/queries/slackuiQueries.ts +227 -0
- package/src/screens/Home/HomeScreen.tsx +1308 -0
- package/src/screens/Home/index.ts +4 -0
- package/src/screens/NewChannel/NewChannelScreen.tsx +188 -0
- package/src/screens/NewChannel/index.ts +2 -0
- package/src/screens/index.ts +1 -0
- package/tsconfig.json +21 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## [10.0.3-alpha.176](https://github.com/CDEBase/messenger-box/compare/v10.0.3-alpha.175...v10.0.3-alpha.176) (2026-01-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @messenger-box/slack-ui-browser
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React,{useState,useMemo,useCallback}from'react';import {useLocation,useNavigate,Link}from'@remix-run/react';import {FiChevronDown}from'@react-icons/all-files/fi/FiChevronDown.js';import {FiChevronRight}from'@react-icons/all-files/fi/FiChevronRight.js';import'@react-icons/all-files/fi/FiChevronLeft.js';import {FiPlus}from'@react-icons/all-files/fi/FiPlus.js';import {FiSearch}from'@react-icons/all-files/fi/FiSearch.js';import {FiHash}from'@react-icons/all-files/fi/FiHash.js';import'@react-icons/all-files/fi/FiLock.js';import {FiRefreshCw}from'@react-icons/all-files/fi/FiRefreshCw.js';import'@react-icons/all-files/fi/FiUser.js';import'@react-icons/all-files/fi/FiUserPlus.js';import'@react-icons/all-files/fi/FiShare2.js';import'@react-icons/all-files/fi/FiMail.js';import'@react-icons/all-files/fi/FiX.js';import'@react-icons/all-files/fi/FiEdit.js';import'@react-icons/all-files/fi/FiEdit2.js';import'@react-icons/all-files/fi/FiMessageSquare.js';import'@react-icons/all-files/fi/FiBookmark.js';import'@react-icons/all-files/fi/FiSend.js';import'@react-icons/all-files/fi/FiMoreHorizontal.js';import'@react-icons/all-files/fi/FiMoreVertical.js';import'@react-icons/all-files/fi/FiSettings.js';import'@react-icons/all-files/fi/FiHome.js';import'@react-icons/all-files/fi/FiInbox.js';import'@react-icons/all-files/fi/FiUsers.js';import'@react-icons/all-files/fi/FiMessageCircle.js';import'@react-icons/all-files/fi/FiBell.js';import'@react-icons/all-files/fi/FiLogOut.js';import'@react-icons/all-files/fi/FiMenu.js';import'@react-icons/all-files/fi/FiTrash2.js';import'@react-icons/all-files/fi/FiCopy.js';import'@react-icons/all-files/fi/FiCheck.js';import'@react-icons/all-files/fi/FiAlertCircle.js';import'@react-icons/all-files/fi/FiInfo.js';import'@react-icons/all-files/vsc/VscChromeClose.js';import'@react-icons/all-files/vsc/VscAdd.js';import'@react-icons/all-files/vsc/VscSearch.js';import'@react-icons/all-files/vsc/VscMenu.js';import'@react-icons/all-files/go/GoGlobe.js';import'@react-icons/all-files/go/GoOrganization.js';import'@react-icons/all-files/go/GoPerson.js';import'@react-icons/all-files/go/GoComment.js';import'@react-icons/all-files/ri/RiAdminFill.js';import'@react-icons/all-files/ri/RiAdminLine.js';import'@react-icons/all-files/ri/RiTeamLine.js';import'@react-icons/all-files/ri/RiTeamFill.js';import'@react-icons/all-files/ai/AiOutlineHome.js';import'@react-icons/all-files/ai/AiOutlineInbox.js';import'@react-icons/all-files/ai/AiOutlineMessage.js';import'@react-icons/all-files/ai/AiOutlineTeam.js';import'@react-icons/all-files/ai/AiOutlineSetting.js';import'@react-icons/all-files/ai/AiOutlineUser.js';import'@react-icons/all-files/ai/AiOutlinePlus.js';import'@react-icons/all-files/ai/AiOutlineClose.js';import'@react-icons/all-files/ai/AiOutlineSearch.js';import'@react-icons/all-files/ai/AiOutlineEdit.js';import'@react-icons/all-files/ai/AiOutlineDelete.js';import'@react-icons/all-files/ai/AiOutlineSend.js';import'@react-icons/all-files/ai/AiOutlineBell.js';import'@react-icons/all-files/ai/AiOutlineLogout.js';import'@react-icons/all-files/ai/AiOutlineMenu.js';import'@react-icons/all-files/ai/AiOutlineCopy.js';import'@react-icons/all-files/ai/AiOutlineCheck.js';import'@react-icons/all-files/ai/AiOutlineWarning.js';import'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import'@react-icons/all-files/bs/BsHash.js';import'@react-icons/all-files/bs/BsLock.js';import'@react-icons/all-files/bs/BsPeople.js';import'@react-icons/all-files/bs/BsPerson.js';import'@react-icons/all-files/bs/BsChat.js';import'@react-icons/all-files/bs/BsChatDots.js';import'@react-icons/all-files/bs/BsThreeDots.js';import'@react-icons/all-files/bs/BsThreeDotsVertical.js';import'@react-icons/all-files/hi/HiOutlineHashtag.js';import'@react-icons/all-files/hi/HiOutlineLockClosed.js';import'@react-icons/all-files/hi/HiOutlineUserGroup.js';import'@react-icons/all-files/hi/HiOutlineUser.js';import'@react-icons/all-files/hi/HiOutlineChat.js';import'@react-icons/all-files/hi/HiOutlinePencil.js';import'@react-icons/all-files/hi/HiOutlineDotsHorizontal.js';import'@react-icons/all-files/hi/HiOutlineDotsVertical.js';import'@react-icons/all-files/hi/HiOutlinePlus.js';import'@react-icons/all-files/hi/HiOutlineX.js';import'@react-icons/all-files/hi/HiOutlineSearch.js';import'@react-icons/all-files/hi/HiOutlineHome.js';import'@react-icons/all-files/hi/HiOutlineInbox.js';import'@react-icons/all-files/hi/HiOutlineBell.js';import'@react-icons/all-files/hi/HiOutlineCog.js';import'@react-icons/all-files/io/IoMdAdd.js';import'@react-icons/all-files/io/IoMdClose.js';import'@react-icons/all-files/io/IoMdSearch.js';import'@react-icons/all-files/io/IoMdMenu.js';import'@react-icons/all-files/io/IoMdSettings.js';import'@react-icons/all-files/io/IoMdPerson.js';import'@react-icons/all-files/io/IoMdPeople.js';import'@react-icons/all-files/io/IoMdChatbubbles.js';import'@react-icons/all-files/io/IoMdNotifications.js';import'@react-icons/all-files/md/MdAdd.js';import'@react-icons/all-files/md/MdClose.js';import'@react-icons/all-files/md/MdSearch.js';import'@react-icons/all-files/md/MdMenu.js';import'@react-icons/all-files/md/MdSettings.js';import'@react-icons/all-files/md/MdPerson.js';import'@react-icons/all-files/md/MdPeople.js';import'@react-icons/all-files/md/MdChat.js';import'@react-icons/all-files/md/MdNotifications.js';import'@react-icons/all-files/md/MdHome.js';import'@react-icons/all-files/md/MdInbox.js';import'@react-icons/all-files/md/MdEdit.js';import'@react-icons/all-files/md/MdDelete.js';import'@react-icons/all-files/md/MdSend.js';import'@react-icons/all-files/md/MdRefresh.js';import'@react-icons/all-files/md/MdMoreHoriz.js';import'@react-icons/all-files/md/MdMoreVert.js';import'@react-icons/all-files/md/MdLock.js';import'@react-icons/all-files/md/MdPublic.js';import {useTranslation}from'react-i18next';const Channels = ({
|
|
2
|
+
channels = [],
|
|
3
|
+
loading = false,
|
|
4
|
+
error = null,
|
|
5
|
+
onRefetch,
|
|
6
|
+
currentUser
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
t
|
|
10
|
+
} = useTranslation();
|
|
11
|
+
const location = useLocation();
|
|
12
|
+
const navigate = useNavigate();
|
|
13
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
14
|
+
const orgSlug = location.pathname.split("/")[2];
|
|
15
|
+
const publicChannels = useMemo(() => {
|
|
16
|
+
return channels.filter((channel) => channel.type !== "DIRECT").slice(0, 10);
|
|
17
|
+
}, [channels]);
|
|
18
|
+
const handleRefetch = useCallback(() => {
|
|
19
|
+
onRefetch == null ? void 0 : onRefetch();
|
|
20
|
+
}, [onRefetch]);
|
|
21
|
+
const ListEmptyComponent = () => {
|
|
22
|
+
if (error) {
|
|
23
|
+
return /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxs("div", { className: "p-2 bg-red-50 rounded", children: [
|
|
24
|
+
/* @__PURE__ */ jsx("p", { className: "text-red-600 text-sm mb-2 font-medium", children: "Channel service is temporarily unavailable." }),
|
|
25
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleRefetch, className: "flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline", children: [
|
|
26
|
+
/* @__PURE__ */ jsx(FiRefreshCw, { className: "w-4 h-4" }),
|
|
27
|
+
"Retry"
|
|
28
|
+
] })
|
|
29
|
+
] }) });
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-4 px-3", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 mb-2 rounded-full bg-gray-100", children: /* @__PURE__ */ jsx(FiHash, { className: "w-5 h-5 text-gray-500" }) }),
|
|
33
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm text-center", children: "No channels available" })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-2", children: [
|
|
37
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-900", children: t("messenger_box_browser.PUBLIC_CHANNELS", "Channels") }),
|
|
39
|
+
isExpanded ? /* @__PURE__ */ jsx(FiChevronDown, { className: "w-4 h-4 text-gray-600" }) : /* @__PURE__ */ jsx(FiChevronRight, { className: "w-4 h-4 text-gray-600" })
|
|
40
|
+
] }),
|
|
41
|
+
isExpanded && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
42
|
+
loading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500" }) }) : publicChannels.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
43
|
+
publicChannels.map((channel) => /* @__PURE__ */ jsxs(Link, { to: `/o/${orgSlug}/home/channel/${channel.title}`, state: {
|
|
44
|
+
channel,
|
|
45
|
+
currentUser
|
|
46
|
+
}, className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors", children: [
|
|
47
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-500 text-base flex-shrink-0", children: "#" }),
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-900 text-sm truncate", children: channel.title })
|
|
49
|
+
] }, channel.id)),
|
|
50
|
+
channels.length > 10 && /* @__PURE__ */ jsxs("button", { onClick: () => navigate(`/o/${orgSlug}/home/channels`), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(FiSearch, { className: "w-4 h-4" }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Browse all Channels" })
|
|
53
|
+
] })
|
|
54
|
+
] }) : /* @__PURE__ */ jsx(ListEmptyComponent, {}),
|
|
55
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => navigate(`/o/${orgSlug}/home/channels/new`), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(FiPlus, { className: "w-4 h-4" }),
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Add Channels" })
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
};
|
|
62
|
+
React.memo(Channels);export{Channels};//# sourceMappingURL=Channels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Channels.js","sources":["../../../src/components/Home/Channels.tsx"],"sourcesContent":["import React, { useState, useMemo, useCallback } from 'react';\nimport { Link, useLocation, useNavigate } from '@remix-run/react';\nimport { FiChevronDown, FiChevronRight, FiPlus, FiSearch, FiHash, FiRefreshCw } from '../../icons';\nimport { useTranslation } from 'react-i18next';\n\ninterface ChannelsProps {\n channels?: any[];\n loading?: boolean;\n error?: any;\n onRefetch?: () => void;\n currentUser?: any;\n}\n\nexport const Channels: React.FC<ChannelsProps> = ({ \n channels = [], \n loading = false, \n error = null,\n onRefetch,\n currentUser \n}) => {\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const [isExpanded, setIsExpanded] = useState(true);\n const orgSlug = location.pathname.split('/')[2];\n\n // Filter to get only public/channel type (not direct messages)\n const publicChannels = useMemo(() => {\n return channels\n .filter((channel: any) => channel.type !== 'DIRECT')\n .slice(0, 10);\n }, [channels]);\n\n const handleRefetch = useCallback(() => {\n onRefetch?.();\n }, [onRefetch]);\n\n const ListEmptyComponent = () => {\n if (error) {\n return (\n <div className=\"p-3\">\n <div className=\"p-2 bg-red-50 rounded\">\n <p className=\"text-red-600 text-sm mb-2 font-medium\">\n Channel service is temporarily unavailable.\n </p>\n <button \n onClick={handleRefetch}\n className=\"flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline\"\n >\n <FiRefreshCw className=\"w-4 h-4\" />\n Retry\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col items-center py-4 px-3\">\n <div className=\"p-3 mb-2 rounded-full bg-gray-100\">\n <FiHash className=\"w-5 h-5 text-gray-500\" />\n </div>\n <p className=\"text-gray-500 text-sm text-center\">No channels available</p>\n </div>\n );\n };\n\n return (\n <div className=\"py-2\">\n {/* Section Header */}\n <button\n onClick={() => setIsExpanded(!isExpanded)}\n className=\"w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50\"\n >\n <span className=\"font-semibold text-gray-900\">\n {t('messenger_box_browser.PUBLIC_CHANNELS', 'Channels')}\n </span>\n {isExpanded ? (\n <FiChevronDown className=\"w-4 h-4 text-gray-600\" />\n ) : (\n <FiChevronRight className=\"w-4 h-4 text-gray-600\" />\n )}\n </button>\n\n {/* Channels List */}\n {isExpanded && (\n <div className=\"mt-1\">\n {loading ? (\n <div className=\"flex items-center justify-center py-4\">\n <div className=\"animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500\"></div>\n </div>\n ) : publicChannels.length > 0 ? (\n <>\n {publicChannels.map((channel: any) => (\n <Link\n key={channel.id}\n to={`/o/${orgSlug}/home/channel/${channel.title}`}\n state={{ channel, currentUser }}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors\"\n >\n <span className=\"text-gray-500 text-base flex-shrink-0\">#</span>\n <span className=\"text-gray-900 text-sm truncate\">{channel.title}</span>\n </Link>\n ))}\n \n {/* Browse all channels */}\n {channels.length > 10 && (\n <button\n onClick={() => navigate(`/o/${orgSlug}/home/channels`)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiSearch className=\"w-4 h-4\" />\n <span className=\"text-sm\">Browse all Channels</span>\n </button>\n )}\n </>\n ) : (\n <ListEmptyComponent />\n )}\n\n {/* Add Channel */}\n <button\n onClick={() => navigate(`/o/${orgSlug}/home/channels/new`)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiPlus className=\"w-4 h-4\" />\n <span className=\"text-sm\">Add Channels</span>\n </button>\n </div>\n )}\n </div>\n );\n};\n\nexport default React.memo(Channels);\n"],"names":[],"mappings":"oxLAWO,MAAM,WAAoC,CAAC;AAAA,EAChD,WAAW,EAAC;AAAA,EACZ,OAAA,GAAU,KAAA;AAAA,EACV,KAAA,GAAQ,IAAA;AAAA,EACR,SAAA;AAAA,EACA;AACF,CAAA,KAAM;AACJ,EAAA,MAAM;AAAA,IACJ;AAAA,MACE,cAAA,EAAe;AACnB,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAS,IAAI,CAAA;AACjD,EAAA,MAAM,UAAU,QAAA,CAAS,QAAA,CAAS,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAG9C,EAAA,MAAM,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAA,OAAO,QAAA,CAAS,MAAA,CAAO,CAAC,OAAA,KAAiB,OAAA,CAAQ,SAAS,QAAQ,CAAA,CAAE,K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AAA,CAAS,MAAA,GAAS,EAAA,oBAAM,IAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,QAAA,CAAS,CAAA,GAAA,EAAM,OAAO,CAAA,cAAA,CAAgB,CAAA,EAAG,WAAU,yEAAA,EAC3F,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,QAAA,EAAA,EAAS,WAAU,SAAA,EAAU,CAAA;AAAA,0BAC9B,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,qBAAA,EAAmB;AAAA,SAAA,EACjD;AAAA,OAAA,EACR,CAAA,uBAAO,kBAAA,EAAA,EAAmB,CAAA;AAAA,sBAG9B,IAAA,CAAC,QAAA,EAAA,EAAO,OAAA,EAAS,MAAM,QAAA,CAAS,MAAM,OAAO,CAAA,kBAAA,CAAoB,CAAA,EAAG,SAAA,EAAU,yEAAA,EAC1E,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAO,WAAU,SAAA,EAAU,CAAA;AAAA,wBAC5B,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,cAAA,EAAY;AAAA,OAAA,EAC1C;AAAA,KAAA,EACJ;AAAA,GAAA,EACR,CAAA;AACR;AACe,KAAA,CAAM,KAAK,QAAQ,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React,{useState,useMemo,useCallback}from'react';import {useLocation,useNavigate,Link}from'@remix-run/react';import {FiChevronDown}from'@react-icons/all-files/fi/FiChevronDown.js';import {FiChevronRight}from'@react-icons/all-files/fi/FiChevronRight.js';import'@react-icons/all-files/fi/FiChevronLeft.js';import {FiPlus}from'@react-icons/all-files/fi/FiPlus.js';import {FiSearch}from'@react-icons/all-files/fi/FiSearch.js';import'@react-icons/all-files/fi/FiHash.js';import'@react-icons/all-files/fi/FiLock.js';import {FiRefreshCw}from'@react-icons/all-files/fi/FiRefreshCw.js';import {FiUser}from'@react-icons/all-files/fi/FiUser.js';import'@react-icons/all-files/fi/FiUserPlus.js';import'@react-icons/all-files/fi/FiShare2.js';import'@react-icons/all-files/fi/FiMail.js';import'@react-icons/all-files/fi/FiX.js';import'@react-icons/all-files/fi/FiEdit.js';import'@react-icons/all-files/fi/FiEdit2.js';import'@react-icons/all-files/fi/FiMessageSquare.js';import'@react-icons/all-files/fi/FiBookmark.js';import'@react-icons/all-files/fi/FiSend.js';import'@react-icons/all-files/fi/FiMoreHorizontal.js';import'@react-icons/all-files/fi/FiMoreVertical.js';import'@react-icons/all-files/fi/FiSettings.js';import'@react-icons/all-files/fi/FiHome.js';import'@react-icons/all-files/fi/FiInbox.js';import'@react-icons/all-files/fi/FiUsers.js';import'@react-icons/all-files/fi/FiMessageCircle.js';import'@react-icons/all-files/fi/FiBell.js';import'@react-icons/all-files/fi/FiLogOut.js';import'@react-icons/all-files/fi/FiMenu.js';import'@react-icons/all-files/fi/FiTrash2.js';import'@react-icons/all-files/fi/FiCopy.js';import'@react-icons/all-files/fi/FiCheck.js';import'@react-icons/all-files/fi/FiAlertCircle.js';import'@react-icons/all-files/fi/FiInfo.js';import'@react-icons/all-files/vsc/VscChromeClose.js';import'@react-icons/all-files/vsc/VscAdd.js';import'@react-icons/all-files/vsc/VscSearch.js';import'@react-icons/all-files/vsc/VscMenu.js';import'@react-icons/all-files/go/GoGlobe.js';import'@react-icons/all-files/go/GoOrganization.js';import'@react-icons/all-files/go/GoPerson.js';import'@react-icons/all-files/go/GoComment.js';import'@react-icons/all-files/ri/RiAdminFill.js';import'@react-icons/all-files/ri/RiAdminLine.js';import'@react-icons/all-files/ri/RiTeamLine.js';import'@react-icons/all-files/ri/RiTeamFill.js';import'@react-icons/all-files/ai/AiOutlineHome.js';import'@react-icons/all-files/ai/AiOutlineInbox.js';import'@react-icons/all-files/ai/AiOutlineMessage.js';import'@react-icons/all-files/ai/AiOutlineTeam.js';import'@react-icons/all-files/ai/AiOutlineSetting.js';import'@react-icons/all-files/ai/AiOutlineUser.js';import'@react-icons/all-files/ai/AiOutlinePlus.js';import'@react-icons/all-files/ai/AiOutlineClose.js';import'@react-icons/all-files/ai/AiOutlineSearch.js';import'@react-icons/all-files/ai/AiOutlineEdit.js';import'@react-icons/all-files/ai/AiOutlineDelete.js';import'@react-icons/all-files/ai/AiOutlineSend.js';import'@react-icons/all-files/ai/AiOutlineBell.js';import'@react-icons/all-files/ai/AiOutlineLogout.js';import'@react-icons/all-files/ai/AiOutlineMenu.js';import'@react-icons/all-files/ai/AiOutlineCopy.js';import'@react-icons/all-files/ai/AiOutlineCheck.js';import'@react-icons/all-files/ai/AiOutlineWarning.js';import'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import'@react-icons/all-files/bs/BsHash.js';import'@react-icons/all-files/bs/BsLock.js';import'@react-icons/all-files/bs/BsPeople.js';import'@react-icons/all-files/bs/BsPerson.js';import'@react-icons/all-files/bs/BsChat.js';import'@react-icons/all-files/bs/BsChatDots.js';import'@react-icons/all-files/bs/BsThreeDots.js';import'@react-icons/all-files/bs/BsThreeDotsVertical.js';import'@react-icons/all-files/hi/HiOutlineHashtag.js';import'@react-icons/all-files/hi/HiOutlineLockClosed.js';import'@react-icons/all-files/hi/HiOutlineUserGroup.js';import'@react-icons/all-files/hi/HiOutlineUser.js';import'@react-icons/all-files/hi/HiOutlineChat.js';import'@react-icons/all-files/hi/HiOutlinePencil.js';import'@react-icons/all-files/hi/HiOutlineDotsHorizontal.js';import'@react-icons/all-files/hi/HiOutlineDotsVertical.js';import'@react-icons/all-files/hi/HiOutlinePlus.js';import'@react-icons/all-files/hi/HiOutlineX.js';import'@react-icons/all-files/hi/HiOutlineSearch.js';import'@react-icons/all-files/hi/HiOutlineHome.js';import'@react-icons/all-files/hi/HiOutlineInbox.js';import'@react-icons/all-files/hi/HiOutlineBell.js';import'@react-icons/all-files/hi/HiOutlineCog.js';import'@react-icons/all-files/io/IoMdAdd.js';import'@react-icons/all-files/io/IoMdClose.js';import'@react-icons/all-files/io/IoMdSearch.js';import'@react-icons/all-files/io/IoMdMenu.js';import'@react-icons/all-files/io/IoMdSettings.js';import'@react-icons/all-files/io/IoMdPerson.js';import'@react-icons/all-files/io/IoMdPeople.js';import'@react-icons/all-files/io/IoMdChatbubbles.js';import'@react-icons/all-files/io/IoMdNotifications.js';import'@react-icons/all-files/md/MdAdd.js';import'@react-icons/all-files/md/MdClose.js';import'@react-icons/all-files/md/MdSearch.js';import'@react-icons/all-files/md/MdMenu.js';import'@react-icons/all-files/md/MdSettings.js';import'@react-icons/all-files/md/MdPerson.js';import'@react-icons/all-files/md/MdPeople.js';import'@react-icons/all-files/md/MdChat.js';import'@react-icons/all-files/md/MdNotifications.js';import'@react-icons/all-files/md/MdHome.js';import'@react-icons/all-files/md/MdInbox.js';import'@react-icons/all-files/md/MdEdit.js';import'@react-icons/all-files/md/MdDelete.js';import'@react-icons/all-files/md/MdSend.js';import'@react-icons/all-files/md/MdRefresh.js';import'@react-icons/all-files/md/MdMoreHoriz.js';import'@react-icons/all-files/md/MdMoreVert.js';import'@react-icons/all-files/md/MdLock.js';import'@react-icons/all-files/md/MdPublic.js';import {useTranslation}from'react-i18next';const getDirectChannelDisplayName = (channel, currentUserId) => {
|
|
2
|
+
if (!channel.displayName) return channel.title || "Direct Message";
|
|
3
|
+
const parts = channel.displayName.split("_");
|
|
4
|
+
if (parts.length === 2) {
|
|
5
|
+
const [first, second] = parts;
|
|
6
|
+
const firstParts = first.split("-");
|
|
7
|
+
const secondParts = second.split("-");
|
|
8
|
+
if (firstParts[0] !== currentUserId) {
|
|
9
|
+
return firstParts[1] || first;
|
|
10
|
+
}
|
|
11
|
+
return secondParts[1] || second;
|
|
12
|
+
}
|
|
13
|
+
return channel.displayName;
|
|
14
|
+
};
|
|
15
|
+
const getInitials = (name) => {
|
|
16
|
+
if (!name) return "?";
|
|
17
|
+
return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
|
|
18
|
+
};
|
|
19
|
+
const DirectChannels = ({
|
|
20
|
+
directChannels = [],
|
|
21
|
+
loading = false,
|
|
22
|
+
error = null,
|
|
23
|
+
onRefetch,
|
|
24
|
+
currentUser
|
|
25
|
+
}) => {
|
|
26
|
+
const {
|
|
27
|
+
t
|
|
28
|
+
} = useTranslation();
|
|
29
|
+
const location = useLocation();
|
|
30
|
+
const navigate = useNavigate();
|
|
31
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
32
|
+
const orgSlug = location.pathname.split("/")[2];
|
|
33
|
+
const limitedDirectChannels = useMemo(() => {
|
|
34
|
+
return directChannels.slice(0, 20);
|
|
35
|
+
}, [directChannels]);
|
|
36
|
+
const handleNewDirectMessage = useCallback(() => {
|
|
37
|
+
navigate(`/o/${orgSlug}/home/messages/new`);
|
|
38
|
+
}, [navigate, orgSlug]);
|
|
39
|
+
const handleRefetch = useCallback(() => {
|
|
40
|
+
onRefetch == null ? void 0 : onRefetch();
|
|
41
|
+
}, [onRefetch]);
|
|
42
|
+
const getChannelRoute = useCallback((channel) => {
|
|
43
|
+
const displayName = getDirectChannelDisplayName(channel, currentUser == null ? void 0 : currentUser.id);
|
|
44
|
+
return `/o/${orgSlug}/home/message/${displayName}`;
|
|
45
|
+
}, [orgSlug, currentUser == null ? void 0 : currentUser.id]);
|
|
46
|
+
const ListEmptyComponent = () => {
|
|
47
|
+
if (error) {
|
|
48
|
+
return /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxs("div", { className: "p-2 bg-red-50 rounded", children: [
|
|
49
|
+
/* @__PURE__ */ jsx("p", { className: "text-red-600 text-sm mb-2 font-medium", children: "Unable to load direct messages." }),
|
|
50
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleRefetch, className: "flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(FiRefreshCw, { className: "w-4 h-4" }),
|
|
52
|
+
"Retry"
|
|
53
|
+
] })
|
|
54
|
+
] }) });
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-4 px-3", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 mb-2 rounded-full bg-gray-100", children: /* @__PURE__ */ jsx(FiUser, { className: "w-5 h-5 text-gray-500" }) }),
|
|
58
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm text-center", children: "No direct messages yet" })
|
|
59
|
+
] });
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-2", children: [
|
|
62
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50", children: [
|
|
63
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-900", children: t("messenger_box_browser.DIRECT_MESSAGES", "Direct Messages") }),
|
|
64
|
+
isExpanded ? /* @__PURE__ */ jsx(FiChevronDown, { className: "w-4 h-4 text-gray-600" }) : /* @__PURE__ */ jsx(FiChevronRight, { className: "w-4 h-4 text-gray-600" })
|
|
65
|
+
] }),
|
|
66
|
+
isExpanded && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
67
|
+
loading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500" }) }) : limitedDirectChannels.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
limitedDirectChannels.map((channel) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const displayName = getDirectChannelDisplayName(channel, currentUser == null ? void 0 : currentUser.id);
|
|
71
|
+
const memberCount = ((_a = channel.displayName) == null ? void 0 : _a.split(",").length) || 1;
|
|
72
|
+
return /* @__PURE__ */ jsxs(Link, { to: getChannelRoute(channel), state: {
|
|
73
|
+
channel,
|
|
74
|
+
currentUser
|
|
75
|
+
}, className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors", children: [
|
|
76
|
+
memberCount > 1 ? /* @__PURE__ */ jsx("span", { className: "w-6 h-6 flex items-center justify-center bg-gray-200 rounded-full text-xs text-gray-700 flex-shrink-0", children: memberCount }) : /* @__PURE__ */ jsx("span", { className: "w-6 h-6 flex items-center justify-center bg-blue-100 rounded-full text-xs text-blue-700 flex-shrink-0", children: getInitials(displayName) }),
|
|
77
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-900 text-sm truncate", children: displayName })
|
|
78
|
+
] }, channel.id);
|
|
79
|
+
}),
|
|
80
|
+
directChannels.length > 20 && /* @__PURE__ */ jsxs("button", { onClick: () => navigate(`/o/${orgSlug}/home/messages`), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
81
|
+
/* @__PURE__ */ jsx(FiSearch, { className: "w-4 h-4" }),
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Browse all Messages" })
|
|
83
|
+
] })
|
|
84
|
+
] }) : /* @__PURE__ */ jsx(ListEmptyComponent, {}),
|
|
85
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleNewDirectMessage, className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
86
|
+
/* @__PURE__ */ jsx(FiPlus, { className: "w-4 h-4" }),
|
|
87
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "New Message" })
|
|
88
|
+
] })
|
|
89
|
+
] })
|
|
90
|
+
] });
|
|
91
|
+
};
|
|
92
|
+
React.memo(DirectChannels);export{DirectChannels};//# sourceMappingURL=DirectChannels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectChannels.js","sources":["../../../src/components/Home/DirectChannels.tsx"],"sourcesContent":["import React, { useState, useMemo, useCallback } from 'react';\nimport { Link, useLocation, useNavigate } from '@remix-run/react';\nimport { FiChevronDown, FiChevronRight, FiPlus, FiSearch, FiRefreshCw, FiUser } from '../../icons';\nimport { useTranslation } from 'react-i18next';\n\n// Helper to get the other user's display name from a direct channel\nconst getDirectChannelDisplayName = (channel: any, currentUserId: string) => {\n if (!channel.displayName) return channel.title || 'Direct Message';\n \n const parts = channel.displayName.split('_');\n if (parts.length === 2) {\n const [first, second] = parts;\n const firstParts = first.split('-');\n const secondParts = second.split('-');\n \n if (firstParts[0] !== currentUserId) {\n return firstParts[1] || first;\n }\n return secondParts[1] || second;\n }\n \n return channel.displayName;\n};\n\n// Helper to get initials from a name\nconst getInitials = (name: string) => {\n if (!name) return '?';\n return name\n .split(' ')\n .map(n => n[0])\n .join('')\n .toUpperCase()\n .slice(0, 2);\n};\n\ninterface DirectChannelsProps {\n directChannels?: any[];\n loading?: boolean;\n error?: any;\n onRefetch?: () => void;\n currentUser?: any;\n}\n\nexport const DirectChannels: React.FC<DirectChannelsProps> = ({\n directChannels = [],\n loading = false,\n error = null,\n onRefetch,\n currentUser\n}) => {\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const [isExpanded, setIsExpanded] = useState(true);\n const orgSlug = location.pathname.split('/')[2];\n\n // Limit to 20 direct channels\n const limitedDirectChannels = useMemo(() => {\n return directChannels.slice(0, 20);\n }, [directChannels]);\n\n const handleNewDirectMessage = useCallback(() => {\n navigate(`/o/${orgSlug}/home/messages/new`);\n }, [navigate, orgSlug]);\n\n const handleRefetch = useCallback(() => {\n onRefetch?.();\n }, [onRefetch]);\n\n const getChannelRoute = useCallback((channel: any) => {\n const displayName = getDirectChannelDisplayName(channel, currentUser?.id);\n return `/o/${orgSlug}/home/message/${displayName}`;\n }, [orgSlug, currentUser?.id]);\n\n const ListEmptyComponent = () => {\n if (error) {\n return (\n <div className=\"p-3\">\n <div className=\"p-2 bg-red-50 rounded\">\n <p className=\"text-red-600 text-sm mb-2 font-medium\">\n Unable to load direct messages.\n </p>\n <button \n onClick={handleRefetch}\n className=\"flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline\"\n >\n <FiRefreshCw className=\"w-4 h-4\" />\n Retry\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col items-center py-4 px-3\">\n <div className=\"p-3 mb-2 rounded-full bg-gray-100\">\n <FiUser className=\"w-5 h-5 text-gray-500\" />\n </div>\n <p className=\"text-gray-500 text-sm text-center\">No direct messages yet</p>\n </div>\n );\n };\n\n return (\n <div className=\"py-2\">\n {/* Section Header */}\n <button\n onClick={() => setIsExpanded(!isExpanded)}\n className=\"w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50\"\n >\n <span className=\"font-semibold text-gray-900\">\n {t('messenger_box_browser.DIRECT_MESSAGES', 'Direct Messages')}\n </span>\n {isExpanded ? (\n <FiChevronDown className=\"w-4 h-4 text-gray-600\" />\n ) : (\n <FiChevronRight className=\"w-4 h-4 text-gray-600\" />\n )}\n </button>\n\n {/* Direct Channels List */}\n {isExpanded && (\n <div className=\"mt-1\">\n {loading ? (\n <div className=\"flex items-center justify-center py-4\">\n <div className=\"animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500\"></div>\n </div>\n ) : limitedDirectChannels.length > 0 ? (\n <>\n {limitedDirectChannels.map((channel: any) => {\n const displayName = getDirectChannelDisplayName(channel, currentUser?.id);\n const memberCount = channel.displayName?.split(',').length || 1;\n \n return (\n <Link\n key={channel.id}\n to={getChannelRoute(channel)}\n state={{ channel, currentUser }}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors\"\n >\n {memberCount > 1 ? (\n <span className=\"w-6 h-6 flex items-center justify-center bg-gray-200 rounded-full text-xs text-gray-700 flex-shrink-0\">\n {memberCount}\n </span>\n ) : (\n <span className=\"w-6 h-6 flex items-center justify-center bg-blue-100 rounded-full text-xs text-blue-700 flex-shrink-0\">\n {getInitials(displayName)}\n </span>\n )}\n <span className=\"text-gray-900 text-sm truncate\">{displayName}</span>\n </Link>\n );\n })}\n \n {/* Browse all messages */}\n {directChannels.length > 20 && (\n <button\n onClick={() => navigate(`/o/${orgSlug}/home/messages`)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiSearch className=\"w-4 h-4\" />\n <span className=\"text-sm\">Browse all Messages</span>\n </button>\n )}\n </>\n ) : (\n <ListEmptyComponent />\n )}\n\n {/* New Direct Message */}\n <button\n onClick={handleNewDirectMessage}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiPlus className=\"w-4 h-4\" />\n <span className=\"text-sm\">New Message</span>\n </button>\n </div>\n )}\n </div>\n );\n};\n\nexport default React.memo(DirectChannels);\n"],"names":[],"mappings":"oxLAMA,MAAM,2BAAA,GAA8B,CAAC,OAAA,EAAc,aAAA,KAA0B;AAC3E,EAAA,IAAI,CAAC,OAAA,CAAQ,WAAA,EAAa,OAAO,QAAQ,KAAA,IAAS,gBAAA;AAClD,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,WAAA,CAAY,KAAA,CAAM,GAAG,CAAA;AAC3C,EAAA,IAAI,KAAA,CAAM,WAAW,CAAA,EAAG;AACtB,IAAA,MAAM,CAAC,KAAA,EAAO,MAAM,CAAA,GAAI,KAAA;AACxB,IAAA,MAAM,UAAA,GAAa,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAClC,IAAA,MAAM,WAAA,GAAc,MAAA,CAAO,KAAA,CAAM,GAAG,CAAA;AACpC,IAAA,IAAI,UAAA,CAAW,CAAC,CAAA,KAAM,aAAA,EAAe;AACnC,MAAA,OAAO,UAAA,CAAW,CAAC,CAAA,IAAK,KAAA;AAAA,IAC1B;AACA,IAAA,OAAO,WAAA,CAAY,CAAC,CAAA,IAAK,MAAA;AAAA,EAC3B;AACA,EAAA,OAAO,OAAA,CAAQ,WAAA;AACjB,CAAA;AAGA,MAAM,WAAA,GAAc,CAAC,IAAA,KAAiB;AACpC,EAAA,IAAI,CAAC,MAAM,OAAO,GAAA;AA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
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import React,{useState,useCallback}from'react';import {useLocation,useNavigate}from'@remix-run/react';import'@react-icons/all-files/fi/FiChevronDown.js';import'@react-icons/all-files/fi/FiChevronRight.js';import'@react-icons/all-files/fi/FiChevronLeft.js';import'@react-icons/all-files/fi/FiPlus.js';import'@react-icons/all-files/fi/FiSearch.js';import'@react-icons/all-files/fi/FiHash.js';import'@react-icons/all-files/fi/FiLock.js';import'@react-icons/all-files/fi/FiRefreshCw.js';import'@react-icons/all-files/fi/FiUser.js';import {FiUserPlus}from'@react-icons/all-files/fi/FiUserPlus.js';import {FiShare2}from'@react-icons/all-files/fi/FiShare2.js';import {FiMail}from'@react-icons/all-files/fi/FiMail.js';import {FiX}from'@react-icons/all-files/fi/FiX.js';import'@react-icons/all-files/fi/FiEdit.js';import'@react-icons/all-files/fi/FiEdit2.js';import'@react-icons/all-files/fi/FiMessageSquare.js';import'@react-icons/all-files/fi/FiBookmark.js';import'@react-icons/all-files/fi/FiSend.js';import'@react-icons/all-files/fi/FiMoreHorizontal.js';import'@react-icons/all-files/fi/FiMoreVertical.js';import'@react-icons/all-files/fi/FiSettings.js';import'@react-icons/all-files/fi/FiHome.js';import'@react-icons/all-files/fi/FiInbox.js';import'@react-icons/all-files/fi/FiUsers.js';import'@react-icons/all-files/fi/FiMessageCircle.js';import'@react-icons/all-files/fi/FiBell.js';import'@react-icons/all-files/fi/FiLogOut.js';import'@react-icons/all-files/fi/FiMenu.js';import'@react-icons/all-files/fi/FiTrash2.js';import'@react-icons/all-files/fi/FiCopy.js';import'@react-icons/all-files/fi/FiCheck.js';import'@react-icons/all-files/fi/FiAlertCircle.js';import'@react-icons/all-files/fi/FiInfo.js';import'@react-icons/all-files/vsc/VscChromeClose.js';import'@react-icons/all-files/vsc/VscAdd.js';import'@react-icons/all-files/vsc/VscSearch.js';import'@react-icons/all-files/vsc/VscMenu.js';import'@react-icons/all-files/go/GoGlobe.js';import'@react-icons/all-files/go/GoOrganization.js';import'@react-icons/all-files/go/GoPerson.js';import'@react-icons/all-files/go/GoComment.js';import'@react-icons/all-files/ri/RiAdminFill.js';import'@react-icons/all-files/ri/RiAdminLine.js';import'@react-icons/all-files/ri/RiTeamLine.js';import'@react-icons/all-files/ri/RiTeamFill.js';import'@react-icons/all-files/ai/AiOutlineHome.js';import'@react-icons/all-files/ai/AiOutlineInbox.js';import'@react-icons/all-files/ai/AiOutlineMessage.js';import'@react-icons/all-files/ai/AiOutlineTeam.js';import'@react-icons/all-files/ai/AiOutlineSetting.js';import'@react-icons/all-files/ai/AiOutlineUser.js';import'@react-icons/all-files/ai/AiOutlinePlus.js';import'@react-icons/all-files/ai/AiOutlineClose.js';import'@react-icons/all-files/ai/AiOutlineSearch.js';import'@react-icons/all-files/ai/AiOutlineEdit.js';import'@react-icons/all-files/ai/AiOutlineDelete.js';import'@react-icons/all-files/ai/AiOutlineSend.js';import'@react-icons/all-files/ai/AiOutlineBell.js';import'@react-icons/all-files/ai/AiOutlineLogout.js';import'@react-icons/all-files/ai/AiOutlineMenu.js';import'@react-icons/all-files/ai/AiOutlineCopy.js';import'@react-icons/all-files/ai/AiOutlineCheck.js';import'@react-icons/all-files/ai/AiOutlineWarning.js';import'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import'@react-icons/all-files/bs/BsHash.js';import'@react-icons/all-files/bs/BsLock.js';import'@react-icons/all-files/bs/BsPeople.js';import'@react-icons/all-files/bs/BsPerson.js';import'@react-icons/all-files/bs/BsChat.js';import'@react-icons/all-files/bs/BsChatDots.js';import'@react-icons/all-files/bs/BsThreeDots.js';import'@react-icons/all-files/bs/BsThreeDotsVertical.js';import'@react-icons/all-files/hi/HiOutlineHashtag.js';import'@react-icons/all-files/hi/HiOutlineLockClosed.js';import'@react-icons/all-files/hi/HiOutlineUserGroup.js';import'@react-icons/all-files/hi/HiOutlineUser.js';import'@react-icons/all-files/hi/HiOutlineChat.js';import'@react-icons/all-files/hi/HiOutlinePencil.js';import'@react-icons/all-files/hi/HiOutlineDotsHorizontal.js';import'@react-icons/all-files/hi/HiOutlineDotsVertical.js';import'@react-icons/all-files/hi/HiOutlinePlus.js';import'@react-icons/all-files/hi/HiOutlineX.js';import'@react-icons/all-files/hi/HiOutlineSearch.js';import'@react-icons/all-files/hi/HiOutlineHome.js';import'@react-icons/all-files/hi/HiOutlineInbox.js';import'@react-icons/all-files/hi/HiOutlineBell.js';import'@react-icons/all-files/hi/HiOutlineCog.js';import'@react-icons/all-files/io/IoMdAdd.js';import'@react-icons/all-files/io/IoMdClose.js';import'@react-icons/all-files/io/IoMdSearch.js';import'@react-icons/all-files/io/IoMdMenu.js';import'@react-icons/all-files/io/IoMdSettings.js';import'@react-icons/all-files/io/IoMdPerson.js';import'@react-icons/all-files/io/IoMdPeople.js';import'@react-icons/all-files/io/IoMdChatbubbles.js';import'@react-icons/all-files/io/IoMdNotifications.js';import'@react-icons/all-files/md/MdAdd.js';import'@react-icons/all-files/md/MdClose.js';import'@react-icons/all-files/md/MdSearch.js';import'@react-icons/all-files/md/MdMenu.js';import'@react-icons/all-files/md/MdSettings.js';import'@react-icons/all-files/md/MdPerson.js';import'@react-icons/all-files/md/MdPeople.js';import'@react-icons/all-files/md/MdChat.js';import'@react-icons/all-files/md/MdNotifications.js';import'@react-icons/all-files/md/MdHome.js';import'@react-icons/all-files/md/MdInbox.js';import'@react-icons/all-files/md/MdEdit.js';import'@react-icons/all-files/md/MdDelete.js';import'@react-icons/all-files/md/MdSend.js';import'@react-icons/all-files/md/MdRefresh.js';import'@react-icons/all-files/md/MdMoreHoriz.js';import'@react-icons/all-files/md/MdMoreVert.js';import'@react-icons/all-files/md/MdLock.js';import'@react-icons/all-files/md/MdPublic.js';import {useTranslation}from'react-i18next';const InviteMembers = ({
|
|
2
|
+
organizationName,
|
|
3
|
+
sharableLink
|
|
4
|
+
}) => {
|
|
5
|
+
const {
|
|
6
|
+
t
|
|
7
|
+
} = useTranslation();
|
|
8
|
+
const location = useLocation();
|
|
9
|
+
const navigate = useNavigate();
|
|
10
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
11
|
+
const orgSlug = location.pathname.split("/")[2];
|
|
12
|
+
const handleShareLink = useCallback(async () => {
|
|
13
|
+
if (sharableLink) {
|
|
14
|
+
try {
|
|
15
|
+
if (navigator.share) {
|
|
16
|
+
await navigator.share({
|
|
17
|
+
title: `Join ${organizationName || "our team"}`,
|
|
18
|
+
text: `Join us on the messenger platform`,
|
|
19
|
+
url: sharableLink
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
await navigator.clipboard.writeText(sharableLink);
|
|
23
|
+
alert("Link copied to clipboard!");
|
|
24
|
+
}
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error("Error sharing:", error);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
setIsModalOpen(false);
|
|
30
|
+
}, [sharableLink, organizationName]);
|
|
31
|
+
const handleAddFromContacts = useCallback(() => {
|
|
32
|
+
navigate(`/o/${orgSlug}/home/invite/contacts`);
|
|
33
|
+
setIsModalOpen(false);
|
|
34
|
+
}, [navigate, orgSlug]);
|
|
35
|
+
const handleAddByEmail = useCallback(() => {
|
|
36
|
+
navigate(`/o/${orgSlug}/home/invite/email`);
|
|
37
|
+
setIsModalOpen(false);
|
|
38
|
+
}, [navigate, orgSlug]);
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-2 px-4", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => setIsModalOpen(true), className: "w-full flex items-center gap-3 py-3 px-3 hover:bg-gray-50 rounded-lg transition-colors", children: [
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: "p-2 bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(FiUserPlus, { className: "w-5 h-5 text-gray-600" }) }),
|
|
42
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-800 font-medium text-sm", children: "Add teammates" })
|
|
43
|
+
] }),
|
|
44
|
+
isModalOpen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center", children: [
|
|
45
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-black/50", onClick: () => setIsModalOpen(false) }),
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { className: "relative bg-white rounded-xl shadow-xl w-full max-w-md mx-4 overflow-hidden", children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200", children: [
|
|
48
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Invite people to join your team" }),
|
|
49
|
+
/* @__PURE__ */ jsx("button", { onClick: () => setIsModalOpen(false), className: "p-2 hover:bg-gray-100 rounded-full transition-colors", children: /* @__PURE__ */ jsx(FiX, { className: "w-5 h-5 text-gray-500" }) })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ jsxs("div", { className: "p-4 space-y-3", children: [
|
|
52
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleShareLink, className: "w-full flex items-center justify-center gap-2 py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium", children: [
|
|
53
|
+
/* @__PURE__ */ jsx(FiShare2, { className: "w-5 h-5" }),
|
|
54
|
+
"Share a Link"
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleAddFromContacts, className: "w-full flex items-center justify-center gap-2 py-3 px-4 bg-gray-100 hover:bg-gray-200 text-gray-900 rounded-lg transition-colors font-medium", children: [
|
|
57
|
+
/* @__PURE__ */ jsx(FiUserPlus, { className: "w-5 h-5" }),
|
|
58
|
+
"Add from Contacts"
|
|
59
|
+
] }),
|
|
60
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleAddByEmail, className: "w-full flex items-center justify-center gap-2 py-3 px-4 bg-gray-100 hover:bg-gray-200 text-gray-900 rounded-lg transition-colors font-medium", children: [
|
|
61
|
+
/* @__PURE__ */ jsx(FiMail, { className: "w-5 h-5" }),
|
|
62
|
+
"Add by Email"
|
|
63
|
+
] })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx("div", { className: "px-6 py-4 border-t border-gray-200", children: /* @__PURE__ */ jsx("button", { onClick: () => setIsModalOpen(false), className: "w-full py-2 text-gray-500 hover:text-gray-700 font-medium transition-colors", children: "Cancel" }) })
|
|
66
|
+
] })
|
|
67
|
+
] })
|
|
68
|
+
] });
|
|
69
|
+
};
|
|
70
|
+
React.memo(InviteMembers);export{InviteMembers};//# sourceMappingURL=InviteMembers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InviteMembers.js","sources":["../../../src/components/Home/InviteMembers.tsx"],"sourcesContent":["import React, { useState, useCallback } from 'react';\nimport { useLocation, useNavigate } from '@remix-run/react';\nimport { FiShare2, FiUserPlus, FiMail, FiX } from '../../icons';\nimport { useTranslation } from 'react-i18next';\n\ninterface InviteMembersProps {\n organizationName?: string;\n sharableLink?: string;\n}\n\nexport const InviteMembers: React.FC<InviteMembersProps> = ({ \n organizationName,\n sharableLink \n}) => {\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const [isModalOpen, setIsModalOpen] = useState(false);\n const orgSlug = location.pathname.split('/')[2];\n\n const handleShareLink = useCallback(async () => {\n if (sharableLink) {\n try {\n if (navigator.share) {\n await navigator.share({\n title: `Join ${organizationName || 'our team'}`,\n text: `Join us on the messenger platform`,\n url: sharableLink,\n });\n } else {\n // Fallback to copying to clipboard\n await navigator.clipboard.writeText(sharableLink);\n alert('Link copied to clipboard!');\n }\n } catch (error) {\n console.error('Error sharing:', error);\n }\n }\n setIsModalOpen(false);\n }, [sharableLink, organizationName]);\n\n const handleAddFromContacts = useCallback(() => {\n navigate(`/o/${orgSlug}/home/invite/contacts`);\n setIsModalOpen(false);\n }, [navigate, orgSlug]);\n\n const handleAddByEmail = useCallback(() => {\n navigate(`/o/${orgSlug}/home/invite/email`);\n setIsModalOpen(false);\n }, [navigate, orgSlug]);\n\n return (\n <div className=\"py-2 px-4\">\n <button\n onClick={() => setIsModalOpen(true)}\n className=\"w-full flex items-center gap-3 py-3 px-3 hover:bg-gray-50 rounded-lg transition-colors\"\n >\n <div className=\"p-2 bg-gray-100 rounded-full\">\n <FiUserPlus className=\"w-5 h-5 text-gray-600\" />\n </div>\n <span className=\"text-gray-800 font-medium text-sm\">Add teammates</span>\n </button>\n\n {/* Modal */}\n {isModalOpen && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center\">\n {/* Backdrop */}\n <div \n className=\"absolute inset-0 bg-black/50\"\n onClick={() => setIsModalOpen(false)}\n />\n \n {/* Modal Content */}\n <div className=\"relative bg-white rounded-xl shadow-xl w-full max-w-md mx-4 overflow-hidden\">\n {/* Header */}\n <div className=\"flex items-center justify-between px-6 py-4 border-b border-gray-200\">\n <h3 className=\"text-lg font-semibold text-gray-900\">\n Invite people to join your team\n </h3>\n <button\n onClick={() => setIsModalOpen(false)}\n className=\"p-2 hover:bg-gray-100 rounded-full transition-colors\"\n >\n <FiX className=\"w-5 h-5 text-gray-500\" />\n </button>\n </div>\n\n {/* Actions */}\n <div className=\"p-4 space-y-3\">\n {/* Share Link */}\n <button\n onClick={handleShareLink}\n className=\"w-full flex items-center justify-center gap-2 py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors font-medium\"\n >\n <FiShare2 className=\"w-5 h-5\" />\n Share a Link\n </button>\n\n {/* Add from Contacts */}\n <button\n onClick={handleAddFromContacts}\n className=\"w-full flex items-center justify-center gap-2 py-3 px-4 bg-gray-100 hover:bg-gray-200 text-gray-900 rounded-lg transition-colors font-medium\"\n >\n <FiUserPlus className=\"w-5 h-5\" />\n Add from Contacts\n </button>\n\n {/* Add by Email */}\n <button\n onClick={handleAddByEmail}\n className=\"w-full flex items-center justify-center gap-2 py-3 px-4 bg-gray-100 hover:bg-gray-200 text-gray-900 rounded-lg transition-colors font-medium\"\n >\n <FiMail className=\"w-5 h-5\" />\n Add by Email\n </button>\n </div>\n\n {/* Footer */}\n <div className=\"px-6 py-4 border-t border-gray-200\">\n <button\n onClick={() => setIsModalOpen(false)}\n className=\"w-full py-2 text-gray-500 hover:text-gray-700 font-medium transition-colors\"\n >\n Cancel\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport default React.memo(InviteMembers);\n"],"names":[],"mappings":"itLAQO,MAAM,gBAA8C,CAAC;AAAA,EAC1D,gBAAA;AAAA,EACA;AACF,CAAA,KAAM;AACJ,EAAA,MAAM;AAAA,IACJ;AAAA,MACE,cAAA,EAAe;AACnB,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,KAAK,CAAA;AACpD,EAAA,MAAM,UAAU,QAAA,CAAS,QAAA,CAAS,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA;AAC9C,EAAA,MAAM,eAAA,GAAkB,YAAY,YAAY;AAC9C,IAAA,IAAI,YAAA,EAAc;AAChB,MAAA,IAAI;AACF,QAAA,IAAI,UAAU,KAAA,EAAO;AACnB,UAAA,MAAM,UAAU,KAAA,CAAM;AAAA,YACpB,KAAA,EAAO,CAAA,KAAA,EAAQ,gBAAA,IAAoB,UAAU,CAAA,CAAA;AAAA,YAC7C,IAAA,EAAM,CAAA,iCAAA,CAAA;AAAA,YACN,GAAA,EAAK;AAAA,WACN,CAAA;AAAA,QACH,CAAA,MAAO;AAEL,UAAA,MAAM,SAAA,CAAU,SAAA,CAAU,SAAA,CAAU,YAAY,CAAA;AAChD,UAAA,KAAA,CAAM,2BAA2B,CAAA;AAAA,QACnC;AAAA,MACF,SAAS,KAAA,EAAO;AACd,QAAA,OAAA,CAAQ,KAAA,CAAM,kBAAkB,KAAK,CAAA;AAAA,MACvC;AAAA,IACF;AACA,IAAA,cAAA,CAAe,KAAK,CAAA;AAAA,EACtB,CAAA,EAAG,CAAC,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AA,EACJ;AAAA,OAAA,EACJ;AAAA,KAAA,EACJ;AAAA,GAAA,EACR,CAAA;AACR;AACe,KAAA,CAAM,KAAK,aAAa,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React,{useState,useCallback}from'react';import {useLocation,useNavigate}from'@remix-run/react';import {FiChevronDown}from'@react-icons/all-files/fi/FiChevronDown.js';import {FiChevronRight}from'@react-icons/all-files/fi/FiChevronRight.js';import'@react-icons/all-files/fi/FiChevronLeft.js';import {FiPlus}from'@react-icons/all-files/fi/FiPlus.js';import {FiSearch}from'@react-icons/all-files/fi/FiSearch.js';import'@react-icons/all-files/fi/FiHash.js';import {FiLock}from'@react-icons/all-files/fi/FiLock.js';import {FiRefreshCw}from'@react-icons/all-files/fi/FiRefreshCw.js';import'@react-icons/all-files/fi/FiUser.js';import'@react-icons/all-files/fi/FiUserPlus.js';import'@react-icons/all-files/fi/FiShare2.js';import'@react-icons/all-files/fi/FiMail.js';import'@react-icons/all-files/fi/FiX.js';import'@react-icons/all-files/fi/FiEdit.js';import'@react-icons/all-files/fi/FiEdit2.js';import'@react-icons/all-files/fi/FiMessageSquare.js';import'@react-icons/all-files/fi/FiBookmark.js';import'@react-icons/all-files/fi/FiSend.js';import'@react-icons/all-files/fi/FiMoreHorizontal.js';import'@react-icons/all-files/fi/FiMoreVertical.js';import'@react-icons/all-files/fi/FiSettings.js';import'@react-icons/all-files/fi/FiHome.js';import'@react-icons/all-files/fi/FiInbox.js';import'@react-icons/all-files/fi/FiUsers.js';import'@react-icons/all-files/fi/FiMessageCircle.js';import'@react-icons/all-files/fi/FiBell.js';import'@react-icons/all-files/fi/FiLogOut.js';import'@react-icons/all-files/fi/FiMenu.js';import'@react-icons/all-files/fi/FiTrash2.js';import'@react-icons/all-files/fi/FiCopy.js';import'@react-icons/all-files/fi/FiCheck.js';import'@react-icons/all-files/fi/FiAlertCircle.js';import'@react-icons/all-files/fi/FiInfo.js';import'@react-icons/all-files/vsc/VscChromeClose.js';import'@react-icons/all-files/vsc/VscAdd.js';import'@react-icons/all-files/vsc/VscSearch.js';import'@react-icons/all-files/vsc/VscMenu.js';import'@react-icons/all-files/go/GoGlobe.js';import'@react-icons/all-files/go/GoOrganization.js';import'@react-icons/all-files/go/GoPerson.js';import'@react-icons/all-files/go/GoComment.js';import'@react-icons/all-files/ri/RiAdminFill.js';import'@react-icons/all-files/ri/RiAdminLine.js';import'@react-icons/all-files/ri/RiTeamLine.js';import'@react-icons/all-files/ri/RiTeamFill.js';import'@react-icons/all-files/ai/AiOutlineHome.js';import'@react-icons/all-files/ai/AiOutlineInbox.js';import'@react-icons/all-files/ai/AiOutlineMessage.js';import'@react-icons/all-files/ai/AiOutlineTeam.js';import'@react-icons/all-files/ai/AiOutlineSetting.js';import'@react-icons/all-files/ai/AiOutlineUser.js';import'@react-icons/all-files/ai/AiOutlinePlus.js';import'@react-icons/all-files/ai/AiOutlineClose.js';import'@react-icons/all-files/ai/AiOutlineSearch.js';import'@react-icons/all-files/ai/AiOutlineEdit.js';import'@react-icons/all-files/ai/AiOutlineDelete.js';import'@react-icons/all-files/ai/AiOutlineSend.js';import'@react-icons/all-files/ai/AiOutlineBell.js';import'@react-icons/all-files/ai/AiOutlineLogout.js';import'@react-icons/all-files/ai/AiOutlineMenu.js';import'@react-icons/all-files/ai/AiOutlineCopy.js';import'@react-icons/all-files/ai/AiOutlineCheck.js';import'@react-icons/all-files/ai/AiOutlineWarning.js';import'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import'@react-icons/all-files/bs/BsHash.js';import'@react-icons/all-files/bs/BsLock.js';import'@react-icons/all-files/bs/BsPeople.js';import'@react-icons/all-files/bs/BsPerson.js';import'@react-icons/all-files/bs/BsChat.js';import'@react-icons/all-files/bs/BsChatDots.js';import'@react-icons/all-files/bs/BsThreeDots.js';import'@react-icons/all-files/bs/BsThreeDotsVertical.js';import'@react-icons/all-files/hi/HiOutlineHashtag.js';import'@react-icons/all-files/hi/HiOutlineLockClosed.js';import'@react-icons/all-files/hi/HiOutlineUserGroup.js';import'@react-icons/all-files/hi/HiOutlineUser.js';import'@react-icons/all-files/hi/HiOutlineChat.js';import'@react-icons/all-files/hi/HiOutlinePencil.js';import'@react-icons/all-files/hi/HiOutlineDotsHorizontal.js';import'@react-icons/all-files/hi/HiOutlineDotsVertical.js';import'@react-icons/all-files/hi/HiOutlinePlus.js';import'@react-icons/all-files/hi/HiOutlineX.js';import'@react-icons/all-files/hi/HiOutlineSearch.js';import'@react-icons/all-files/hi/HiOutlineHome.js';import'@react-icons/all-files/hi/HiOutlineInbox.js';import'@react-icons/all-files/hi/HiOutlineBell.js';import'@react-icons/all-files/hi/HiOutlineCog.js';import'@react-icons/all-files/io/IoMdAdd.js';import'@react-icons/all-files/io/IoMdClose.js';import'@react-icons/all-files/io/IoMdSearch.js';import'@react-icons/all-files/io/IoMdMenu.js';import'@react-icons/all-files/io/IoMdSettings.js';import'@react-icons/all-files/io/IoMdPerson.js';import'@react-icons/all-files/io/IoMdPeople.js';import'@react-icons/all-files/io/IoMdChatbubbles.js';import'@react-icons/all-files/io/IoMdNotifications.js';import'@react-icons/all-files/md/MdAdd.js';import'@react-icons/all-files/md/MdClose.js';import'@react-icons/all-files/md/MdSearch.js';import'@react-icons/all-files/md/MdMenu.js';import'@react-icons/all-files/md/MdSettings.js';import'@react-icons/all-files/md/MdPerson.js';import'@react-icons/all-files/md/MdPeople.js';import'@react-icons/all-files/md/MdChat.js';import'@react-icons/all-files/md/MdNotifications.js';import'@react-icons/all-files/md/MdHome.js';import'@react-icons/all-files/md/MdInbox.js';import'@react-icons/all-files/md/MdEdit.js';import'@react-icons/all-files/md/MdDelete.js';import'@react-icons/all-files/md/MdSend.js';import'@react-icons/all-files/md/MdRefresh.js';import'@react-icons/all-files/md/MdMoreHoriz.js';import'@react-icons/all-files/md/MdMoreVert.js';import'@react-icons/all-files/md/MdLock.js';import'@react-icons/all-files/md/MdPublic.js';import {useTranslation}from'react-i18next';const Teams = ({
|
|
2
|
+
teams = [],
|
|
3
|
+
loading = false,
|
|
4
|
+
error = null,
|
|
5
|
+
onRefetch
|
|
6
|
+
}) => {
|
|
7
|
+
const {
|
|
8
|
+
t
|
|
9
|
+
} = useTranslation();
|
|
10
|
+
const location = useLocation();
|
|
11
|
+
const navigate = useNavigate();
|
|
12
|
+
const [isExpanded, setIsExpanded] = useState(true);
|
|
13
|
+
const orgSlug = location.pathname.split("/")[2];
|
|
14
|
+
const handleTeamClick = useCallback((team) => {
|
|
15
|
+
navigate(`/o/${orgSlug}/home/team/${team.id}`, {
|
|
16
|
+
state: {
|
|
17
|
+
team
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}, [navigate, orgSlug]);
|
|
21
|
+
const handleRefetch = useCallback(() => {
|
|
22
|
+
onRefetch == null ? void 0 : onRefetch();
|
|
23
|
+
}, [onRefetch]);
|
|
24
|
+
const ListEmptyComponent = () => {
|
|
25
|
+
if (error) {
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsxs("div", { className: "p-2 bg-red-50 rounded", children: [
|
|
27
|
+
/* @__PURE__ */ jsx("p", { className: "text-red-600 text-sm mb-2 font-medium", children: "Team service is temporarily unavailable." }),
|
|
28
|
+
/* @__PURE__ */ jsxs("button", { onClick: handleRefetch, className: "flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(FiRefreshCw, { className: "w-4 h-4" }),
|
|
30
|
+
"Retry"
|
|
31
|
+
] })
|
|
32
|
+
] }) });
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center py-4 px-3", children: [
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 mb-2 rounded-full bg-gray-100", children: /* @__PURE__ */ jsx(FiLock, { className: "w-5 h-5 text-gray-500" }) }),
|
|
36
|
+
/* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm text-center", children: "No teams available" })
|
|
37
|
+
] });
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-2", children: [
|
|
40
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => setIsExpanded(!isExpanded), className: "w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50", children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-gray-900", children: "Teams" }),
|
|
42
|
+
isExpanded ? /* @__PURE__ */ jsx(FiChevronDown, { className: "w-4 h-4 text-gray-600" }) : /* @__PURE__ */ jsx(FiChevronRight, { className: "w-4 h-4 text-gray-600" })
|
|
43
|
+
] }),
|
|
44
|
+
isExpanded && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
45
|
+
loading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-4", children: /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500" }) }) : teams.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
46
|
+
teams.map((team) => /* @__PURE__ */ jsxs("button", { onClick: () => handleTeamClick(team), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors", children: [
|
|
47
|
+
/* @__PURE__ */ jsx(FiLock, { className: "w-4 h-4 text-gray-500 flex-shrink-0" }),
|
|
48
|
+
/* @__PURE__ */ jsx("span", { className: "text-gray-900 text-sm truncate", children: team.title })
|
|
49
|
+
] }, team.id)),
|
|
50
|
+
teams.length >= 10 && /* @__PURE__ */ jsxs("button", { onClick: () => navigate(`/o/${orgSlug}/home/teams`), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(FiSearch, { className: "w-4 h-4" }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Browse all Teams" })
|
|
53
|
+
] })
|
|
54
|
+
] }) : /* @__PURE__ */ jsx(ListEmptyComponent, {}),
|
|
55
|
+
/* @__PURE__ */ jsxs("button", { onClick: () => navigate(`/o/${orgSlug}/home/teams/new`), className: "w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(FiPlus, { className: "w-4 h-4" }),
|
|
57
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: "Add Team" })
|
|
58
|
+
] })
|
|
59
|
+
] })
|
|
60
|
+
] });
|
|
61
|
+
};
|
|
62
|
+
React.memo(Teams);export{Teams};//# sourceMappingURL=Teams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Teams.js","sources":["../../../src/components/Home/Teams.tsx"],"sourcesContent":["import React, { useState, useCallback, useContext } from 'react';\nimport { useLocation, useNavigate } from '@remix-run/react';\nimport { FiChevronDown, FiChevronRight, FiPlus, FiSearch, FiLock, FiRefreshCw } from '../../icons';\nimport { useTranslation } from 'react-i18next';\n\ninterface TeamsProps {\n teams?: any[];\n loading?: boolean;\n error?: any;\n onRefetch?: () => void;\n}\n\nexport const Teams: React.FC<TeamsProps> = ({ \n teams = [], \n loading = false, \n error = null,\n onRefetch \n}) => {\n const { t } = useTranslation();\n const location = useLocation();\n const navigate = useNavigate();\n const [isExpanded, setIsExpanded] = useState(true);\n const orgSlug = location.pathname.split('/')[2];\n\n const handleTeamClick = useCallback((team: any) => {\n navigate(`/o/${orgSlug}/home/team/${team.id}`, {\n state: { team }\n });\n }, [navigate, orgSlug]);\n\n const handleRefetch = useCallback(() => {\n onRefetch?.();\n }, [onRefetch]);\n\n const ListEmptyComponent = () => {\n if (error) {\n return (\n <div className=\"p-3\">\n <div className=\"p-2 bg-red-50 rounded\">\n <p className=\"text-red-600 text-sm mb-2 font-medium\">\n Team service is temporarily unavailable.\n </p>\n <button \n onClick={handleRefetch}\n className=\"flex items-center gap-1 text-blue-600 text-sm font-medium hover:underline\"\n >\n <FiRefreshCw className=\"w-4 h-4\" />\n Retry\n </button>\n </div>\n </div>\n );\n }\n\n return (\n <div className=\"flex flex-col items-center py-4 px-3\">\n <div className=\"p-3 mb-2 rounded-full bg-gray-100\">\n <FiLock className=\"w-5 h-5 text-gray-500\" />\n </div>\n <p className=\"text-gray-500 text-sm text-center\">No teams available</p>\n </div>\n );\n };\n\n return (\n <div className=\"py-2\">\n {/* Section Header */}\n <button\n onClick={() => setIsExpanded(!isExpanded)}\n className=\"w-full flex items-center justify-between px-4 py-2 hover:bg-gray-50\"\n >\n <span className=\"font-semibold text-gray-900\">Teams</span>\n {isExpanded ? (\n <FiChevronDown className=\"w-4 h-4 text-gray-600\" />\n ) : (\n <FiChevronRight className=\"w-4 h-4 text-gray-600\" />\n )}\n </button>\n\n {/* Teams List */}\n {isExpanded && (\n <div className=\"mt-1\">\n {loading ? (\n <div className=\"flex items-center justify-center py-4\">\n <div className=\"animate-spin rounded-full h-5 w-5 border-t-2 border-b-2 border-blue-500\"></div>\n </div>\n ) : teams.length > 0 ? (\n <>\n {teams.map((team) => (\n <button\n key={team.id}\n onClick={() => handleTeamClick(team)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 transition-colors\"\n >\n <FiLock className=\"w-4 h-4 text-gray-500 flex-shrink-0\" />\n <span className=\"text-gray-900 text-sm truncate\">{team.title}</span>\n </button>\n ))}\n \n {/* Browse all teams */}\n {teams.length >= 10 && (\n <button\n onClick={() => navigate(`/o/${orgSlug}/home/teams`)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiSearch className=\"w-4 h-4\" />\n <span className=\"text-sm\">Browse all Teams</span>\n </button>\n )}\n </>\n ) : (\n <ListEmptyComponent />\n )}\n\n {/* Add Team */}\n <button\n onClick={() => navigate(`/o/${orgSlug}/home/teams/new`)}\n className=\"w-full flex items-center gap-3 px-4 py-2 hover:bg-gray-50 text-gray-500\"\n >\n <FiPlus className=\"w-4 h-4\" />\n <span className=\"text-sm\">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AA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,UAAA,EAAQ;AAAA,OAAA,EACtC;AAAA,KAAA,EACJ;AAAA,GAAA,EACR,CAAA;AACR;AACe,KAAA,CAAM,KAAK,KAAK,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {jsx,jsxs}from'react/jsx-runtime';import React from'react';import {useNavigate,useLocation}from'@remix-run/react';import'@react-icons/all-files/fi/FiChevronDown.js';import'@react-icons/all-files/fi/FiChevronRight.js';import'@react-icons/all-files/fi/FiChevronLeft.js';import'@react-icons/all-files/fi/FiPlus.js';import'@react-icons/all-files/fi/FiSearch.js';import'@react-icons/all-files/fi/FiHash.js';import'@react-icons/all-files/fi/FiLock.js';import'@react-icons/all-files/fi/FiRefreshCw.js';import'@react-icons/all-files/fi/FiUser.js';import'@react-icons/all-files/fi/FiUserPlus.js';import'@react-icons/all-files/fi/FiShare2.js';import'@react-icons/all-files/fi/FiMail.js';import'@react-icons/all-files/fi/FiX.js';import'@react-icons/all-files/fi/FiEdit.js';import'@react-icons/all-files/fi/FiEdit2.js';import {FiMessageSquare}from'@react-icons/all-files/fi/FiMessageSquare.js';import {FiBookmark}from'@react-icons/all-files/fi/FiBookmark.js';import {FiSend}from'@react-icons/all-files/fi/FiSend.js';import'@react-icons/all-files/fi/FiMoreHorizontal.js';import'@react-icons/all-files/fi/FiMoreVertical.js';import'@react-icons/all-files/fi/FiSettings.js';import'@react-icons/all-files/fi/FiHome.js';import'@react-icons/all-files/fi/FiInbox.js';import'@react-icons/all-files/fi/FiUsers.js';import'@react-icons/all-files/fi/FiMessageCircle.js';import'@react-icons/all-files/fi/FiBell.js';import'@react-icons/all-files/fi/FiLogOut.js';import'@react-icons/all-files/fi/FiMenu.js';import'@react-icons/all-files/fi/FiTrash2.js';import'@react-icons/all-files/fi/FiCopy.js';import'@react-icons/all-files/fi/FiCheck.js';import'@react-icons/all-files/fi/FiAlertCircle.js';import'@react-icons/all-files/fi/FiInfo.js';import'@react-icons/all-files/vsc/VscChromeClose.js';import'@react-icons/all-files/vsc/VscAdd.js';import'@react-icons/all-files/vsc/VscSearch.js';import'@react-icons/all-files/vsc/VscMenu.js';import'@react-icons/all-files/go/GoGlobe.js';import'@react-icons/all-files/go/GoOrganization.js';import'@react-icons/all-files/go/GoPerson.js';import'@react-icons/all-files/go/GoComment.js';import'@react-icons/all-files/ri/RiAdminFill.js';import'@react-icons/all-files/ri/RiAdminLine.js';import'@react-icons/all-files/ri/RiTeamLine.js';import'@react-icons/all-files/ri/RiTeamFill.js';import'@react-icons/all-files/ai/AiOutlineHome.js';import'@react-icons/all-files/ai/AiOutlineInbox.js';import'@react-icons/all-files/ai/AiOutlineMessage.js';import'@react-icons/all-files/ai/AiOutlineTeam.js';import'@react-icons/all-files/ai/AiOutlineSetting.js';import'@react-icons/all-files/ai/AiOutlineUser.js';import'@react-icons/all-files/ai/AiOutlinePlus.js';import'@react-icons/all-files/ai/AiOutlineClose.js';import'@react-icons/all-files/ai/AiOutlineSearch.js';import'@react-icons/all-files/ai/AiOutlineEdit.js';import'@react-icons/all-files/ai/AiOutlineDelete.js';import'@react-icons/all-files/ai/AiOutlineSend.js';import'@react-icons/all-files/ai/AiOutlineBell.js';import'@react-icons/all-files/ai/AiOutlineLogout.js';import'@react-icons/all-files/ai/AiOutlineMenu.js';import'@react-icons/all-files/ai/AiOutlineCopy.js';import'@react-icons/all-files/ai/AiOutlineCheck.js';import'@react-icons/all-files/ai/AiOutlineWarning.js';import'@react-icons/all-files/ai/AiOutlineInfoCircle.js';import'@react-icons/all-files/bs/BsHash.js';import'@react-icons/all-files/bs/BsLock.js';import'@react-icons/all-files/bs/BsPeople.js';import'@react-icons/all-files/bs/BsPerson.js';import'@react-icons/all-files/bs/BsChat.js';import'@react-icons/all-files/bs/BsChatDots.js';import'@react-icons/all-files/bs/BsThreeDots.js';import'@react-icons/all-files/bs/BsThreeDotsVertical.js';import'@react-icons/all-files/hi/HiOutlineHashtag.js';import'@react-icons/all-files/hi/HiOutlineLockClosed.js';import'@react-icons/all-files/hi/HiOutlineUserGroup.js';import'@react-icons/all-files/hi/HiOutlineUser.js';import'@react-icons/all-files/hi/HiOutlineChat.js';import'@react-icons/all-files/hi/HiOutlinePencil.js';import'@react-icons/all-files/hi/HiOutlineDotsHorizontal.js';import'@react-icons/all-files/hi/HiOutlineDotsVertical.js';import'@react-icons/all-files/hi/HiOutlinePlus.js';import'@react-icons/all-files/hi/HiOutlineX.js';import'@react-icons/all-files/hi/HiOutlineSearch.js';import'@react-icons/all-files/hi/HiOutlineHome.js';import'@react-icons/all-files/hi/HiOutlineInbox.js';import'@react-icons/all-files/hi/HiOutlineBell.js';import'@react-icons/all-files/hi/HiOutlineCog.js';import'@react-icons/all-files/io/IoMdAdd.js';import'@react-icons/all-files/io/IoMdClose.js';import'@react-icons/all-files/io/IoMdSearch.js';import'@react-icons/all-files/io/IoMdMenu.js';import'@react-icons/all-files/io/IoMdSettings.js';import'@react-icons/all-files/io/IoMdPerson.js';import'@react-icons/all-files/io/IoMdPeople.js';import'@react-icons/all-files/io/IoMdChatbubbles.js';import'@react-icons/all-files/io/IoMdNotifications.js';import'@react-icons/all-files/md/MdAdd.js';import'@react-icons/all-files/md/MdClose.js';import'@react-icons/all-files/md/MdSearch.js';import'@react-icons/all-files/md/MdMenu.js';import'@react-icons/all-files/md/MdSettings.js';import'@react-icons/all-files/md/MdPerson.js';import'@react-icons/all-files/md/MdPeople.js';import'@react-icons/all-files/md/MdChat.js';import'@react-icons/all-files/md/MdNotifications.js';import'@react-icons/all-files/md/MdHome.js';import'@react-icons/all-files/md/MdInbox.js';import'@react-icons/all-files/md/MdEdit.js';import'@react-icons/all-files/md/MdDelete.js';import'@react-icons/all-files/md/MdSend.js';import'@react-icons/all-files/md/MdRefresh.js';import'@react-icons/all-files/md/MdMoreHoriz.js';import'@react-icons/all-files/md/MdMoreVert.js';import'@react-icons/all-files/md/MdLock.js';import'@react-icons/all-files/md/MdPublic.js';const SLIDER_ITEMS = [{
|
|
2
|
+
id: 1,
|
|
3
|
+
icon: FiMessageSquare,
|
|
4
|
+
title: "Threads",
|
|
5
|
+
subTitle: "0 New",
|
|
6
|
+
route: "threads"
|
|
7
|
+
}, {
|
|
8
|
+
id: 2,
|
|
9
|
+
icon: FiBookmark,
|
|
10
|
+
title: "Later",
|
|
11
|
+
subTitle: "0 items",
|
|
12
|
+
route: null
|
|
13
|
+
}, {
|
|
14
|
+
id: 3,
|
|
15
|
+
icon: FiSend,
|
|
16
|
+
title: "Draft & Sent",
|
|
17
|
+
subTitle: "0 drafts",
|
|
18
|
+
route: null
|
|
19
|
+
}];
|
|
20
|
+
const TopCommonSlider = () => {
|
|
21
|
+
const navigate = useNavigate();
|
|
22
|
+
const location = useLocation();
|
|
23
|
+
const orgSlug = location.pathname.split("/")[2];
|
|
24
|
+
const handleClick = (route) => {
|
|
25
|
+
if (route) {
|
|
26
|
+
navigate(`/o/${orgSlug}/home/${route}`);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { className: "flex gap-3 px-4 py-3", children: SLIDER_ITEMS.map((item) => /* @__PURE__ */ jsxs("button", { onClick: () => handleClick(item.route), disabled: !item.route, className: `flex-1 flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg transition-all ${item.route ? "hover:border-blue-400 hover:bg-blue-50 cursor-pointer" : "opacity-60 cursor-not-allowed"}`, children: [
|
|
30
|
+
/* @__PURE__ */ jsx(item.icon, { className: "w-8 h-8 text-gray-700 mb-2" }),
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-800", children: item.title }),
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500", children: item.subTitle })
|
|
33
|
+
] }, item.id)) });
|
|
34
|
+
};
|
|
35
|
+
React.memo(TopCommonSlider);export{TopCommonSlider};//# sourceMappingURL=TopCommonSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TopCommonSlider.js","sources":["../../../src/components/Home/TopCommonSlider.tsx"],"sourcesContent":["import React from 'react';\nimport { useNavigate, useLocation } from '@remix-run/react';\nimport { FiMessageSquare, FiBookmark, FiSend } from '../../icons';\n\ntype SliderItem = {\n id: number;\n icon: React.ComponentType<{ className?: string }>;\n title: string;\n subTitle: string;\n route: string | null;\n};\n\nconst SLIDER_ITEMS: SliderItem[] = [\n {\n id: 1,\n icon: FiMessageSquare,\n title: 'Threads',\n subTitle: '0 New',\n route: 'threads',\n },\n {\n id: 2,\n icon: FiBookmark,\n title: 'Later',\n subTitle: '0 items',\n route: null,\n },\n {\n id: 3,\n icon: FiSend,\n title: 'Draft & Sent',\n subTitle: '0 drafts',\n route: null,\n },\n];\n\nexport const TopCommonSlider: React.FC = () => {\n const navigate = useNavigate();\n const location = useLocation();\n const orgSlug = location.pathname.split('/')[2];\n\n const handleClick = (route: string | null) => {\n if (route) {\n navigate(`/o/${orgSlug}/home/${route}`);\n }\n };\n\n return (\n <div className=\"flex gap-3 px-4 py-3\">\n {SLIDER_ITEMS.map((item) => (\n <button\n key={item.id}\n onClick={() => handleClick(item.route)}\n disabled={!item.route}\n className={`flex-1 flex flex-col items-center justify-center p-4 border border-gray-200 rounded-lg transition-all ${\n item.route \n ? 'hover:border-blue-400 hover:bg-blue-50 cursor-pointer' \n : 'opacity-60 cursor-not-allowed'\n }`}\n >\n <item.icon className=\"w-8 h-8 text-gray-700 mb-2\" />\n <span className=\"text-sm font-medium text-gray-800\">{item.title}</span>\n <span className=\"text-xs text-gray-500\">{item.subTitle}</span>\n </button>\n ))}\n </div>\n );\n};\n\nexport default React.memo(TopCommonSlider);\n"],"names":[],"mappings":"6oLAYA,MAAM,eAA6B,CAAC;AAAA,EAClC,EAAA,EAAI,CAAA;AAAA,EACJ,IAAA,EAAM,eAAA;AAAA,EACN,KAAA,EAAO,SAAA;AAAA,EACP,QAAA,EAAU,OAAA;AAAA,EACV,KAAA,EAAO;AACT,CAAA,EAAG;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